  [% META title = 'Admin &raquo; Lab Sections' -%]
<!-- BEGIN admin/lab/section/default.tt -->

  [% PROCESS admin/lab_test_nav.tt page = 'lab_section' %]


    [% # PROCESS dumper.tt dump = lab_section_specimen_types %]
    [% # PROCESS dumper.tt dump = specimen_types %]

    [% lab_sections_dfv_js %]

	<h2 align="center">Lab Sections</h2>

    [% IF dfv_errors %]
        <p class="error">[% c.cfg('msg').dfv_errors %]</p>
    [% 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 %]">

	[% INCLUDE site/snippets/help.tt file = 'newlabsection' %]

    <form method="post" action="[% app_url %]/admin/lab_section/update"
        [% lab_sections_onsubmit %] name="lab_section" id="lab_section">

		<div class="indent">
		<table>
			<tr>
				<td class="label">Description:</td>
				<td class="content">
                    [% PROCESS site/ajax_input.tt field = 'section_name' %]
					[% error_section_name %]
				</td>
			</tr>
			<tr>
				<td class="label">Results summary:</td>
				<td class="content">
					<select name="has_result_summary" [% site.html.onfocus %]>
					[% FOREACH option IN ['no', 'yes'] # default to no %]
					 <option value="[% option %]">[% option %]</option>
					[% END %]
					</select>                        						
					[% error_has_result_summary %]
					</td>
			</tr>
			<tr>
				<td class="label">Section notes:</td>
				<td class="content">
					<select name="has_section_notes" [% site.html.onfocus %]>
					[% FOREACH option IN ['no', 'yes'] # default to no %]
					 <option value="[% option %]">[% option %]</option>
					[% END %]
					</select>                        						
					[% error_has_section_notes %]
					</td>
			</tr>
			<tr>
				<td class="label">Sign out:</td>
				<td class="content">
					<select name="has_test_sign_out" [% site.html.onfocus %]>
					[% FOREACH option IN ['no', 'yes'] # default to no %]
					 <option value="[% option %]">[% option %]</option>
					[% END %]
					</select>                        						
					[% error_has_test_sign_out %]
					</td>
			</tr>
			<tr>
				<td class="label">Results import:</td>
				<td class="content">
					<select name="has_results_import" [% site.html.onfocus %]>
					[% FOREACH option IN ['no', 'yes'] # default to no %]
					 <option value="[% option %]">[% option %]</option>
					[% END %]
					</select>                        						
					[% error_has_results_import %]
					</td>
			</tr>
			<tr>
				<td class="label">Remote system:</td>
				<td class="content">
					<select name="has_foreign_id" [% site.html.onfocus %]>
					[% FOREACH option IN ['no', 'yes'] # default to no %]
					 <option value="[% option %]">[% option %]</option>
					[% END %]
					</select>			
					[% error_has_foreign_id %]
				</td>
			</tr>
			<tr>
				<td class="label" style="vertical-align: top">
                    Permitted<br />sample types:
                </td>
				<td class="content">
                    [% FOREACH type IN specimen_types; # PROCESS dumper.tt dump = type %]
                    <div id="id">
                        <input type="checkbox" name="sample_type_id" value="[% type.id %]" />
                        [% type.specimen_type %]
                    </div>                    
                    [% END %]
                    [% error_sample_type_id %]
				</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>

    <p class="spacer">&nbsp;</p>

    [% IF sections.size %]
	<table>
        <tr>
            <th></th>
            <th>Description</th>
            <th>
				<span title="section records individual test results"
				  class="acronym">Results</span>
			</th>
            <th>
				<span title="section has test-specific instructions"
				  class="acronym">Notes</span>
			</th>
            <th>
				<span title="section allows block completion of all outstanding test results"
				  class="acronym">Sign-out</span>
			</th>
            <th>
				<span title="section allows import of results via data file"
				  class="acronym">Import</span>
			</th>
            <th>
				<span title="section has remote system interface"
				  class="acronym">Remote</span>
			</th>
            <th colspan="3">
                <div id="id">
                    <span title="permitted specimen type(s) for section lab tests"
                        class="acronym">Specimen</span>
                </div>
				<div style="text-align: center">
                    <span title="liquid samples (PB, BMA, etc)"
                        class="acronym">L</span> |
                    <span title="biopsy - unfixed (LU, GU, etc)"
                        class="acronym">BU</span> |
                    <span title="biopsy - fixed (LF, GF, etc)"
                        class="acronym">BF</span>
                </div>
			</th>
            <th>Active</th>
        </tr>

        [% FOREACH section IN sections %]
        <tr>
            <td>[% loop.count %]</td>
            <td>
                <input type="text" size="30" name="[% section.id %]"
                    value="[% section.section_name %]" [% site.html.disabled %] />
            </td>
			<td>
				<select name="has_result_summary" [% site.html.disabled %]>
				[% FOREACH option IN ['yes', 'no'] %]
					 <option value="[% option %]" [% 'selected' IF option ==
                            section.has_result_summary %]>
						[% option %]
					</option>
				[% END %]
				</select>
			</td>
			<td>
				<select name="has_section_notes" [% site.html.disabled %]>
				[% FOREACH option IN ['yes', 'no'] %]
					 <option value="[% option %]" [% 'selected' IF option ==
                            section.has_section_notes %]>
						[% option %]
					</option>
				[% END %]
				</select>
			</td>
			<td>
				<select name="has_test_sign_out" [% site.html.disabled %]>
				[% FOREACH option IN ['yes', 'no'] %]
					 <option value="[% option %]" [% 'selected' IF option ==
                            section.has_test_sign_out %]>
						[% option %]
					</option>
				[% END %]
				</select>
			</td>
			<td>
				<select name="has_results_import" [% site.html.disabled %]>
				[% FOREACH option IN ['yes', 'no'] %]
					 <option value="[% option %]" [% 'selected' IF option ==
                            section.has_results_import %]>
						[% option %]
					</option>
				[% END %]
				</select>
			</td>
			<td>
				<select name="has_foreign_id" [% site.html.disabled %]>
				[% FOREACH option IN ['yes', 'no'] %]
					 <option value="[% option %]" [% 'selected' IF option ==
                            section.has_foreign_id %]>
						[% option %]
					</option>
				[% END %]
				</select>
			</td>
            

            [% FOREACH type IN specimen_types %]
            <td align="center">
                [% IF lab_section_specimen_types.item(section.id).item(type.id) %]
                    <img src='/images/tick.gif' />
                [% ELSE %]
                    <span class="red">X</span>
                [% END %]
            </td>
            [% END %]
            
			<td>
				<select name="is_active" [% site.html.disabled %]>
				[% FOREACH option IN ['yes', 'no'] %]
					 <option value="[% option %]" [% 'selected' IF option ==
                            section.is_active %]>
						[% option %]
					</option>
				[% END %]
				</select>
			</td>

			<td align="center">
				<a href="[% app_url %]/admin/lab_section/edit/[% section.id %]">Edit</a>
			</td>
         </tr>
        [% END %]
    </table>
    [% END %]
<!-- END admin/lab/section/default.tt -->
