[% META title="Request History" %]
<!-- BEGIN history/default.tt -->
[% # PROCESS dumper.tt dump = history.request_data %]
[% # PROCESS dumper.tt dump = history.error_codes %]
[% IF history.patient_data %]
<h3 class="header">Patient demographics:</h3>
<div class="indent">
<table class="history">
<tr>
<th>Day</th>
<th>Date</th>
<th>Time</th>
<th>UserID</th>
<th>Changed</th>
<th>From</th>
<th>To</th>
<th>Reason</th>
</tr>
[% FOREACH entry IN history.patient_data %]
[% import(entry) %]
<tr>
<td>[% changed_on.strftime('%a') %]</td>
<td>[% changed_on.strftime('%d.%b.%Y') %]</td>
<td>[% changed_on.strftime('%T') %]</td>
<td>[% changed_by | upper %]</td>
<td>[% field_name | replace('_', ' ') %]</td>
<td>[% changed_from || site.html.grey_null %]</td>
<td>[% changed_to || site.html.grey_null %]</td>
<td align="center">
[% history.error_codes.item(error_code).description %]
[[% error_code | upper %]]
</td>
</tr>
[% END %]
</table>
</div>
[% END %]
<h3 class="header">Request history:</h3>
[% IF history.request_data.size %]
<div class="indent">
<table class="history">
<tr>
<th>Day</th>
<th>Date</th>
<th>Time</th>
<th>UserID</th>
<th>Action</th>
</tr>
[% FOREACH event IN history.request_data %]
<tr class="[% loop.count % 2 ? 'normal' : 'bkgd_grey' %]">
<td>
[% event.time.strftime('%a') %]
</td>
<td>
[% event.time.strftime('%d.%b.%Y') %]
</td>
<td>
[% event.time.strftime('%T') %]
</td>
<td>
[% event.user.username | upper %]
</td>
<td>
[% event.action | html %]
[% IF event.action.match('amended comment')
|| event.action.match('modified Comment') %]
[<a href="[% url_with_path.replace('=', 'comment') %]">
view
</a>]
[% END %]
</td>
</tr>
[% END %]
</table>
</div>
[% ELSE %]
<p class="indent">[ NONE ]</p>
[% END %]
[% IF history.diagnosis_data.size %]
<h3 class="header">Diagnosis history:</h3>
<div class="indent">
<table class="history">
<tr>
<th>Day</th>
<th>Date</th>
<th>Time</th>
<th>UserID</th>
<th>Old diagnosis</th>
<th>Reason</th>
</tr>
[% FOREACH event IN history.diagnosis_data %]
<tr>
<td>
[% event.time.strftime('%a') %]
</td>
<td>
[% event.time.strftime('%d.%b.%Y') %]
</td>
<td>
[% event.time.strftime('%T') %]
</td>
<td>
[% event.user.username | upper %]
</td>
<td>
[% event.diagnosis.name | html %]
</td>
<td>
[% event.reason %]
</td>
</tr>
[% END %]
</table>
</div>
[% END %]
<h3 class="header">Lab test history:</h3>
[% IF history.lab_test_data.size;
# PROCESS dumper.tt dump = history.lab_test_data %]
<div class="indent">
<table class="history">
<tr>
<th>Day</th>
<th>Date</th>
<th>Time</th>
<th>UserID</th>
<th>Action</th>
</tr>
[% FOREACH event IN history.lab_test_data %]
<tr class="[% loop.count % 2 ? 'normal' : 'bkgd_grey' %]">
<td>
[% event.time.strftime('%a ') %]
</td>
<td>
[% event.time.strftime('%d.%b.%Y') %]
</td>
<td>
[% event.time.strftime('%T') %]
</td>
<td>
[% event.user.username | upper %]
</td>
<td>
[% event.action %]
</td>
</tr>
[% END %]
</table>
</div>
[% ELSE %]
<p class="indent">[ NONE ]</p>
[% END %]
<p>[% site.html.back_button %]</p>
<!-- END history/default.tt -->