<%@ include file="/includes.jsp" %>
<br/>
<br/>
<br /><br />
<c:if test="${fn:length(requestScope.message) gt 0 }">
	<div align="center">
		<span class="info"><c:out value="${requestScope.message}"/></span>
	</div>
</c:if>
<c:if test="${fn:length(requestScope.error) gt 0 }">
	<div align="center">
		<span class="error"><c:out value="${requestScope.error}"/></span>
	</div>
</c:if>
<table cellspacing="0" width="80%">
	<tr>
		<td class="tableTitleBar">Meetings</td>
	</tr>
	<tr>
		<td width="100%">
			<table width="100%" cellspacing="0" class="table">
				<tr class="tableHeader">
					<td class="tableColHeader">Title</td>
					<th class="tableColHeader">Date</th>
					<th class="tableColHeader">Patients Discussed</th>
					<th class="tableColHeader">Attendees</th>
				</tr>
				<c:forEach var="meeting" items="${emdt.meetings }">
					<tr>
						<td class="tableCell"><a href="editMeeting.jsp?id=<c:out value="${meeting.meeting_id }"/>"><c:out value="${meeting.meeting_title}"/></a></td>
						<td class="tableCell" align="center"><fmt:formatDate value="${meeting.meeting_date}" pattern="dd/MM/yyyy"/></td>
						<td class="tableCell">
							<c:if test="${meeting.meetingItemDtoList ne null }">
								<c:forEach var="item" items="${meeting.meetingItemDtoList }">
									<a href='patientSearch.form?id=<c:out value="${item.meeting_items_patientDiscussed_id}"/>'>[<c:out value="${item.meeting_items_patientDiscussed_forename}"/> <c:out value="${item.meeting_items_patientDiscussed_surname}"/>]</a> 
								</c:forEach>
							</c:if>
						</td>
						<td class="tableCell">
							<c:forEach var="attendee" items="${meeting.meetingAttendeeDtoList }">
								<c:if test="${!empty attendee && attendee.meeting_attendees_user_username!=null}">
									<c:out value="${attendee.meeting_attendees_user_username}"/>
								</c:if>
							</c:forEach>
						</td>
					</tr>
				</c:forEach>
				<tr>
					<td colspan="4" align="center">
						<br/>
						<input type="button" name="newMeeting" value="Create New Meeting" onclick="document.location = 'editMeeting.jsp?id=new'"/>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
