<!-- BEGIN [% template.name %] -->
    [% # INCLUDE dumper.tt dump = requests %]

  [% META title = 'Worklist &raquo; Outreach Clinic Returns' -%]

    [% # PROCESS dumper.tt dump = requests %]
    [% # PROCESS dumper.tt dump = notifications %]
    
  [% # define some data structures:
    headers = [ 'LabNo' 'Name' 'NHS No.' 'DecisionDate' 'AppointmentDate' ];
  %]
  
	[% addcss =	[
			'validationEngine.jquery.css'
			'smoothness/jquery-ui-1.8.4.custom.css' # for DatePicker
		]
	%]

	<script type="text/javascript" src="/js/jquery-ui-1.8.4.custom.min.js"></script>	
    <script type="text/javascript">
        $(function() {
          $('.datepicker').datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'dd/mm/yy',
          });
        });
	</script>

  [% BLOCK headers %]
      <tr>
        <td class="borderless"></td>
        [% FOREACH item IN headers; # PROCESS dumper.tt dump = item.length %]
            <th scope="">[% item | html_line_break %]</th>
        [% END %]
        <td class="borderless"></td>
      </tr>
  [% END %]
  
  [% BLOCK row;
        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.nhs_number %]</td>
       <td>[% entry.time.strftime('%d.%b.%Y') %]</td>
       <td>
         <form action="[% app_url %]/local_worklist/outreach_clinic_returns/[% data.id %]"
                method="post">
            <input type="text" name="appointment_date" id="appointment_date-[% data.id %]"
                class="validate[ajax[ajaxDate]] datepicker" size="10" />
            <input type='submit' value='Submit' name='.submit' class='button' />
         </form>
       </td>
      </tr>
    [% END %]

  <h3 class="header">Outreach clinic returns without appointment dates</h3>
  
  [% IF requests.size %]
    <table class="indent">
        [% INCLUDE headers %]
        [% FOREACH entry IN requests;
            data = entry.request; # PROCESS dumper.tt dump = data.as_tree;
            INCLUDE row; END %]
    </table>
    [% ELSE %]<p class="info indent">None</p>
   [% END %]

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