<!-- BEGIN worklist/local/immunohistochemistry.tt -->
  [% META title = 'Worklist &raquo; Immunohistochemistry' -%]

    [% # PROCESS dumper.tt dump = specimen_map %]
    [% # PROCESS dumper.tt dump = requests %]
    [% # PROCESS dumper.tt dump = lab_test_status_map %]
    [% # PROCESS dumper.tt dump = request_options_map %]
    
  <h3 class="header">Immunohistochemistry worklist</h3>

  [% # define some data structures:
    headers = [ 'LabNo' 'Name' 'Sample' 'Test' 'Microtomy' "ICC\nStaining" 'QC' ];
  %]
  
  [% IF requests.size %]
  <table class="indent">
    <tr>
      [% FOREACH item IN headers %]
        <th scope="">[% item | html_line_break %]</th>
      [% END %]
      <td class="borderless"></td>
    </tr>
   
   [% BLOCK status_display; # displays tick or cross:
        IF lab_test_status_map.item(data.id).item(entry.lab_test.field_label).item(status);
            '<img src="/images/tick.gif" />';
        ELSE; '<span class="red">X</span>'; END;
      END;
    %]
   
   [% FOREACH entry IN requests; # PROCESS dumper.tt dump = entry.as_tree;
        patient = entry.request.patient_case.patient;
        data = entry.request; # for lab_number.tt
        
        status_opts = lab_test_status_map.item(data.id); # PROCESS dumper.tt dump = status_opts;
   %]
   <tr>
    <td>[% INCLUDE site/lab_number.tt want_url = 1 %] [% # data.id %]</td>
    <td>
        [% patient.last_name  | upper %],
        [% patient.first_name | ucfirst %] [% patient.middle_name | ucfirst %]
    </td>
    <td align="center">
        [% specimen_map.item(data.id).sample_code.join(', ') %]
        [% INCLUDE site/snippets/doi.tt IF request_options_map.item(data.id).doi %]
    </td>
    <td>[% entry.lab_test.field_label %]</td>
    <td align="center">
      [% INCLUDE status_display status = 'microtomy' %]
    </td>
    <td align="center">
      [% INCLUDE status_display status = 'ICC staining' %]
    </td>
    <td align="center">
      [% INCLUDE status_display status = 'QC' %]
    </td>
    <td>
        <a href="[% app_url %]/local_worklist_histology/immunochemistry/[%
            data.id %]/[% entry.lab_test_id %]">Edit</a>
    </td>
   </tr>
   [% END %]
  </table>
  [% ELSE %]
    <p class="info indent">No outstanding immunohistochemistry tests</p>
  [% END %]
<!-- END worklist/local/immunohistochemistry.tt -->
