[%
# META title = '' # using my.meta_title to allow processing dynamic vars:
status_query = c.query.param('status_query').replace('_', ' ') | ucfirst;
my.meta_title = "Worklist » Request Status » ${status_query}"
-%]
<!-- BEGIN [% template.name %] -->
[% # PROCESS dumper.tt dump = request_options_map %]
[% # PROCESS dumper.tt dump = incomplete_lab_tests %]
[% status_query = c.query.param('status_query') %]
<h3>Request status - [% status_query.replace('_', ' ') %] cases
[[% requests.size %]]</h3>
<div class="indent">
<table>
<tr>
<td></td>
<th>Lab No</th>
<th>Name</th>
<th>Date</th>
<th>Sample</th>
<th>Source</th>
[% UNLESS status_query == 'unscreened' %]
<th>Presentation</th>
[% IF incomplete_lab_tests %]
<th>Incomplete tests</th>
[% END %]
[% END %]
<th>Delta</th>
</tr>
[% FOREACH data IN requests; # PROCESS dumper.tt dump = data.as_tree %]
[% patient = data.patient_case.patient %]
<tr>
<td>[% loop.count %]</td>
<td>
[% PROCESS site/lab_number.tt want_url = 1; # expects request object 'data' %]
</td>
[% class = request_options_map.item(data.id).urgent ? 'red' : 'normal' %]
<td class="[% class %]">
[% patient.last_name | upper %],
[% format_firstname(patient) || patient.first_name | ucfirst %]
[% patient.middle_name | ucfirst %]
</td>
<td>[% data.created_at.strftime('%d.%b.%Y') %]</td>
<td>
[% specimen_map.item(data.id).sample_code.join(', ') %]
[% INCLUDE site/snippets/doi.tt IF request_options_map.item(data.id).doi %]
</td>
<td>
[% SET location = data.patient_case.referral_source.display_name %]
[% PROCESS site/display_name.tt %]
</td>
[% UNLESS status_query == 'unscreened' %]
<td>
[% IF data.request_initial_screen;
data.request_initial_screen.screen.description;
ELSE; site.html.grey_null; END; %]
</td>
[% IF incomplete_lab_tests; tests = incomplete_lab_tests.${data.id} %]
<td>
[% IF tests; FOREACH t IN tests %]
<div class="no-wrap">
<span class="acronym" title="[% t.section %]">[% t.test %]</span>
</div>
[% END %]
[% ELSE %]
<span class="grey">[none]</span>
[% END %]
</td>
[% END %]
[% END %]
<td>[% duration_map.item(data.id) %]</td>
</tr>
[% END %]
</table>
</div>
<p>
[% site.html.back_button %]
</p>
<!-- END [% template.name %] -->