<%@ include file="/includes.jsp" %>
<s:form action="/emdt/meetingAction">
	<input type="hidden" name="method" value="addPatients"/>
	<br/>
	<br/>
	<table cellspacing="0" width="90%">
		<tr>
			<td colspan="5" class="tableTitleBar">Patients for Discussion</td>
		</tr>
		<tr>
			<td width="100%">
				<table width="100%" cellspacing="0" cellpadding="4" class="table">
					<tr class="tableHeader">
						<th class="tableColHeader">Include?</th>
						<th class="tableColHeader">Surname</th>
						<th class="tableColHeader">Forename</th>
						<th class="tableColHeader">Age</th>
						<th class="tableColHeader">NHS Number</th>
						<th class="tableColHeader">Hospital Number</th>
						<th class="tableColHeader">Meetings Discussed at</th>
						<th class="tableColHeader">Assessment Plan</th>
					</tr>
					<c:forEach var="patient" items="${emdt.patientsByAssessmentPlan }" varStatus="index">
						<%
						    com.ardeo.entities.Patient patient=(com.ardeo.entities.Patient)pageContext.getAttribute("patient"); 

							//int i = index.intValue();
							//String rowClass = i % 2 == 0 ? "evenRow" : "oddRow";
							String color = "lightgreen";
							if("Urgent".equals(patient.getAssessmentPlan())) {
								color = "#F98989";
							} else if("Interesting".equals(patient.getAssessmentPlan())) {
								color = "#FFF5B6";
							}
						%>
						<tr style="background-color: <%=color%>">
							<td class="tableCell" align="center">
								<html:multibox property='selectedPatients' value="<%=patient.getId() + ""%>" title="Check box to include in meeting"/>
							</td>
							<td class="tableCell" >
								<a href='patientSearch.form?id=<%=patient.getId()%>' title="Click to select Patient"><c:out value="${patient.surname}"/></a> 
							</td>
							<td class="tableCell" >
								<a href='patientSearch.form?id=<%=patient.getId()%>' title="Click to select Patient"><c:out value="${patient.forename}"/></a> 
							</td>
							<td class="tablecell"><c:out value="${patient.currentAge}"/></td>
							<td class="tablecell"><c:out value="${patient.nhsNumber}"/></td>
							<td class="tablecell"><c:out value="${patient.hospitalNumber}"/></td>
							<td align="center" class="tablecell">
								<c:forEach var="meeting" items="${emdt.meetings}" varStatus="index1">
									<c:forEach var="item" items="${meeting.meetingItemDtoList }">
										<c:if test="${item.meeting_items_patientDiscussed_id eq patient.id }">
											<c:if test="${meetingForm.meeting.id ne meeting.meeting_id} }">
												<a href="editMeeting.jsp?id=<c:out value="${meeting.meeting_id}"/>"><fmt:formatDate value="${meeting.meeting_date}" pattern="dd/MM/yyyy" /></a>
											</c:if>
										</c:if>
									</c:forEach>
								</c:forEach></td>
							<td class="tablecell"><c:out value="${patient.assessmentPlan}"/></td>
						</tr>
					</c:forEach>
				</table>
			</td>
		</tr>
	</table>
	<html:reset value="Reset"/>&nbsp;<html:submit value="Update"/>
</s:form>