    [% META title="Error Codes &raquo Configure " %]

<!-- BEGIN [% template.name %] -->
    [% # PROCESS dumper.tt dump = config_map %]
    
    <h3>Configure error codes for requests &amp; patients:</h3>
    
    [% error_codes_config_dfv_js %]
    
    <div class="indent">
	<h4>1) Codes for patient edits:
		[% div_name = 'patient'; INCLUDE site/snippets/toggleview.tt %]
    </h4>

    <div class="itemhidden" id="[% div_name %]">
		<form method="post" action="[% app_url %]/config/error-codes/update_assignments"
            [% error_codes_config_onsubmit %] name="patient-edit" id="patient-edit">
            <input type="hidden" name="type" value="patient" />
		<table class="indent">
			[% FOREACH code IN error_codes %]
				[% NEXT UNLESS code.active.match('yes') %]
			<tr>
				<td>[% code.code | upper %]: [% code.description | html %]</td>
				<td>
					<input type="checkbox" name="error_code_id" value="[% code.id %]"
                        [% 'checked' IF config_map.patient.item(code.id) %] />
				</td>
			 </tr>
			[% END %]
            <tr>
                <td class="borderless" colspan="2" align="center">
                    [% site.html.submit %]
                </td>
            </tr>
		</table>
        </form>
	</div>

	<h4>2) Codes for new requests:
		[% div_name = 'newRequest'; INCLUDE site/snippets/toggleview.tt %]
    </h4>

    <div class="itemhidden" id="[% div_name %]">
		<form method="post" action="[% app_url %]/config/error-codes/update_assignments"
            [% error_codes_config_onsubmit %] name="new-request" id="new-request">
            <input type="hidden" name="type" value="new_request" />
            
		<table class="indent">
			[% FOREACH code IN error_codes %]
				[% NEXT UNLESS code.active.match('yes') %]
			<tr>
				<td>[% code.code | upper %]: [% code.description | html %]</td>
				<td>
					<input type="checkbox" name="error_code_id" value="[% code.id %]"
                        [% 'checked' IF config_map.new_request.item(code.id) %] />
				</td>
			 </tr>
			[% END %]
            <tr>
                <td class="borderless" colspan="2" align="center">
                    [% site.html.submit %]
                </td>
            </tr>
		</table>
        </form>
	</div>

	<h4>3) Codes for request edits:
		[% div_name = 'requestEdit'; INCLUDE site/snippets/toggleview.tt %]
    </h4>

    <div class="itemhidden" id="[% div_name %]">
		<form method="post" action="[% app_url %]/config/error-codes/update_assignments"
            [% error_codes_config_onsubmit %] name="request-edit" id="request-edit">
            <input type="hidden" name="type" value="request_edit" />
            
		<table class="indent">
			[% FOREACH code IN error_codes %]
				[% NEXT UNLESS code.active.match('yes') %]
			<tr>
				<td>[% code.code | upper %]: [% code.description | html %]</td>
				<td>
					<input type="checkbox" name="error_code_id" value="[% code.id %]"
                        [% 'checked' IF config_map.request_edit.item(code.id) %] />
				</td>
			 </tr>
			[% END %]
            <tr>
                <td class="borderless" colspan="2" align="center">
                    [% site.html.submit %]
                </td>
            </tr>
		</table>
        </form>
	</div>
    
    <h4>4) Codes for direct error code entry:
		[% div_name = 'direct'; INCLUDE site/snippets/toggleview.tt %]
    </h4>

    <div class="itemhidden" id="[% div_name %]">
		<form method="post" action="[% app_url %]/config/error-codes/update_assignments"
            [% error_codes_config_onsubmit %] name="errors" id="errors">
            <input type="hidden" name="type" value="errors" />
            
		<table class="indent">
			[% FOREACH code IN error_codes %]
				[% NEXT UNLESS code.active.match('yes') %]
			<tr>
				<td>[% code.code | upper %]: [% code.description | html %]</td>
				<td>
					<input type="checkbox" name="error_code_id" value="[% code.id %]"
                        [% 'checked' IF config_map.errors.item(code.id) %] />
				</td>
			 </tr>
			[% END %]
            <tr>
                <td class="borderless" colspan="2" align="center">
                    [% site.html.submit %]
                </td>
            </tr>
		</table>
        </form>
	</div>
    </div>
<!-- END [% template.name %] -->
