  [% META title = 'Admin &raquo; Consent Options' -%]  
<!-- BEGIN admin/config/consentoptions/default.tt -->

	[% consent_options_dfv_js %]

	[% PROCESS admin/options_nav.tt page = 'consent-options' %]

	<h2 align="center">Consent 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/consent-options/update"
            name="new_consent_option" id="new_consent_option" [% consent_options_onsubmit %]>
            <div class="indent">
                <table>
                    <tr>
                        <td class="label">Consent name:</td>
                        <td class="content">
							[% PROCESS site/ajax_input.tt field = 'consent_name'
								id = "consent_name" size = 20 %]
                            [% error_consent_name %]
                        </td>
                    </tr>
                    <tr>
                        <td class="label">Consent label:</td>
                        <td class="content">
							[% PROCESS site/ajax_input.tt field = 'consent_label'
								id = "consent_label" size = 20 %]
                            [% error_consent_label %]
                        </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 consent_opts.size # only empty if new db %]
	<div class="[% dfv_errors ? 'itemhidden' : 'visible' %]">
		<table>
			<tr>
				<th></th>
				<th>Consent name</th>
				<th>Consent label</th>
				<th>Active</th>
			</tr>

			[% FOREACH entry IN consent_opts %]
			<tr>
				<td>
                    [% loop.count %]
                </td>
				<td>
					<input type="text" size="20" name="consent_name"
                            value="[% entry.consent_name | html %]"
						[% site.html.disabled %] />
				</td>
				<td>
					<input type="text" size="20" name="consent_label"
                            value="[% entry.consent_label | html %]"
						[% site.html.disabled %] />
				</td>
				<td>
					<select name="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/consent-options/edit/[% entry.id %]">Edit</a>
				</td>
			 </tr>
			[% END %]

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