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

    [% # PROCESS dumper.tt dump = specimen_map %]
    [% # PROCESS dumper.tt dump = requests %]
    [% # PROCESS dumper.tt dump = block_refs_map %]
    [% # PROCESS dumper.tt dump = c.session.param('UserProfile') %]
    
  <h3 class="header">Histology blocks worklist</h3>

  [% # define some data structures:
    headers = [ 'LabNo' 'Name' 'Date' 'Sample' 'Source' 'BlockRef' 'Done' ];
  %]
  
  [% IF requests.size %]
  <form method="post" action="[% app_url %]/local_worklist_histology/blocks_data_update">
    
    <p class="indent title printHide">
      [% USE date(format = '%d/%m', locale = 'en_GB');
          user = c.session.param('UserProfile'); # need to put initials in profile
      %]
          
      Status: <input type="text" name="status" size="6" onClick="status.value=''"
        value="[% user.initials %] [% date.format %]" />
      </p>
    
  <table class="indent">
    <tr>
      [% FOREACH item IN headers %]
        <th>[% item %]</th>
      [% END %]
      <td class="borderless"></td>
    </tr>
    
   [% FOREACH entry IN requests; # PROCESS dumper.tt dump = data.as_tree;
        patient = entry.request.patient_case.patient;
        data = entry.request; # for lab_number.tt
   %]
   <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>[% data.created_at.strftime('%d.%m.%Y') %]</td>
    <td>[% specimen_map.item(data.id).sample_code.join(', ') %]</td>
    <td>[% data.patient_case.referral_source.display_name | html %]</td>
    <td>[% block_refs_map.item(data.id) | html %]</td>
    <td align="center">
      <input type="checkbox" name="request_id" value="[% data.id %]" class="printHide" />
    </td>
   </tr>
   [% END %]
  </table>
  <p class="indent">[% site.html.submit %]</p>
  </form>

  [% ELSE %]
    <p class="info indent">No outstanding histology blocks</p>
  [% END %]
<!-- END [% template.name %] -->
