[% META title = 'Request &raquo; Email Report' %]
<!-- BEGIN record/email_report.tt -->
    [% # PROCESS dumper.tt dump = data.as_tree %]
    [% # PROCESS dumper.tt dump = c.stash.errs %]
    
    [% patient = data.patient_case.patient %]
    
  <h2 class="header">E-mail report on
    [% patient.last_name | upper %], [% patient.first_name | ucfirst %]
    [ [% INCLUDE site/lab_number.tt -%] ]:
  </h2>

    [% IF error_mailto %]
        <p class="error">[% c.cfg('msg').dfv_errors %]
            [% # c.cfg('msg').dfv_msgs.invalid_domain # allowing anon reports now %]
        </p>
    [% END %]
    
    [% PROCESS site/autosuggest.tt
    	varname         = 'address'
#		param_id        = '' # for callback function - not needed here
		param_name      = 'mailto'
		method_name     = 'get_email_addresses'
		watermark       = 'no';
    %]
    
    <script language="JavaScript" type="text/javascript">
    <!-- // Begin
     function submitForm(s) {
        s.value = "  Sending...  ";
        return true;
     }
    // End -->
    </script>

  <form method="post" action="[% app_url %]/request/do_email_report/[% data.id %]"
        onsubmit="return submitForm(this.mail_report)">
    [% IF require_anon_report_confirmation %]
        <p class="indent warning">
            Non-secure recipient address - OK to send anonymised report ?
            <input type="checkbox" name="anon_report_ok" value="1" />
        </p>
    [% END %]
    <p class="indent">
        <strong>Destination e-mail address:<strong>
		<input style="width: 300px" type="text" name="mailto" id="mailto"
            value="[% c.query.param('mailto') %]" />
        [% error_mailto %]
        <input type="hidden" name="sender" value="[% sender %]" />
        <input type="submit" name="mail_report" value="Go">
        [% site.html.reset %]                
    </p>
  </form>
<!-- END record/email_report.tt -->
