  [% META title = 'Admin &raquo; Parent Organisations' -%]
<!-- BEGIN [% template.name %] -->

	[% parent_organisations_dfv_js %]

	[% PROCESS admin/referral_nav.tt page = 'parent-organisations' %]
	
	<h2 align="center">Parent Organisations</h2>

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

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

    <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/parent-organisations/update"
			name="parent-organisations" id="parent-organisations" [% parent_organisations_onsubmit %]>

		[% PROCESS site/lookup.tt type = 'hospital', fname = 'popup2' %]
		
		[% INCLUDE site/snippets/help.tt file = 'newparentorg' %]

		<table class="indent">
			<tr>
				<td class="label">Parent Code:</td>
				<td>
					[% PROCESS site/ajax_input.tt field = 'parent_code' size = 6 %]
					[% IF error_parent_code %]
						[% error_parent_code %]
					[% ELSE %]
						[ Max 6 chars ]
					[% END %]
				</td>
			</tr>
			<tr>
				<td class="label">Description:</td>
				<td>
					[% PROCESS site/ajax_input.tt field = 'description' size = 50
						id = 'parent_description' %]
					[% error_description %]
				</td>
			</tr>

			<tr>
				<td class="label">Referral Type:</td>
				<td class="content">
					<select name="referral_type" [% site.html.onfocus %]>
                    <option value="">&nbsp;</option>
					[% FOREACH type IN ['hospital', 'practice'] %]
						<option value="[% type %]">[% type %]</option>
					[% END %]
					</select>
					[% error_referral_type %]
				</td>
			</tr>
			<tr>
				<td class="borderless" colspan="2" align="center">[% site.html.submit %]</td>
			</tr>
		</table>
		</form>
	</div>

	<hr />

	<p class="title">Search for an existing parent organisation:</p>
  
	<div class="indent">
		[% PROCESS search/parent_organisation_search.tt %]
	</div>
<!-- END [% template.name %] -->

