<!-- nationalMDT/tiles/managementMenu.jsp start -->
<%@ include file="/includes.jsp"%>

<c:if test="${emdt.currentMeeting ne null}">
<div class="menuButtonRect pink"
	onclick="location.href='../meetings/resumeMeeting.form'">
	Resume Current Meeting
</div>
</c:if>
<c:choose>
	<c:when test="${filterForm.name ne null }"><c:set var="nameOfForm" value="${filterForm.name}"></c:set></c:when>
	<c:otherwise><c:if test="${consultationNoteForm ne null}"><c:set var="nameOfForm" value="${consultationNoteForm.view.formName}"></c:set></c:if></c:otherwise>
</c:choose>
<c:set var="msg1" value='<%=request.getParameter("successMsg")%>' />
<c:if test="${referralPatientDto.currentCareSpell.referralsDefinition ne null || emdt.currentCareSpell.referralsDefinition ne null}">
	<c:choose>
		<c:when
			test="${referralPatientDto.currentCareSpell.referralsDefinition ne null}">
			<c:set var="referralsDefinition"
				value="${referralPatientDto.currentCareSpell.referralsDefinition}" scope="request"></c:set>
		</c:when>
		<c:otherwise>
			<c:set var="referralsDefinition"
				value="${emdt.currentCareSpell.referralsDefinition}" scope="request"></c:set>
		</c:otherwise>
	</c:choose>
	<c:set var="currentCareSpell" value="${emdt.currentCareSpell}" scope="session"></c:set>
</c:if>
<c:if test="${referralsDefinition ne null}">
	<c:set var="groupBy" value="" scope="request"/>
	<c:if test="${nameOfForm !=null or nameOfForm ne ''}">
		<c:forEach var="formSummaryMapOrder" items="${referralsDefinition.formSummaryMapOrder}">
			<c:if test="${formSummaryMapOrder.formOrSummaryName eq nameOfForm and formSummaryMapOrder.groupName!='Top Level' }">
				<c:set var="groupBy" value="${formSummaryMapOrder.groupName}" scope="request"></c:set>
			</c:if>
		</c:forEach>
	</c:if>
	<c:if test="${nameOfForm !=null or nameOfForm ne ''}">
		<c:forEach var="formSummaryMapOrder" items="${referralsDefinition.formSummaryMapOrder}">
			<c:if test="${formSummaryMapOrder.formOrSummaryName eq summaryName and formSummaryMapOrder.groupName=='Top Level' }">
				<c:set var="groupBy" value="" scope="request"></c:set>
			</c:if>
		</c:forEach>
	</c:if>
	<c:choose>
		<c:when test="${groupBy ne null and groupBy ne ''}">
			<c:choose>
				<c:when test="${groupBy eq 'Images and Reports'}">
					<div class="menuSubHolderBig">
							<div class="menuButtonHolderBlueLong" onclick="location.href='../nationalMDT/redirectToParentScreen.form'">
								<br/> Display Search<br /> Listing
							</div> 
							<div class="menuButtonHolderBlueLong" onclick="location.href='../nationalMDT/viewPatient.form?formName='">
								<br/> Click Here For<br /> Patient Details
							</div>
							<div class="menuButtonHolderBlueLong" onclick="location.href='../nationalMDT/imgStatusTracking.form'">
								<br/><span>View Images</span>
							</div>
					</div>
					<div class="menuHolder">
				</c:when>
				<c:otherwise>
					<div class="menuHolder">
						<div class="menuButtonSquare blue" onclick="location.href='../nationalMDT/redirectToParentScreen.form'">
							<br/> Display<br/> Search<br/> Listing
						</div>
						<div 
							<c:choose>
								<c:when
									test="${ summaryName eq null and ((null eq nameOfForm) or  ('' eq nameOfForm) ) and (addToMeeting eq null or addToMeeting ne true)}">
										class="menuButtonSquare selected"
								</c:when>
								<c:otherwise>class="menuButtonSquare blue"</c:otherwise>
							</c:choose>
						>
							<a href="../nationalMDT/viewPatient.form?formName=">
								Patient<br /> Details</a>
						</div>
					<tiles:insertTemplate template ="forms/groupFormsMenu.jsp"/>
					</div>
					<div class="menuSub2Holder">
				</c:otherwise>
			</c:choose>
			<tiles:insertTemplate template ="forms/formsMenu.jsp"/>
			</div>
			<c:set var="patientDetailsPage" value="true"></c:set>
			<tiles:insertTemplate template ="responseFormMenu.jsp" ></tiles:insertTemplate>
		</c:when>
		<c:otherwise>
			<div class="menuHolder">
				<div 
		 			<c:choose>
						<c:when test="${ summaryName eq null and ((null eq nameOfForm) or  ('' eq nameOfForm) )and (addToMeeting eq null or addToMeeting ne true)}">
								class="menuButtonSquare selected"
						</c:when>
						<c:otherwise>class="menuButtonSquare blue"</c:otherwise>
					</c:choose>
				>
					<a href="../nationalMDT/viewPatient.form?formName=">Patient<br /> Details</a>
				</div>
				<tiles:insertTemplate template ="forms/groupFormsMenu.jsp"/>
				<sec:authorize access="hasRole('NMDM_SUBMITTER')">
					<div class="menuButtonSquare pink">
						<a href="../nationalMDT/nmdmReferralssummary.form">Save Or Submit<br /> Record </a>
					</div>
				</sec:authorize>
			</div>
			<c:set var="patientDetailsPage" value="true"></c:set>
			<sec:authorize access="hasRole('NMDT_COORD')">
			<tiles:insertTemplate template ="responseFormMenu.jsp" ></tiles:insertTemplate>
			</sec:authorize>
			<sec:authorize access="hasRole('NMDT_COORD')">
				<div class="menuButtonRect green">
					<a href="../nationalMDT/addCurrentPatientToNextMeeting.form?task=selectNextMeeting">Add to Meeting</a>
				</div>
			</sec:authorize>
		</c:otherwise>
	</c:choose>
</c:if>
<!-- nationalMDT/tiles/managementMenu.jsp end -->