<!-- BEGIN [% templalte.name %] -->

    [% # PROCESS dumper.tt dump = o.as_tree FOREACH o IN rs_options %]
    [% # PROCESS dumper.tt dump = c.query.param('id') %]

	[% result_summary_options_dfv_js %]

    [% IF dfv_errors %][% # PROCESS dumper.tt dump = c.stash.errs %]
    <dl>
        <dt class="error">[% c.cfg('msg').dfv_errors %]</dt>
        [% IF error_description %]
            <dd>Description [% error_description %]</dd>[% END %]
        [% IF error_lab_section_id %]
            <dd>Lab section [% error_lab_section_id %]</dd>[% END %]
        [% IF error_is_active %]
            <dd>Active [% error_is_active %]</dd>[% END %]
    </dl>
    [% END %]

    <form method="post" action="[% app_url %]/config/result-summary-options/update"
            name="result_summary_option" id="result_summary_option" [% result_summary_options_onsubmit %]>
		<input type="hidden" name="lab_section_id" value="[% c.query.param('id') %]" />

	<table class="indent">
        <tr>
            <th></th>
            <th [% IF error_description %]class="error"[% END %]>Description</th>
            <th [% IF error_lab_section_id %]class="error"[% END %]>Lab Section</th>
            <th [% IF error_is_active %]class="error"[% END %]>Active</th>
            <th style="width: 6em">
                <span class="acronym" title="append additional text">Auto-expand</span>
            </th>
        </tr>

        [% FOREACH item IN rs_options %]
        <tr>
            <td>[% loop.count %]</td>
            <td>
                <input type="text" size="50" [% site.html.disabled %]
                    value="[% item.description | html %]" />
            </td>
			<td>
				<select name="lab_section_id" [% site.html.disabled %]>
				[% FOREACH section IN lab_sections %]
					 <option value="[% section.id %]" [% 'selected' IF
                            section.id == item.lab_section_id %]>
						[% section.section_name %]
					</option>
				[% END %]
				</select>
			</td>
			<td>
				<select name="is_active" [% site.html.disabled %]>
				[% FOREACH option IN ['yes', 'no'] %]
					 <option value="[% option %]" [% 'selected' IF option == item.is_active %]>
						[% option %]
					</option>
				[% END %]
				</select>
			</td>
            <td align="center">
                <a href="[% app_url %]/config/result-summary-options/expand/[% item.id %]">
                    [% item.as_tree.result_summary_expansion ? 'Yes' : 'No' %]
                </a>
            </td>
			<td align="center">
				<a href="[% app_url %]/config/result-summary-options/edit/[% item.id %]">Edit</a>
			</td>
         </tr>
        [% END %]

        <tr>
            <td>[% IF rs_options.size; rs_options.size + 1; ELSE; 1; END %]</td>
                <td>
                    <input type="text" size="50" name="description" />
                </td>
            <td>
                <select [% site.html.disabled # already passed as hidden field %]>
                [% FOREACH section IN lab_sections %]
                    <option value="[% section.id %]" [% 'selected' IF
                            section.id == c.query.param('id') %]>
                        [% section.section_name %]
                    </option>
                [% END %]
                </select>
            </td>
            <td>
                <select name="is_active">
                [% FOREACH option IN ['yes', 'no'] %]
                    <option value="[% option %]">[% option %]</option>
                [% END %]
                </select>
            </td>
            <td>
                [% site.html.submit %]
            </td>
        </tr>
    </table>
    </form>
<!-- END [% templalte.name %] -->
