<!-- BEGIN [% template.name %] -->
  <form method="get" action="[% app_url %]/search/deleted_record">
  
  [% # PROCESS dumper.tt dump = result %]
  
  <h2 class="header">Search for deleted record</h2>
    <p class="info">[select at least one category]</p>
  	<table class="indent">
		<tr>
			<td class="label">Last name:</td>
			<td>
				<input type="text" name="last_name" value="[% c.query.param('last_name') %]" />
				[% IF error_last_name; error_last_name; END %]
			</td>
		</tr>

		<tr>
			<td class="label">First name:</td>
			<td>
				<input type="text" name="first_name" value="[% c.query.param('first_name') %]" />
				[% IF error_first_name; error_first_name; END %]
			</td>
		</tr>

		<tr>
			<td class="label">HMDS ref:</td>
			<td>
				<input type="text" name="hmds_ref" value="[% c.query.param('hmds_ref') %]" />
				[% IF error_hmds_ref; error_hmds_ref; END %]
			</td>
		</tr>
        <tr>
            <td class="borderless" colspan="2" align="center">[% site.html.submit %]</td>
        </tr>
	</table>
  </form>
  
  [% IF result.size %]
    <h3>Deleted records found [[% result.size %]]:</h3>
        <table class="history">
          <tr>
            <td class="borderless"></td>
            <th>Day</th>
            <th>Date</th>
            <th>Time</th>
            <th>UserID</th>
            <th>Old Lab No</th>
            <th>Action</th>
          </tr>
          [% FOREACH item IN result; # INCLUDE dumper.tt dump = item.as_tree; %]
            <tr class="[% loop.count % 2 ? 'normal' : 'bkgd_grey' %]">
              <td style="text-align: right; background: #fff">
                [% loop.count %]</td>
              <td>
                [% item.time.strftime('%a') %]
              </td>
              <td>
                [% item.time.strftime('%d.%b.%Y') %]
              </td>
              <td>
                [% item.time.strftime('%T') %]
              </td>
              <td>
                [% item.user.username | upper %]
              </td>
              <td><a href=[% app_url %]/search/do_search?lab_number=[% # can't use request.id
                    item.request_number %]/[% item.year - 2000 # ok, all > 2009 %]>
                  [% c.cfg('settings').lab_number_prefix;
                    PROCESS site/snippets/lab_number.tt data = item %]</a>
              </td>
              <td>
                [% item.action.replace('_', ' ') | html %]
              </td>
            </tr>
          [% END %]
        </table>
      </div>
  [% END %]
  
<!-- END [% template.name %] -->