<%@ include file="/includes.jsp" %>
<table class="menu">
	<tr>
		<th class="menuTitle"><img border="0" src='images/16x16/icon.png' alt='eMDT'/>&nbsp;eMDT</th>
	</tr>
	<tr>
		<td class="menuItem"><a onclick="return dataGuard()" href="patientSearch.form">Find&nbsp;Patient</a></td>
	</tr>
    <c:set var="createPatients" value="${emdt.createPatientAllowed}"/>

	<sec:authorize access="hasRole('ADMIN')">

		<c:if test="${emdt.patientCanCreate eq true}">
			<tr>
				<td class="menuItem">
					<c:choose>
						<c:when test="${createPatients }">
							<a href="patientDetails.jsp?id=new" onclick="return dataGuard()">Create&nbsp;Patient</a>
						</c:when>
						<c:otherwise>
							<s title="Maximum number of patients reached">Create&nbsp;Patient</s>
						</c:otherwise>
					</c:choose>
				</td>
			</tr>
	    </c:if>
		
		<tr>
			<td class="menuItem">
				<c:choose>
					<c:when test="${createPatients }">
						<a href="importPatientRecord.form" onclick="return dataGuard()">Import&nbsp;Patients</a>
					</c:when>
					<c:otherwise>
						<s title="Maximum number of patients reached">Import&nbsp;Patients</s>
					</c:otherwise>
				</c:choose>
			</td>
		</tr>
	</sec:authorize>
	
	<c:if test="${emdt.patient != null }">
		<tr>
			<td class="menuSectionTitle">Current Patient</td>
		</tr>
		<tr>
			<td>
				<table class="menuInfoBox">
					<tr>
						<td class="menuInfoBoxLabel">Forename:</td>
						<td class="menuInfoBoxValue"><c:out value="${emdt.patient.forename }"/></td>
					</tr>
					<tr>
						<td class="menuInfoBoxLabel">Surname:</td>
						<td class="menuInfoBoxValue"><c:out value="${emdt.patient.surname }"/></td>
					</tr>
					<tr>
						<td class="menuInfoBoxLabel">Sex:</td>
						<td class="menuInfoBoxValue"><webapp:listValue domain="EMDT" listName="SexCode" key="${emdt.patient.sex}" /></td>
					</tr>
					<tr>
						<td class="menuInfoBoxLabel">Age:</td>
						<td class="menuInfoBoxValue"><c:out value="${emdt.patient.currentAge }"/>
							<c:if test="${emdt.patient.dateOfDeath != null}">
								<font color="maroon">(deceased)</font>
							</c:if>
						
						</td>
					</tr>
					<tr>
						<td class="menuInfoBoxLabel">NHS No.:</td>
						<td class="menuInfoBoxValue"><c:out value="${emdt.patient.nhsNumber }"/></td>
					</tr>
					<tr>
						<td class="menuInfoBoxLabel">Hospital Number:</td>
						<td class="menuInfoBoxValue"><c:out value="${emdt.patient.hospitalNumber }"/></td>
					</tr>
					<tr>
						<td class="menuInfoBoxLabel">Care spell:</td>
						<td class="menuInfoBoxValue">
							<c:if test="${emdt.currentCareSpell != null}">
								<webapp:listValue domain="EMDT" listName="Speciality" key="${emdt.currentCareSpell.primarySite}" />														 
							</c:if>
							<c:if test="${emdt.currentCareSpell == null}">
								<a href="editCarespells.form" title="Select or create a care spell">Select...</a>
							</c:if>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="menuItem"><a href="patientDetails.jsp?id=current" onclick="return dataGuard()">Patient&nbsp;Details</a></td>
		</tr>
		
		<tr>
			<td class="menuItem"><a href="../emdt/patientAuditLog.form">Patient Audit Log</a></td>
		</tr>
		
		<tr>
			<td class="menuItem"><a href="../emdt/editCarespells.form" onclick="return dataGuard()">Carespells</a></td>
		</tr>
		<tr>
			<td class="menuItem"><a href="../emdt/patientHistoryActions.form" onclick="return dataGuard()">Patient&nbsp;History</a></td>
		</tr>
		<tr>
			<td class="menuItem"><a href='../emdt/patientfiles.form'>Patient&nbsp;Files</a></td>
		</tr>
		<tr>
			<td class="menuItem"><a onclick="return dataGuard()" href="noteSearch.jsp">Search...</a></td>
		</tr>
		<c:if test="${emdt.currentCareSpell != null }">
		<tr>
			<td class="menuItem"><a onclick="return dataGuard()" href="../emdt/addCurrentPatientToNextMeeting.form?task=selectNextMeeting">Add to next meeting</a></td>
		</tr>
		</c:if>
		<c:set var="bookingFormId" value="${emdt.bookingFormId }"/>
		<c:if test="${emdt.currentCareSpell != null and bookingFormId != null }">
		<tr>
			<td class="menuItem"><a onclick="return dataGuard()" href="../emdt/consultationNote.form?filterFormId=<c:out value="${bookingFormId}"/>">MDT Booking</a></td>
		</tr>
		</c:if>
		<tr>
			<td class="menuItem"><a href="patientSearch.form?action=closePatient" onclick="return dataGuard()">Close&nbsp;Patient</a></td>
		</tr>
		<c:if test="${emdt.currentCareSpell != null }">
			<tr>
				<td class="menuSectionTitle">Forms</td>
			</tr>
			<tr>
				<td class="menuItem"><a href="formsMenu.jsp" onclick="return dataGuard()">Forms menu</a></td>
			</tr>
		</c:if>
	</c:if>
	<tr>
		<td class="menuSectionTitle">Reports</td>
	</tr>
		<tr>
			<td class="menuItem"><a href="patientSummaryActions.form?method=list" onclick="return dataGuard()">Patient&nbsp;Summaries</a></td>
		</tr>
	<tr>
		<td class="menuItem"><a onclick="return dataGuard()" href="queries.jsp">Query Builder</a></td>
	</tr>
	
	<sec:authorize access="hasAnyRole('ADMIN','ACCESS_ALL_PATIENTS')">
		<tr>
			<td class="menuItem"><a onclick="return dataGuard()" href="reportMenu.jsp">PTL Reports menu</a></td>
		</tr>
		<tr>
			<td class="menuItem"><a onclick="return dataGuard()" href="../emdt/referralsDetailReport.jsp">Referrals Detail Report</a></td>
		</tr>
		<tr>
			<td class="menuItem"><a onclick="return dataGuard()" href="../emdt/referralsSummaryReport.jsp">Referrals Summary Report</a></td>
		</tr>
		<tr>
			<td class="menuItem"><a onclick="return dataGuard()" href="../emdt/referralsUsersReport.jsp">Referrals Users Statistics</a></td>
		</tr>
		<tr>
			<td class="menuItem"><a onclick="return dataGuard()" href="../referrals/notificationReport.form">Notification Referrals Report</a></td>
		</tr>
	</sec:authorize>
	<tr>
			<td class="menuItem"><a onclick="return dataGuard()" href="../emdt/frequency.form">Set Notifications Frequency...</a></td>
	</tr>
	<tr>
		<td class="menuItem"><a onclick="return dataGuard()" href="../emdt/letterGenerate.form">Letters</a></td>
	</tr>
	<tr>
		<td class="menuItem"><a onclick="return dataGuard()" href="CWTReport.jsp">Cancer Waits</a></td>
	</tr>
	<tr>
		<td class="menuSectionTitle">Feeds</td>
	</tr>
	<c:if test="${emdt.currentCareSpell != null }">
	
		<c:if test="${emdt.nbocapExportEnabled eq true}">
			<tr>
				<td class="menuItem"><a onclick="return dataGuard()" href="NBOCAPExport.jsp">NBOCAP Export</a></td>
			</tr>
		</c:if>
		
	</c:if>

	<sec:authorize access="hasRole('ADMIN')">
		<tr>
			<td class="menuItem">
				<a href="ReportingExport.form?initially=true" onclick="return dataGuard()">Reporting Export</a>
			</td>
		</tr>
	</sec:authorize>	
	<c:if test="${emdt.urgentCancerReferralsFeedEnabled eq true}">
		<tr>
			<td class="menuItem">
				<a href="wmuhExport.jsp" onclick="return dataGuard()">Urgent Cancer Referrals Feed</a>
			</td>
		</tr>
	</c:if>
</table>