<!-- BEGIN [% component.name %] -->
    <div style="margin-bottom: 15px">[% site.html.back_button %]</div>
    [% # PROCESS dumper.tt dump = r.as_tree FOREACH r IN requests %]

    <table>
      <thead>
        <tr class="tbl_header_darken">
          <th>Name</th>
          <th>DoB</th>
          <th>Unit Number</th>
          <th>NHS Number</th>
          <th>Lab No.</th>
          <th>Date</th>
          <th>Source</th>
          <th>Referrer</th>
          <!--<th>Sample</th>-->
        </tr>
      </thead>

      <tbody>
        [% FOREACH request IN requests; # PROCESS dumper.tt dump = request.as_tree;
            patient = request.patient_case.patient;
            IF specimen_map.item(request.id);
                specimen = specimen_map.item(request.id).sample_code.join(', ');
            END;
        %]
      <tr>
        <td>
          [% patient.last_name   | upper %],
          [% format_firstname(patient) || patient.first_name | ucfirst %]
          [% patient.middle_name | ucfirst %]
        </td>
        <td>
          [% IF patient.dob; patient.dob.strftime('%d.%b.%Y');
            ELSE; site.html.grey_null; END %]
        </td>
        <td>
          [% request.patient_case.unit_number %]
        </td>
        <td>
          [% INCLUDE site/nhs_number.tt nhs_number = patient.nhs_number %]
        </td>
        <td>
          [% INCLUDE site/lab_number.tt data = request want_url = 1 %]
        </td>
        <td>[% request.created_at.strftime('%d.%b.%Y') %]</td>

        <td>
          [% SET location = request.patient_case.referral_source.display_name %]
          [% INCLUDE site/display_name.tt %]
        </td>
        <td>[% request.referrer_department.referrer.name %]</td>
        [% IF specimen %]<td>[% specimen %]</td>[% END %]
      </tr>
      [% END %]
      </tbody>
    </table>

<!-- END [% component.name %] -->
