    [% META title="Edit Request Error" %]
<!-- BEGIN [% template.name %] -->
    [% # PROCESS dumper.tt dump = error.as_tree %]
    [% # PROCESS dumper.tt dump = codes_in_use %]
    [% # PROCESS dumper.tt dump = error_codes %]

    [% INCLUDE record/patient_summary.tt %]

    [% request_error_dfv_js %]

    <h3 class="header">Edit Request Error</h3>

    [% IF dfv_errors %]
    <dl>
        <dt class="error">[% c.cfg('msg').dfv_errors %]</dt>
        [% IF error_error_group %]
            <dd>Error or LIC [% error_error_group %]</dd>[% END %]
    </dl>
    [% END %]

  <form action="[% app_url %]/error/update/[% request.id %]" method="post"
        [% request_error_onsubmit %] name="error_detail" id="error_detail">
    <input type="hidden" name="request_error_code_id" value="[% error.id %]" />
    <table class="indent">
        <tr>
            <th>Day</th>
            <th>Date</th>
            <th>Time</th>
            <th>UserID</th>
            <th>Code</th>
            <th>Description</th>
            <th>Details</th>
            <td class="borderless"></td>
        </tr>
        <tr>
            <td>[% error.time.strftime('%a') %]</td>
            <td>[% error.time.strftime('%d.%b.%Y') %]</td>
            <td>[% error.time.strftime('%T') %]</td>
            <td>[% error.user.username | upper %]</td>
            <td align="center">
                [% error.error_code.code | upper %]
            </td>
            <td>[% error.error_code.description | html %]</td>
            <td>
                <input type="textbox" name="error_details" size="40"
                    value="[% error.error_detail.details | html %]" /></td>
            <td>
                [% site.html.submit %]
                <a href=[% app_url %]/error/delete/[% error.id %]>DELETE</a>
            </td>
        </tr>
    </table>
  </form>

    <form action="[% app_url %]/error/do_edit/[% error.request_id %]/[% error.id %]"
        method="post" [% request_error_onsubmit %] name="error_code" id="error_code">
        <p class="title">Update error code:
            <select name="error_code_id">
                <option value=""></option>
            [%
                FOREACH item IN error_codes;
                    NEXT IF item.code == error.error_code.code; # skip self
                    NEXT IF codes_in_use.item(item.id) # skip any unique codes in use
                        AND item.is_unique.match('yes');
            %]
                <option value="[% item.id %]">
                    [[% item.code | upper %]]
                    [% item.description | html %]
                </option>
            [% END %]
            </select>
            [% site.html.submit %]
        </p>
    </form>
<!-- END [% template.name %]  -->
