[% META title = 'Request &raquo; Email Report' %]
<!-- BEGIN record/email_report.tt -->
    [% # PROCESS dumper.tt dump = request.as_tree %]
    [% # PROCESS dumper.tt dump = c.stash.errs %]
    
    [% INCLUDE record/patient_summary.tt %]

  <h3 class="header">E-mail report</h3>

    [% 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/[% request.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 %]
    <div 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 %]
        [% IF c.user_can('do_admin') %]
            <input type="submit" name="_delete_address" value="DELETE" />
        [% END %]
    </div>
  </form>
<!-- END record/email_report.tt -->
