[% META title = 'Resources &raquo; Stats &amp; Audit &raquo; Edit Revised Diagnosis' %]

<!-- BEGIN [% template.name %] -->
    [% # PROCESS dumper.tt dump = data.as_tree %]
    [% # PROCESS dumper.tt dump = opts %]
    
    [% INCLUDE record/patient_summary.tt %]

    <h3 class="header">Edit diagnosis revision</h3>

    [% option_id = data.request_diagnosis_history.option_id %]
    
    <form action="[% app_url %]/audit/do_edit_diagnosis_revision/[%
            data.request_diagnosis_history.id %]">
        <input type="hidden" name="_option_id" value="[% option_id %]" />
        <input type="hidden" name="sort_by" value="[% c.query.param('sort_by') %]" />

        <table class="indent">
            <tr>
                <th>Diagnosis #1</th>
                <th>Diagnosis #2</th>
                <th>Error code</th>
                <td class="borderless"></td>
            </tr>
            <tr>
                <td>[% data.request_diagnosis_history.diagnosis.name %]</td>
                <td>[% data.request_report.diagnosis.name %]</td>
                <td>
                    <select name="option_id">
                        [% FOREACH o IN opts; # only want active error opts:
                            NEXT UNLESS o.option_name.match('error')
                            AND o.is_active.match('yes') %]
                        <option value="[% o.id %]" [% 'selected=1' IF
                            option_id == o.id %]>[% o.option_name %]</option>
                        [% END %]
                    </select>
                </td>
                <td>
                    [% site.html.submit %]
                </td>
            </tr>
        </table>
    </form>

    <p>[% site.html.back_button %]</p>

<!-- END [% template.name %] -->
