  [% META title = 'Admin &raquo; Diagnosis Change Options' -%]
<!-- BEGIN admin/config/diagnosischangeoptions/default.tt -->  
  [% # PROCESS dumper.tt dump = c.stash.errs %]

	[% diagnosis_change_dfv_js %]

	[% # PROCESS admin/request_nav.tt page = 'diagnostic-categories' %]
	
	<h2 align="center">Diagnosis Change Options</h2>

    [% IF dfv_errors %]
        <p class="error">[% c.config('msg').dfv_errors %]</p>
    [% END %]

	[% # PROCESS dumper.tt dump = dfv_errors %]

    <p class="title">
		[% div_name = 'new'; INCLUDE site/snippets/toggleview.tt %]
		Add new entry
	</p>

	<div class="[% dfv_errors ? 'visible' : 'itemhidden' %]" id="[% div_name %]">

        <form method="get" action="[% app_url %]/config/diagnosis-change-options/update"
            name="new_option" id="new_option" [% diagnosis_change_onsubmit %]>
            <div class="indent">
                <table>
                   <tr>
                        <td class="label">Option name:</td>
                        <td class="content">
						[% PROCESS site/ajax_input.tt field = 'option_name'
							id = 'diagnosis_change' %]
                            [% error_option_name %]
                        </td>
                    </tr>
                    <tr>
                        <td class="label">Description:</td>
                        <td class="content">
			                <input type="text" name="description" size="40"
                                value="[% c.query.param('description') %]" />
                            [% error_description %]
                        </td>
                    </tr>
                   <tr>
                        <td class="label">Active:</td>
                        <td class="content">
                            <select name="is_active" [% site.html.onfocus %]>
                            [% FOREACH option IN ['yes', 'no'] %]
                                <option value="[% option %]">[% option %]</option>
                            [% END %]
                            </select>
                            [% error_is_active %]
                        </td>
                    </tr>
                    
                    <tr>
                        <td class="borderless" colspan="2" align="center">[% site.html.submit %]</td>
                    </tr>
                </table>
            </div>
        </form>
    </div>
    
	<p class="spacer">&nbsp;</p>

	[% IF options.size # only empty if new db %]
	<div class="[% dfv_errors ? 'itemhidden' : 'visible' %]">
		<table>
			<tr>
				<th></th>
				<th>Name</th>
				<th>Description</th>
				<th>Active</th>
			</tr>

			[% FOREACH entry IN options %]
			<tr>
				<td>
                    [% loop.count %]
                </td>
				<td>
					<input type="text" size="20" name="option_name"
                            value="[% entry.option_name | html %]"
						[% site.html.disabled %] />
				</td>
				<td>
					<input type="text" size="40" name="description"
                            value="[% entry.description | html %]"
						[% site.html.disabled %] />
				</td>
				<td>
					<select name="is_active" [% site.html.disabled %]>
					[% FOREACH option IN ['yes', 'no'] %]
						 <option value="[% option %]" [% 'selected' IF option == entry.is_active %]>
							[% option %]
						</option>
					[% END %]
					</select>
				</td>
				<td align="center">
					<a href="[% app_url %]/config/diagnosis-change-options/edit/[% entry.id %]">Edit</a>
				</td>
			 </tr>
			[% END %]

		</table>
	</div>
	[% END %]
  </div>
 <!-- END admin/config/diagnosischangeoptions/default.tt -->  
