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

  [% # PROCESS dumper.tt dump = request_data %]
  [% # PROCESS dumper.tt dump = specimens %]
  [% # PROCESS dumper.tt dump = lab_test_status %]
  [% # PROCESS dumper.tt dump = results %]
  
  [% # define some data structures:
    headers = [ 'LabNo' 'Name' 'Sample' "Initial\ncut-up" "DABS\nprepared"
        "Frozen\ntissue" "Cells for\nflow" "Pieces\n& blocks" "Final\ncut-up"
        'Complete' ];
  %]

  [% histology_processing_dfv_js %]
  
  <h3 class="header">Histology cut-up &amp; processing</h3>

  [% IF dfv_errors # no mandatory fields for this worklist  %]
    <dl>
        <dt class="error">[% c.cfg('msg').dfv_errors %]</dt>
        [% IF error_foo %]
            <dd>foo [% error_surname %]</dd>[% END %]
    </dl>
  [% END %]

  <form action="[% app_url %]/local_worklist_histology/processing_update/[% c.param('id') %]"
    method="post" name="processing" id="processing" [% histology_processing_onsubmit %]>

    <input type="hidden" name="lab_section_id" value="[% lab_section_id %]" />
    <input type="hidden" name="lab_test_id" value="[% lab_test_id %]" />
    
    [% INCLUDE worklist/snippets/data_entry.tt skip_status = 1 # just need users %]
    
    <p class="spacer"></p>

   [% BLOCK status_display; # displays tick or cross:
        IF lab_test_status.item(status); '<img src="/images/tick.gif" />';
        ELSE; "<input type='checkbox' name='${status}' value=1 />"; END;
      END;
    %]

    <table class="indent">
      <tr>
        [% FOREACH item IN headers %]
        <th scope="">[% item | html_line_break %]</th>
        [% END %]
        <td class="borderless"></td>
      </tr>

      <tr>
        <td>[% data = request_data; INCLUDE site/lab_number.tt want_url = 1 %]</td>
        <td>
            [% patient = request_data.patient_case.patient %]
          [% patient.last_name   | upper %],
          [% patient.first_name  | ucfirst %]
          [% patient.middle_name | ucfirst %]
        </td>
        <td>
          [% specimens.join(', ') %]
        </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" name="frozen_tissue" size=1 maxlength=1
                value="[% results.frozen_tissue %]" />
        </td>
        <td align="center">
            [% INCLUDE status_display status = 'cells for flow' %]
        </td>
        <td align="center">
            <input type="text" name="pieces_blocks" size=3
                value="[% results.pieces_blocks %]" />
        </td>
        <td align="center">
            [% INCLUDE status_display status = 'final cut-up' %]
        </td>
        <td align="center">
            <input type="checkbox" name="complete" value=1 />
        </td>
        <td>[% site.html.submit %]</td>
      </tr>
    </table>
  </form>
<!-- END [% template.name %] -->
