[% META title = 'Admin » User Locations' -%]
[% PROCESS admin/user_nav.tt page = 'user_location' %]
[% # PROCESS dumper.tt dump = errors %]
[% user_locations_dfv_js %]
<h2 align="center">Setup User Locations</h2>
[% IF dfv_errors %]
<p class="error">[% c.cfg('msg').dfv_errors %]</p>
[% END %]
[% INCLUDE site/snippets/help.tt file = 'newuserlocation' %]
<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="post" action="[% app_url %]/admin/user_location/update"
[% user_locations_onsubmit %] name="user_location" id="user_location">
<div class="indent">
<table>
<tr>
<td class="label">Location name:</td>
<td class="content">
[% PROCESS site/ajax_input.tt field = 'location_name' size = 30 %]
[% error_location_name %]
</td>
</tr>
<tr>
<td class="label">Region Code:</td>
<td class="content">
<input type="text" size="5" name="region_code" value="" [% site.html.onfocus %] />
[% error_region_code %]
</td>
</tr>
<!--
<tr>
<td class="label">E-mail Contact:</td>
<td class="content">
<input type="text" size="50" name="email_contact" value="" [% site.html.onfocus %] />
[% error_email_contact %]
</td>
</tr>
-->
<tr>
<td class="label">Active:</td>
<td class="content">
<select name="active" [% site.html.onfocus %]>
[% FOREACH option IN ['yes', 'no'] %]
<option value="[% option %]">[% option %]</option>
[% END %]
</select>
[% error_active %]
</td>
</tr>
</table>
<p class="indent">[% site.html.submit %]</p>
</div>
</form>
</div>
<p class="spacer"> </p>
[% IF locations.size %]
<table>
<tr>
<th></th>
<th>Location name</th>
<th>Region code</th>
<!--
<th>Email contact</th>
-->
<th>Active</th>
</tr>
[% FOREACH item IN locations; # PROCESS dumper.tt dump = item.as_tree %]
<tr>
<td>[% loop.count %]</td>
<td>
<input type="text" size="30" name="[% item.id %]" value="[% item.location_name %]"
[% site.html.readonly %] />
</td>
<td align="center">
<span class="acronym" title="[% item.parent_code.description %]">
[% item.region_code %]</span>
</td>
<!--
<td>
<input type="text" size="50" name="[% item.id %]" value="[% # item.email_contact %]"
[% site.html.disabled %] />
</td>
-->
<td>
<select name="active" [% site.html.disabled %]>
[% FOREACH option IN ['yes', 'no'] %]
<option value="[% option %]" [% 'selected' IF option == item.active %]>
[% option %]
</option>
[% END %]
</select>
</td>
<td align="center">
<a href="[% app_url %]/admin/user_location/edit/[% item.id %]">Edit</a>
</td>
</tr>
[% END %]
</table>
[% END %]