[% META title = 'Request &raquo; Delete' %]

<!-- BEGIN request/delete_request.tt -->
   [% # PROCESS dumper.tt dump = request.as_tree %]
   [% # PROCESS dumper.tt dump = req_count %]

[%
   reasons = [
      'merged record',
      'duplicate Lab No.',
      'incorrect Lab No.',
      'incorrect patient',
      'inappropriate request',
   ]
%]

   [% delete_request_dfv_js %]

   <h2>Delete record:</h2>

    [% IF dfv_errors %]
        <p class="error">[% c.cfg('msg').dfv_errors %]</p>
    [% END %]

   <div class="indent">
      [% patient = request.patient_case.patient; data = request; %]
      <p class="info">
         [% PROCESS site/lab_number.tt # expects request object 'data' %] ::
         [% patient.last_name | upper %] ::
         [% patient.first_name | ucfirst %]
         [% patient.middle_name | ucfirst %] ::
         [% patient.dob.strftime('%d.%b.%Y') %] ::
         [% patient.nhs_number || site.html.grey_null %] ::
         [% request.patient_case.unit_number || site.html.grey_null %]
      </p>

      <form method="post" action="[% app_url %]/request/do_delete/[% request.id %]"
        [% delete_request_onsubmit %]>

         <p class="classname">
            <span class="highlight">
               <strong>
                  WARNING: you are about to delete a record. This action CANNOT be undone.
               </strong>
            </span>
         </p>

        [% IF is_reported %]
            <p class="warning">WARNING: THIS RECORD HAS BEEN REPORTED</p>
        [% END %]

         [% IF req_count == 1 # not yet implemented - check outreach/hmrn implications %]
            <p class="indent">
               <span class="red">Delete patient record also</span> (has no other requests)
               <input type="checkbox" name="delete_patient_record" value="1"
                  disabled="disabled"> <span class="grey">[currently disabled]</span>
            </p>
         [% END %]

         <p class="indent">
            <strong>Confirm you really want to do this:</strong>
            <input type="checkbox" name="confirm_delete" value="1">
            [% error_confirm_delete %]
        </p>

         <p class="indent">
            <strong>Reason:</strong>
            <select name="reason">
               <option value=""></option>
               [% FOREACH option IN reasons %]
               <option value="[% option %]">[% option %]</option>
               [% END %]
            </select>
            [% error_reason %]
            <input type='submit' value='DELETE' name='.submit' class='button' />
         </p>

      </form>

      <p>[% site.html.back_button %]</p>
   </div>
<!-- END request/delate_request.tt -->
