[% META title = 'Admin » Lab Tests' -%]
<!-- BEGIN admin/lab/test/default.tt -->
[% # PROCESS dumper.tt dump = c.config('msg') %]
[% PROCESS admin/lab_test_nav.tt page = 'lab_test' %]
[% lab_tests_dfv_js %]
<h2 align="center">Lab Tests</h2>
[% IF dfv_errors %]
<p class="error">[% c.config('msg').dfv_errors %]</p>
[% IF error_field_label # a 3-col unique key %]
<span class="red indent">combination of test name, lab section and test type
must be unique</span>
[% END %]
[% END %]
<p class="title">
[% div_name = 'new'; INCLUDE site/snippets/toggleview.tt %]
Add new entry
</p>
<div class="[% dfv_errors ? 'visible' : 'itemhidden' %]" id="[% div_name %]">
<form method="post" action="[% app_url %]/admin/lab_test/update" [% lab_tests_onsubmit %]
name="lab_test" id="lab_test">
[% INCLUDE site/snippets/help.tt file = 'newlabtest' %]
<div class="indent">
<table>
<tr>
[% meta_data = c.get_meta_data('LabTest');
max_length = meta_data.column('field_label').length; %]
<td class="label">Field label:</td>
<td class="content">
[% # uses 3-col unique key so can't validate by AJAX:
# INCLUDE site/ajax_input.tt, field = 'field_label' %]
<input type="text" name="field_label" maxlength="25" />
[ max [% max_length %] chars ]
</td>
</tr>
<tr>
[% max_length = meta_data.column('test_name').length; %]
<td class="label">Test name:</td>
<td class="content">
<input maxlength="[% max_length %]" name="test_name" size="20" />
[% IF error_test_name %]
[% error_test_name %]
[% ELSE %]
[ max [% max_length %] chars ]
[% END %]
</td>
</tr>
<tr>
<td class="label">Lab section:</td>
<td class="content">
<select name="lab_section_id" [% site.html.onfocus %]>
<option value="">--select one--</option>
[% FOREACH s IN sections %]
<option value="[% s.id %]">
[% s.section_name %]
</option>
[% END %]
</select>
[% error_lab_section_id %]
</td>
</tr>
<tr>
<td class="label">Test type:</td>
<td class="content">
<select name="test_type" [% site.html.onfocus %]>
[% FOREACH option IN ['test', 'panel'] %]
<option value="[% option %]">[% option %]</option>
[% END %]
</select>
[% error_test_type %]
</td>
</tr>
<tr>
<td class="label">Results:</td>
<td class="content">
<select name="has_results" [% site.html.onfocus %]>
[% FOREACH option IN ['yes', 'no'] %]
<option value="[% option %]">[% option %]</option>
[% END %]
</select>
[% error_has_results %]
</td>
</tr>
<tr>
<td class="label">Active:</td>
<td class="content">
<select name="is_active" [% site.html.onfocus %]>
[% FOREACH option IN ['yes', 'no'] %]
<option value="[% option %]">[% option %]</option>
[% END %]
</select>
[% error_is_active %]
</td>
</tr>
</table>
<p class="indent">[% site.html.submit %]</p>
</div>
</form>
</div>
<hr />
<form method="get" action="[% app_url %]/admin/lab_test"
name="section" id="section">
<p class="classname">Restrict by section (optional):
<select name="lab_section_id" onChange="submit()">
<option value="">-- none --</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>
[% # site.html.submit %]
</p>
</form>
[% IF tests.size # only empty if new db %]
<div class="[% dfv_errors ? 'itemhidden' : 'visible' %]">
[% PROCESS site/page_count.tt %]
<table>
<tr>
<th></th>
<th>
<a href="[% url_with_path %]?sort_by=field_label">
Field Label
</a>
</th>
<th>
<a href="[% url_with_path %]?sort_by=test_name">
Test Name
</a>
</th>
<th>
<a href="[% url_with_path %]?sort_by=lab_section.section_name">
Lab Section
</a>
</th>
<th>
<a href="[% url_with_path %]?sort_by=test_type">
Test Type
</a>
</th>
<th>
<a href="[% url_with_path %]?sort_by=has_results">
Results
</a>
</th>
<th>Active</th>
</tr>
[% FOREACH t IN tests %]
<tr>
<td>
[% IF cgi_pager; cgi_pager.first_pos_displayed + loop.count - 1; ELSE; loop.count; END %]
</td>
<td>
<input type="text" size="15" name="field_label" value="[% t.field_label %]"
[% site.html.disabled %] />
</td>
<td>
<input type="text" size="20" name="test_name" value="[% t.test_name %]"
[% site.html.disabled %] />
</td>
<td>
<select name="lab_section_id" [% site.html.disabled %]>
[% FOREACH s IN sections %]
<option value="[% s.id %]" [% 'selected' IF s.id == t.lab_section_id %]>
[% s.section_name %]
</option>
[% END %]
</select>
</td>
<td>
<select name="test_type" [% site.html.disabled %]>
[% FOREACH option IN ['test','panel'] %]
<option value="[% option %]"
[% 'selected' IF option == t.test_type %]>[% option %]</option>
[% END %]
</select>
</td>
<td>
<select name="has_results" [% site.html.disabled %]>
[% FOREACH option IN ['yes','no'] %]
<option value="[% option %]"
[% 'selected' IF option == t.has_results %]>[% option %]</option>
[% END %]
</select>
</td>
<td>
<select name="active" [% site.html.disabled %]>
[% FOREACH option IN ['yes', 'no'] %]
<option value="[% option %]" [% 'selected' IF option == t.is_active %]>
[% option %]
</option>
[% END %]
</select>
</td>
<td align="center">
<a href="[% app_url %]/admin/lab_test/edit/[% t.id %]">Edit</a>
</td>
</tr>
[% END %]
</table>
</div>
[% PROCESS site/cgi_pager.tt %]
[% END %]
<!-- END admin/lab/test/default.tt -->