  [% META title = 'Admin &raquo; Edit Parent Organisation' -%]

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

  [% parent_organisations_dfv_js %]
  
	[% PROCESS admin/referral_nav.tt page = 'parent-organisations' %]

  <h2 align="center">Edit Parent Organisation Details</h2>

    [% IF dfv_errors %]
    <dl>
        <dt class="error">[% c.cfg('msg').dfv_errors %]</dt>
        [% IF error_parent_code %]
            <dd>Parent code [% error_parent_code %]</dd>[% END %]
        [% IF error_description %]
            <dd>Description [% error_description %]</dd>[% END %]
        [% IF error_referral_type %]
            <dd>Referral type [% error_referral_type %]</dd>[% END %]
    </dl>
    [% END %]

    <form method="post" action="[% app_url %]/config/parent-organisations/update/[% data.id %]"
		[% parent_organisations_onsubmit %] name="parent-organisation" id="parent-organisation">

    <table>
        <tr>
            <th [% IF error_parent_code %]class="error"[% END %]>Parent Code</th>
            <th [% IF error_description %]class="error"[% END %]>Description</th>
            <th [% IF error_referral_type %]class="error"[% END %]>Referral Type</th>
        </tr>

        <tr>
            <td>
                <input type="text" name="parent_code" size="6" value="[% data.parent_code %]" />
             </td>
            <td>
                <input type="text" name="description" size="50" 
					value="[% data.description | upper %]" />
             </td>
			 <td>
				<select name="referral_type">
				[% FOREACH option IN ['hospital', 'practice'] %]
                     <option value="[% option %]" [% 'selected' IF option == data.referral_type.description %]>
                        [% option %]
                    </option>
			    [% END %]
				</select>
				[% error_referral_type %]
			 </td>
             <td>
                [% site.html.submit %]
            </td>
        </tr>
    </table>

    </form>

    <p>[% site.html.back_button %]</p>
