<!-- BEGIN [% template.name %] -->
  [% META title = 'Worklist &raquo; Histology Cut-up &amp; Processing' -%]

    [% # PROCESS dumper.tt dump = specimen_map %]
    [% # PROCESS dumper.tt dump = requests %]
    [% # PROCESS dumper.tt dump = lab_test_status_map %]
    [% # PROCESS dumper.tt dump = results_map %]
    
  <h3 class="header">Histology cut-up &amp; processing worklist</h3>

  [% # define some data structures:
    headers = [ 'LabNo' 'Name' 'Sample' "Initial\ncut-up" "DABS\nprepared"
      "Frozen\ntissue" "Cells for\nflow" "Pieces\n& blocks" "Final\ncut-up" ];
  %]
  
  [% 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 status_opts.item(status); '<img src="/images/tick.gif" />';
        ELSE; '<span class="red">X</span>'; END;
      END;
    %]
   
   [% FOREACH entry IN requests; # PROCESS dumper.tt dump = data.as_tree;
        patient = entry.request.patient_case.patient;
        data = entry.request; # for lab_number.tt
        
        results = results_map.item(data.id); # PROCESS dumper.tt dump = results;
        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>
        [% specimen_map.item(data.id).sample_code.join(', ') %]
        [% INCLUDE site/snippets/doi.tt IF request_options_map.item(data.id).doi %]
    </td>
    <td align="center">
      [% INCLUDE status_display status = 'initial cut-up' %]
    </td>
    <td align="center">
      [% INCLUDE status_display status = 'prepared dabs' %]
    </td>
    <td align="center">
        <input type="text" size=1 value="[% results.frozen_tissue %]"
          [% site.html.readonly %] />
    </td>
    <td align="center">
        [% INCLUDE status_display status = 'cells for flow' %]
    </td>
    <td align="center">
        <input type="text" size=3 value="[% results.pieces_blocks %]" [% site.html.readonly %] />
    </td>
    <td align="center">
      [% INCLUDE status_display status = 'final cut-up' %]
    </td>
    <td>
        <a href="[% app_url %]/local_worklist_histology/processing/[% data.id %]">Edit</a>
    </td>
   </tr>
   [% END %]
  </table>
  [% ELSE %]
    <p class="info indent">No outstanding cut-up & processing tests</p>
  [% END %]
<!-- END [% template.name %] -->
