[% META title = 'Admin » Diagnosis New Lab Tests' -%]
<!-- BEGIN [% template.name %] -->
[% # PROCESS dumper.tt dump = lab_sections %]
[% # PROCESS dumper.tt dump = section_tests %]
[% # PROCESS dumper.tt dump = categories %]
[% # PROCESS dumper.tt dump = diagnosis_lab_tests %]
<h2 align="center">Configure Diagnosis Request New Lab Tests</h2>
[% PROCESS admin/lab/test/diagnosistests/showhide.tt %]
[% IF c.query.param('diagnosis_id') %]
<h2 class="header">[% diagnosis_name %]</h2 class="header">
[% END %]
<form method="get" action="[% app_url %]/admin/lab_test_diagnosis-tests"
name="diagnosis" id="diagnosis">
<table class="indent">
<tr>
<td class="label">Diagnosis category:</td>
<td class="content">
[% PROCESS admin/lab/test/diagnosistests/category_select.tt %]
</td>
<td rowspan="2" class="borderless">
[% site.html.submit %] [% site.html.reset %]
</td>
</tr>
</table>
</form>
[% IF section_tests.size %]
[% IF NOT diagnosis_lab_tests.size %]
<p class="indent warning">No lab-tests configured</p>
[% END %]
<form method="get" action="[% app_url %]/admin/lab_test_diagnosis-tests/update/[%
c.query.param('diagnosis_id') %]" name="diagnosisTests" id="diagnosisTests">
<div class="indent">
[% FOREACH section IN section_tests; # PROCESS dumper.tt dump = section;
section_name = section.key;
lab_tests = section.value;
%]
<p class="bold indent">[% section_name %]
[% div_name = section_name; INCLUDE site/snippets/toggleview.tt %]
[%
configured = [];
FOREACH test IN lab_tests;
NEXT UNLESS diagnosis_lab_tests.item(test.id);
label = test.test_type.match('panel')
? test.field_label _ ' panel' : test.field_label;
configured.push(label);
END;
IF configured.size;
'[<span class="red">'; configured.join('; '); '</span>]';
END;
%]
</p>
<div id="[% div_name %]" class="itemhidden">
<table class="results">
<tr>
[% count = 1 %]
[% FOREACH test IN lab_tests;
NEXT UNLESS # test.test_type == 'test'AND
test.is_active == 'yes'; # NB query already excludes inactive
selected = diagnosis_lab_tests.item(test.id);
class = selected ? 'bold' : 'normal';
%]
<td align="right" width="170">
<span class="[% class %]">
[% test.field_label %]
[% '[panel]' IF test.test_type.match('panel') %]
</span>:
</td>
<td>
<input type="checkbox" name="test_id" value="[% test.id %]"
[% 'checked' IF selected %] />
</td>
[% UNLESS loop.last OR # don't start new table unless multiple of 4:
( lab_tests.size > 4 AND count % 4 ) %]
</tr>
</table>
<table class="results">
<tr>
[% END %]
[% count = count + 1 %]
[% END %]
[% '<td></td>' IF count == 1 # or get invalid html %]
</tr>
</table>
</div>
[% END %]
</div>
<p class="center">
[% site.html.submit %]
[% site.html.reset %]
</p>
</form>
[% END %]
<!-- END [% template.name %] -->