<%@ include file="/includes.jsp" %>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<script type="text/javascript">     
   // When the page is ready
   
   $(document).ready(function(){
	 // hide stuff at page load
	 <c:if test="${not empty patientSearchResults}">
    $(".hider").hide();
	 </c:if>

     // hide/show stuff on link click
     $(".showhide").click(function(event){
       $(".hider").toggle();
       $(".showhide").toggle();
       // Stop the link click from doing its normal thing
       return false;
     });
   });
   
</script>
 <c:if test="${not empty patientSearchResults}">
<div><input type="button" class="showhide" value="Search again..." /></div>
 </c:if>
 
 <div class="hider">
<tags:dialogBox title="Find and Add Patient">
	<table width="100%">
		<tr>
			<td class="label">Name</td>
			<td class="input"><smvc:input path="name" cssStyle="width:120"/></td>
		</tr>
		<tr>
			<td class="label">NHS Number</td>
			<td class="input"><smvc:input path="nhsNumber" cssStyle="width:120"/></td>
		</tr>
		<tr>
			<td class="label">Hospital Number</td>
			<td class="input"><smvc:input path="hospitalNumber" cssStyle="width:120"/></td>
		</tr>
		<tr>
			<td class="label">Date of Birth</td>
			<td class="input"><smvc:input path="dob" cssStyle="width:120"/></td>
		</tr>
		<tr>
			<td class="label">Search within:</td>
			<td class="input">
				<smvc:select path="scope">
					<smvc:option value="all">All Patients</smvc:option>
					<smvc:option value="user">My Patients</smvc:option>
					<smvc:option value="meeting">Next Meeting</smvc:option>
				</smvc:select>
			</td>
		</tr>
		<tr>
			<td class="label">Patient Status:</td>
			<td class="input">
				<smvc:select path="patientStatus">
					<smvc:option value="">All</smvc:option>
					<smvc:option value="active">Active</smvc:option>
					<smvc:option value="suspended">Suspended</smvc:option>
					<smvc:option value="discharged">Discharged</smvc:option>
				</smvc:select>
			</td>
		</tr>
		<tr>
			<td class="label">Clinician:</td>
			<td class="input">
				<smvc:select path="primaryClinician">
					<smvc:option value=""></smvc:option>
					<c:forEach var="usersByHospitalMap" items="${webapp.usersByHospitalIdMap}">
						<optgroup label="${webapp.hospMap[usersByHospitalMap.key]}">
							<c:forEach var="userId" items="${usersByHospitalMap.value}">
								<smvc:option  value="${webapp.userIdUsernameMap[userId]}" ><c:out value="${webapp.userIdNameMap[userId]}"/></smvc:option>
							</c:forEach>
						</optgroup>
					</c:forEach>
				</smvc:select>
			</td>
		</tr>
		<tr>
			<td class="label">Primary Site:</td>
			<td class="input">
				<webapp:selectAndEditList includeEmpty="true" path="primarySite" domain="EMDT" list="Speciality" currentValue="${meetingPatientForm.primarySite}"/>
			</td>
		</tr>
		<tr>
			<td colspan="2">&nbsp;</td>
		</tr>
		<tr>
			<td colspan="2" style="text-align:right"><input type="submit" value="Search"/></td>
		</tr>
	</table>
</tags:dialogBox>
</div>