[% META title = 'Admin » Linked Lab Tests' -%]
<!-- BEGIN [% template.name %] -->
[% # PROCESS dumper.tt dump = sections %]
[% # PROCESS dumper.tt dump = linked_tests_map %]
[% # PROCESS dumper.tt dump = vars %]
[% IF all_linked_tests.size %]
<p class="header">Linked Lab Tests</p>
<table class="indent">
<tr>
<th>Parent Test</th>
<th>Linked Test</th>
<td class="borderless"></td>
</tr>
[% FOREACH test IN all_linked_tests %]
<tr>
<td>
[% test.lab_test.field_label %]
[[% test.lab_test.lab_section.section_name %]]
</td>
<td>
[% test.linked_lab_test.field_label %]
[[% test.linked_lab_test.lab_section.section_name %]]
</td>
<td>
<a href="[% self_url %]?lab_section_id=[% test.lab_test.lab_section_id
%]&parent_test_id=[% test.lab_test.id %]">edit</a>
</td>
</tr>
[% END %]
</table>
[% ELSE %]
<p class="warning">No linked lab tests configured</p>
[% END %]
<p class="header">Configure Linked Lab Tests</p>
<form method="get" action="[% c.query.self_url %]" name="section" id="section">
<p class="bold">Select lab section of parent lab test:
<select name="lab_section_id" onChange="submit()">
<option value="">--</option>
[% FOREACH section IN sections %]
<option value="[% section.id %]"
[% 'selected' IF section.id == c.query.param('lab_section_id') %]>
[% section.section_name %]</option>
[% END %]
</select>
</p>
</form>
[% IF parent_tests.size; # PROCESS dumper.tt dump = parent_tests; %]
<form method="get" action="[% c.query.self_url %]" name="parent-test"
id="parent-test">
<input type="hidden" value="[% vars.lab_section_id %]"
name="lab_section_id" />
<div class="indent">
<p class="bold">1) Select parent lab test:</p>
<table class="results">
<tr>[% count = 1 %]
[% FOREACH test IN parent_tests;
class = linked_tests_map.item(test.id) ? 'red' : 'normal' %]
<td align="right" class="[% class %]" width="170">
[% test.field_label | html %]
</td>
<td>
<input type="radio" name="parent_test_id" value="[% test.id %]"
[% 'checked' IF test.id == vars.parent_test_id %] />
</td>
[% UNLESS loop.last OR ( count % 5 ) # don't start new table unless multiple of 6: %]
</tr>
</table>
<table class="results">
<tr>
[% END %]
[% count = count + 1 %]
[% END %]
[% '<td></td>' IF count == 1 # or get invalid html %]
</tr>
</table>
<p class="bold">2) Select lab section of linked lab test(s):
<select name="linked_lab_section_id"
[% UNLESS vars.linked_lab_section_id %]
onChange="submit()"[% END %]>
<option value="">--</option>
[% FOREACH section IN sections %]
<option value="[% section.id %]" [% 'selected' IF
section.id == vars.linked_lab_section_id %]>
[% section.section_name %]</option>
[% END %]
</select>
</p>
</div>
</form>
[% END %]
[% IF linked_lab_section_tests.size %]
<form method="get" action="[% app_url %]/admin/lab_test_linked/do_link/[%
vars.parent_test_id %]" name="linked-test" id="linked-test">
<div class="indent">
<p class="bold">3) Select linked lab test(s):</p>
<table class="results">
<tr>
[% count = 1 %]
[% FOREACH test IN linked_lab_section_tests %]
<td align="right" width="170">[% test.field_label | html %]</td>
<td>
<input type="checkbox" name="linked_test_id" value="[% test.id %]"
[% IF test.id == vars.parent_test_id %]disabled="disabled"[% END %] />
</td>
[% UNLESS loop.last OR ( count % 5 ) # don't start new table unless multiple of 6: %]
</tr>
</table>
<table class="results">
<tr>
[% END %]
[% count = count + 1 %]
[% END %]
[% '<td></td>' IF count == 1 # or get invalid html %]
</tr>
</table>
<p>[% site.html.submit %]</p>
</div>
</form>
[% END %]
<!-- END [% template.name %] -->