[% META title = 'Admin &raquo; Local Network Locations' %]

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

    [% # PROCESS dumper.tt dump = hmrn_location_map %]
    [% # PROCESS dumper.tt dump = parent_orgs %]
    
    <h2>Configure Local Network Parent Organisations:</h2>
    
    <p class="indent">
        [% IF c.query.param('show_only_hmrn') %]
            [<a href="[% url_with_path %]">display all</a>]
        [% ELSE %]
            [<a href="[% url_with_path %]?show_only_hmrn=1">display only selected</a>]
        [% END %]
    </p>
    
    <form action="[% app_url %]/config/network-locations/update" method="post">
	<table class="indent">
		<tr>
			<td>&nbsp;</td>
			<th>Parent Organisation</th>
			<th>Code</th>
			<td>&nbsp;</td>
		</tr>

    [% FOREACH org IN parent_orgs;
        IF c.query.param('show_only_hmrn');
            NEXT UNLESS hmrn_location_map.item(org.id);
        END;
        class = hmrn_location_map.item(org.id) ? 'bold' : 'normal' %]
		<tr>
			<td>[% loop.count %]</td>
			<td class="[% class %]">[% org.description %]</td>
			<td class="[% class %]">[% org.parent_code %]</td>
			<td>
                <input type="checkbox" name="parent_id" value="[% org.id %]"
                    [% 'checked' IF hmrn_location_map.item(org.id) %] />
            </td>
		</tr>    
    [% END %]
    
    </table>
    <p class="indent">
        [% site.html.submit %]
        [% site.html.reset %]
    </p>
    </form>
<!-- END [% template.name %] -->