<%@ include file="/includes.jsp" %>
<c:set var="createMeetings" value="${emdt.createMeetingAllowed}"/>
<table class="menu">
	<tr>
		<th class="menuTitle"><img border="0" src='images/16x16/icon.png' alt='Meetings'/>&nbsp;Meetings</th>
	</tr>

	<c:if test="${emdt.currentMeeting != null }">

	<tr>
		<td>
			<table class="menuInfoBox">
				<tr>
					<th class="prevItem"><a href="navigateMeeting.form?action=previousMeeting"><img src="images/left-arrow.png"/></a></th>
					<th class="menuInfoBoxTitle">Current&nbsp;Meeting</th>
					<th class="nextItem"><a href="navigateMeeting.form?action=nextMeeting"><img src="images/right-arrow.png"/></a></th>
				</tr>
				<tr>
					<td colspan="3">
						<table cellpadding="0" cellspacing="0">
							<tr>
								<td class="menuInfoBoxLabel">Title:</td>
								<td class="menuInfoBoxValue"><c:out value="${emdt.currentMeeting.title }"/></td>
							</tr>
							<tr>
								<td class="menuInfoBoxLabel">Date:</td>
								<td class="menuInfoBoxValue"><fmt:formatDate value="${emdt.currentMeeting.date}" pattern="dd/MM/yy"/></td>
							</tr>
							<tr>
								<td class="menuInfoBoxLabel">Time:</td>
								<td class="menuInfoBoxValue"><fmt:formatDate value="${emdt.currentMeeting.date}" pattern="HH:mm"/></td>
							</tr>
							<tr>
								<td class="menuInfoBoxLabel">Location:</td>
								<td class="menuInfoBoxValue"><webapp:listValue domain="webapp" listName="location" key="${emdt.currentMeeting.location }" /></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	</c:if>

	<c:if test="${emdt.currentMeeting != null and emdt.currentMeeting.currentItem != null }">
	
	<tr>
		<td>
			<table class="menuInfoBox">
				<tr>
					<td width="33%"><a href="navigateMeeting.form?action=previousMeetingItem"><img src="images/left-arrow.png"/></a></td>
					<td class="menuInfoBoxTitle">Current&nbsp;Patient</td>
					<td width="33%" align="right"><a href="navigateMeeting.form?action=nextMeetingItem"><img src="images/right-arrow.png"/></a></td>
				</tr>
				<tr>
					<td colspan="3">
						<table cellpadding="0" cellspacing="0">
							<tr>
								<td class="menuInfoBoxLabel">Forename:</td>
								<td class="menuInfoBoxValue"><c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.forename }"/></td>
							</tr>
							<tr>
								<td class="menuInfoBoxLabel">Surname:</td>
								<td class="menuInfoBoxValue"><c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.surname }"/></td>
							</tr>
							<tr>
								<td class="menuInfoBoxLabel">Sex:</td>
								<td class="menuInfoBoxValue"><webapp:listValue domain="EMDT" listName="SexCode" key="${emdt.currentMeeting.currentItem.patientDiscussed.sex }" /></td>
							</tr>
							<tr>
								<td class="menuInfoBoxLabel">Age:</td>
								<td class="menuInfoBoxValue"><c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.currentAge }"/></td>
							</tr>
							<tr>
								<td class="menuInfoBoxLabel">NHS&nbsp;No.:</td>
								<td class="menuInfoBoxValue"><c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.nhsNumber }"/></td>
							</tr>
							<tr>
								<td class="menuInfoBoxLabel">Hospital Number:</td>
								<td class="menuInfoBoxValue"><c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.hospitalNumber }"/></td>
							</tr>
						</table>
					</td>
				</tr>
		</table>
		</td>
	</tr>
	</c:if>
	
	<tr>
		<td class="menuItem"><span style="font-weight: bold; font-size: 9pt;">Meeting Schedule</span></td>
	</tr>
	<tr>
		<td class="menuItem"><a href="setMeetingFilter.form?filterId=3" onclick="return dataGuard()">-&nbsp;Today's meetings</a></td>
	</tr>
	<tr>
		<td class="menuItem"><a href="setMeetingFilter.form?filterId=2" onclick="return dataGuard()">-&nbsp;Planned</a></td>
	</tr>
	<tr>
		<td class="menuItem"><a href="setMeetingFilter.form?filterId=1" onclick="return dataGuard()">-&nbsp;Previous</a></td>
	</tr>
	<tr>
		<td class="menuItem"><a href="setMeetingFilter.form?filterId=0" onclick="return dataGuard()">-&nbsp;Show all&nbsp;Meetings</a></td>
	</tr>
	<tr>
		<td class="menuItem"><a href="meetingSchedule.form" onclick="return dataGuard()">-&nbsp;Meeting Schedule</a></td>
	</tr>
	<tr>
		<td class="menuItem"></td>
	</tr>
	<tr>
		<td class="menuItem">
			<c:choose>
				<c:when test="${createMeetings }">
					<a href="createAndEditMeeting.form?action=create" onclick="return dataGuard()">Add&nbsp;New&nbsp;Meeting...</a>
				</c:when>
				<c:otherwise>
					<s title="Maximum number of meetings reached">Add&nbsp;New&nbsp;Meeting...</s>
				</c:otherwise>
			</c:choose>
		</td>
	</tr>
	<c:if test="${emdt.currentMeeting != null }">
		<tr>
			<th class="menuSectionTitle">Current&nbsp;Meeting</th>
		</tr>
		<tr>
			<td class="menuItem"><a href="viewPatients.jsp" onclick="return dataGuard()">Patients&nbsp;in Meeting</a></td>
		</tr>
		<tr>
			<td class="menuItem"><a style="cursor:pointer;" onclick="window.open('printPatientsInCurrentMeeting.jsp')">Meeting Summary</a></td>
		</tr>
		<tr>
			<td class="menuItem">
				<c:choose>
					<c:when test="${createMeetings }">
						<a href="createAndEditMeeting.form?action=clone" onclick="return dataGuard()">Copy&nbsp;this&nbsp;Meeting...</a>
					</c:when>
					<c:otherwise>
						<s title="Maximum number of meetings reached">Copy&nbsp;this&nbsp;Meeting</s>
					</c:otherwise>
				</c:choose>
			</td>
		</tr>
		<tr>
			<td class="menuItem"><a href="closeMeeting.form" onclick="return dataGuard()">Close&nbsp;Meeting</a></td>
		</tr>
		<tr>
			<th class="menuSectionTitle">Edit&nbsp;Meeting</th>
		</tr>
		<tr>
			<td class="menuItem"><a href="createAndEditMeeting.form?action=edit" onclick="return dataGuard()">Overview</a></td>
		</tr>
		<tr>
			<td><a href="addMeetingPatients.form" onclick="return dataGuard()">Select&nbsp;Patients</a></td>
		</tr>
		<tr><td>
		<c:choose>
			<c:when test="${requestScope.message ne null and requestScope.message eq 'There are no patients in this meeting.'}">
			  <a onmouseover="this.href='javascript:void(0)';this.disabled=true" >Reorder Patients</a> 
			</c:when>
			<c:otherwise>
				<a href="reOrderMeetingItems.jsp" >Reorder Patients</a> 
			</c:otherwise>
		</c:choose></td>
		</tr>
		<tr>
			<td class="menuItem"><a href="viewMeetingAttendee.form" onclick="return dataGuard()">Attendees</a></td>
		</tr>
		
		<tr>
            <td class="menuItem"><a href="editMeetingFollowupMails.form" onclick="return dataGuard()">Follow&nbsp;Ups</a></td>
        </tr>
	</c:if>
	<c:if test="${emdt.currentMeeting != null and emdt.currentMeeting.currentItem != null }">
		<tr>
			<th class="menuSectionTitle">Current&nbsp;Patient</th>
		</tr>
		<c:set var="url" value="<%=request.getRequestURL()%>"></c:set>
		<c:choose>
			<c:when test="${(fn:indexOf(url,'meeting')) ge 0}">
				<tr>
					<td class="menuItem">
					<a href='../emdt/patientSearch.form?id=<c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.guid }"/>'>Patient Record</a></td>
				</tr>
			</c:when>
			<c:otherwise>
				<tr>
					<td class="menuItem"><a
						href='../referrals/viewPatient.form?patientId=<c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.guid }"/>'>Patient	Record</a></td>
				</tr>
			</c:otherwise>
		</c:choose>
		<tr>
			<td class="menuItem"><a href="viewMeetingPatientSummary.jsp" onclick="return dataGuard()">Patient&nbsp;Summary</a></td>
		</tr>
		<!-- 
		<tr>
			<td class="menuItem"><a href=patientDiscussionLink.do?meeting=<c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.id}"/>>Q &amp; A Forum</a></td>
		</tr>
		 -->
		<tr>
			<td class="menuItem"><a href="editPatientDiscussion.jsp" onclick="return dataGuard()">Discussion</a></td>
		</tr>
		<c:if test="${emdt.meetingItemFormDefinition != null }">
			<tr>
				<td class="menuItem"><a href="editMeetingItemNote.do" onclick="return dataGuard()">-&nbsp;<c:out value="${emdt.meetingItemFormDefinition.label }"/></a></td>
			</tr>
		</c:if>
		<tr>
			<td class="menuItem"><a href="viewPatientMeetings.jsp" onclick="return dataGuard()">Show&nbsp;Meetings</a></td>
		</tr>
	</c:if>
	

</table>