[% BLOCK select_all %]
    <tr>
        <td colspan="10" align="right" class="borderless">
          <input type="button" name="CheckAll" value="Select all"
            onClick="checkAll(document.update_results.request_lab_test_id)">
          <input type="button" name="UnCheckAll" value="Clear all"
            onClick="uncheckAll(document.update_results.request_lab_test_id)">        
        </td>
    </tr>
[% END %]

<!-- BEGIN [% component.name %] -->	
  <div class="indent">
	[% # build args for url_links:
        args = [];
        results_entry = ( c.query.param('results_entry') || is_results_entry );
        
        args.push( 'status_option_id=' _ c.query.param('status_option_id') );
        args.push( 'results_entry='	_ results_entry );
        
        FOREACH test_id IN c.query.param('lab_test_id'); # can be multiple
            args.push( 'lab_test_id=' _ test_id );
        END;
	%]
    <table>
        [% INCLUDE select_all IF is_results_entry %]
      <tr>
        <td class="borderless"></td>		
        <th>
		  <a href="[% app_url %]/worklist/display/[% lab_section.id %]?[%
            args.join(';') %];sort_by=lab_number">Lab No</a>		  
		</th>
        <th>Name</th>
        <th>Date</th>
        <th>Sample</th>
        <th>Source</th>
        
        [% IF worklist_cols.item(lab_section.section_name).headers; # override default
            FOREACH h IN worklist_cols.item(lab_section.section_name).headers %]
            <th>[% h %]</th>
            [% END %]
        [% ELSE %]
            <th>Presentation</th>
            <th>
                <a href="[% app_url %]/worklist/display/[% lab_section.id %]?[%
                    args.join(';') %];sort_by=lab_tests">Investigation</a>
            </th>
        [% END %]
        
        <th>Status</th>
		[% IF is_results_entry %]
		  <th>Done</th>
		[% ELSE;
		  IF section_has_test_details %]
			<th>Notes</th>
		  [% END %]
		  [% IF has_labels %]
			<th class="printHide">Labels</th>
		  [% END %]
		[% END %]
      </tr>
      
      [% FOREACH entry IN outstanding_investigations; # PROCESS dumper.tt dump = entry %]
        [% PROCESS worklist/snippets/row.tt type = 'investigation' %]  
      [% END %]
    </table>
  </div>
    <p>
      [% site.html.back_button %]
      [% IF has_labels OR is_results_entry;
        site.html.submit; ' '; site.html.reset; END %]
    </p>
<!-- END [% component.name %] -->	
