<%@ include file="/includes.jsp" %>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<script src="../js/PatientDetailsInSearchRecord.js" type="text/javascript"></script>
<smvc:form name = "referralsInForm" modelAttribute="patientSearchDto" method="post" action="referralsIn.form" onsubmit="return submitTheForm();">
<input type="hidden" name="redirectParams" value="<c:out value="${requestScope['javax.servlet.forward.query_string']}" />" />
<input type="hidden" name="id" id="id"/>
<smvc:errors></smvc:errors>
<div class="rowSpacer">&nbsp;</div>
  <div class="largeContainer">
     <c:choose>
			<c:when test="${requestScope.successMsg != null || requestScope.errorMsg != null}">
				<c:if test="${requestScope.successMsg != null}">
						<div class="message"><img
							src="../images/16x16/information.png" alt="i" />
						<c:out value="${requestScope.successMsg}"/></div>
					</c:if>
					 <c:if test="${requestScope.errorMsg != null}">
						<div class="error"><img src="../images/16x16/error_white_bg.png"
							alt="e" /><c:out value="${requestScope.errorMsg}"/></div><br/>
					</c:if>
			</c:when>
			<c:otherwise>
				<c:set var="msg" value='<%=request.getParameter("successMsg")%>'/>
				<c:if test="${(null ne msg) and ('null' ne msg)}">
						<div class="message"><img
							src="../images/16x16/information.png" alt="i" />
						<c:out value="${msg}"/></div>
				</c:if>
			</c:otherwise>
		</c:choose>
		<div class="error">
				<spring:bind path="patientSearchDto.*">
					<c:if test="${not empty status.errorMessages}">
						<c:forEach items="${status.errorMessages}" var="error">
							<img src="../images/16x16/error_white_bg.png"
							alt="e" /><c:out value="${error}" escapeXml="false"/> <br />
						</c:forEach>
					</c:if>
				</spring:bind></div>
	
	<div class="rowDivMiddle">&nbsp;
		<tiles:insertTemplate template ="/referrals/tiles/patientSearchBox.jsp"></tiles:insertTemplate>
	</div>
	<div class="rowDiv">
		<div class="tableTitleBar" align="left">&nbsp;&nbsp;Search Results (<c:out value="${patientSearchDto.searchResultCount}"/> match)</div>
		<%@ include file="pagination.jsp"%>
		<tiles:insertTemplate template ="/referrals/tiles/patientSearchResultsBox.jsp"></tiles:insertTemplate>
	</div>
    </div>
    
</smvc:form>