  [% META title = 'Admin &raquo; Referral Sources &raquo; Search' -%]
<!-- BEGIN admin/config/referralsources/search.tt -->

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

	[% PROCESS admin/referral_nav.tt page = 'referral-sources' %]
	
	<h2>Referral sources:</h2>
    [% PROCESS site/page_count.tt %]
	
	<div class="indent">
		<table>
			<tr>
				<td>&nbsp;</td>
				<th>Org. Code</th>
				<th>Display Name</th>
				<th>Parent Org. Code</th>
				<th>Location Type</th>
				<th>Active</th>
				<td>&nbsp;</td>
			</tr>

			[% FOREACH source IN sources %] [% # PROCESS dumper.tt dump = source %]
			<tr>
				<td>
                    [% IF cgi_pager; cgi_pager.first_pos_displayed + loop.count - 1; ELSE; loop.count; END %]
				<td>
					<input type="text" size="6" name="organisation_code" value="[% source.organisation_code | html %]"
						[% site.html.disabled %] />
				</td>
				<td>
					<input type="text" size="75" name="display_name" value="[% source.display_name | html %]"
						[% site.html.disabled %] />
				</td>
				<td>
					<input type="text" size="5" name="parent" [% site.html.disabled %]
						value="[% source.parent_organisation.parent_code | html %]" />
				</td>
				<td>
					<select name="location_type" [% site.html.disabled %]>
					[% FOREACH option IN ['hospital', 'practice'] %]
						 <option value="[% option %]" [% 'selected' IF option == source.referral_type.description %]>
							[% option %]
						</option>
					[% END %]
					</select>
				</td>
				<td>
					<select name="is_active" [% site.html.disabled %]>
					[% FOREACH option IN ['yes', 'no'] %]
						 <option value="[% option %]" [% 'selected' IF option == source.is_active %]>
							[% option %]
						</option>
					[% END %]
					</select>
				</td>
				<td align="center">
					<a href="[% app_url %]/config/referral-sources/edit/[% source.id %]">Edit</a>
				</td>
			 </tr>
			[% END %]

		</table>			
	</div>

    [% PROCESS site/cgi_pager.tt %]
	
	<h3>Search again</h3>
	<div class="indent">
		[% PROCESS search/referral_source_search.tt %]
	</div>
<!-- END admin/config/referralsources/default.tt -->