<!-- BEGIN [% template.name %] -->
  [% META title = 'Worklist &raquo; Outreach Overdue Pack Returns' -%]

    [% # PROCESS dumper.tt dump = requests %]
    
  [% # define some data structures:
    headers = [ 'LabNo' 'Name' 'DoB' 'NHS Number' 'Dispatched' 'Return Due [Delta]'];
  %]
  
  [% IF requests.size %]
  <h3 class="header">Outreach overdue pack returns [[% requests.size %]]</h3>

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

    [% FOREACH data IN requests; # PROCESS dumper.tt dump = entry.as_tree;
        NEXT UNLESS data.delta_days; # skip any delta = 0
        patient = data.patient_case.patient;
    %]
    <tr>
      <td>[% loop.count %]
     <td>[% INCLUDE site/lab_number.tt want_url = 1 %]</td>
     <td>
        [% patient.last_name  | upper %],
        [% patient.first_name | ucfirst %]
     </td>
     <td>[% patient.dob.strftime('%d.%b.%Y') %]</td>
     <td>[% patient.nhs_number %]</td>
     <td>
        [% data.outreach_request_pack_dispatch.pack_sent.strftime('%d.%b.%Y') %]
     </td>
     <td>
        [% data.outreach_request_pack_dispatch.return_due.strftime('%d.%b.%Y') %]
        [[% data.delta_days %]]
     </td>
    </tr>
    [% END %]
  </table>
  
  [% ELSE %]
    <p class="info indent">No overdue Outreach pack returns</p>
  [% END %]
<!-- END [% template.name %] -->
