<%@ include file="/includes.jsp"%>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<script type="text/javascript">
	function setActionParam() {
		document.getElementById('actionTriggered').value = "SAVE";
	}
</script>
<table width="100%">
	<tr>
		<td valign="top" align="center"><br /> <smvc:form
				modelAttribute="meetingInviteForm" id="inviteForm" action="../meetings/viewMeetingAttendee.form">
				<input type="hidden" name="redirectParams" value="<c:out value="${requestScope['javax.servlet.forward.query_string']}" />" />
				<input type="hidden" name="page" value="Invites" />
				<input type="hidden" id="actionTriggered" name="actionTriggered"
					value="" />

				<table>
					<tr>
						<td align="center"><br /> 
							<c:if test="${meetingInviteForm.locked eq true}">
								<span class="warn">This meeting is locked: changes are not permitted.</span>
							</c:if>
						
							<c:if test="${message ne null}">
								<span class="info"><c:out value="${message}"/></span>
							</c:if>
							<c:if test="${error ne null}">
								<span class="error"><c:out value="${error}"/></span>
							</c:if>
						</td>
					</tr>
				</table>
				<br />
				<table cellpadding="0" cellspacing="0" width="750" border="0">

					<tr>
						<td><tags:table title="Meeting Attendees Summary">
								<table width="100%" class="table" border="1">
									<tr>
										<th
											title="Enter a system username to have this meeting appear in their diary">Attendee
											name</th>
										<th
											title="Optional: Enter if you want to invite this attendee via an e-mail">E-Mail</th>
										<th
											title="Optional: Enter if you want to invite this attendee via telephone">Telephone</th>
										<th
											title="Optional: Enter if you want to invite this attendee via fax">Fax</th>
										<th
											title="Optional: Enter if you want to invite this attendee via letter">Letter</th>
										<th title="Which invitation method to use">Use</th>
										<th
											title="Check to indicate that this attendee attended the meeting">Attended
											Meeting?</th>
									</tr>
									<c:choose>
										<c:when
											test="${meetingInviteForm.meeting.totAttendees ne '0'}">
											<c:if
												test="${meetingInviteForm.meeting.attendees ne null && fn:length(meetingInviteForm.meeting.attendees) gt 0}">
												<c:forEach var="attendee"
													items="${meetingInviteForm.meeting.attendees}"
													varStatus="index">
													<tr class='${(index.count-1)%2 == 0 ? "odd" : "even" }Row'>
														<td width="20%"
															title="Optional: Enter if you want to invite this attendee via an e-mail">
															<c:out value="${attendee.user.name}"/></td>
														<td width="20%"
															title="Optional: Enter if you want to invite this attendee via an e-mail">
															<c:out value="${attendee.user.email}"/></td>
														<td width="14%"><c:out value="${attendee.telephone}"/></td>
														<td width="14%"><c:out value="${attendee.fax}"/></td>
														<td width="13%"><c:out value="${attendee.letter}"/></td>
														<td width="5%"><c:out value="${attendee.inviteMethod}"/></td>
														<td width="8%" align="center">
														<c:choose>
															<c:when test="${meetingInviteForm.locked eq 'false'}">
																<smvc:checkbox path="meeting.attendees[${index.count-1}].attendedMeeting" cssClass="allNonInvert" />
															</c:when>
															<c:otherwise>
																<c:if test="${meetingInviteForm.meeting.attendees[index.count-1].attendedMeeting eq true}">
																Yes
																</c:if>
																<c:if test="${meetingInviteForm.meeting.attendees[index.count-1].attendedMeeting eq false}">
																No
																</c:if>
															</c:otherwise>
														</c:choose>																
																
														</td>
													</tr>
												</c:forEach>
												<tr>
													<td colspan="7" align="right">
														<c:if test="${meetingInviteForm.locked eq 'false'}">
															Select <a href="javascript:select('all')">all</a> | <a href="javascript:select('none')">none</a> | <a href="javascript:select('invert')">invert</a>
														</c:if>
													</td>
												</tr>
												
											</c:if>
										</c:when>
										<c:otherwise>
											<tr>
												<td align="center" class="message" colspan="7">No
													Attendee(s) Found</td>
											</tr>
										</c:otherwise>
									</c:choose>
									<tr>
										<td colspan="6">&nbsp;</td>
										<td align="center">
											<c:choose>
												<c:when test="${meetingInviteForm.locked eq 'false'}">
													<c:if test="${meetingInviteForm.meeting.totAttendees ne '0'}">
														<input type="submit" name="save" value="Save" />
													</c:if>
												</c:when>
												<c:otherwise>
													<input type="submit" name="save" value="Save" title="Not allowed - meeting is locked" disabled="disabled"/>
												</c:otherwise>
											</c:choose>
										</td>
									</tr>
								</table>
							</tags:table></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td>
							<table width="100%" border="0">
								<tr>
									<c:choose>
										<c:when test="${meetingInviteForm.locked eq 'false'}">
											<c:choose>
												<c:when
													test="${meetingInviteForm.meeting.totAttendees eq '0'}">
													<td><input type="button" value="Change attendees"
														disabled="disabled" />
													<td>
													<td><input type="button" value="Add attendee"
														onclick="window.location.href ='addMeetingAttendee.form'" />
													</td>
													<td><input type="button"
														value="Send invitation emails" disabled="disabled" />
													</td>
												</c:when>
												<c:otherwise>
													<td><input type="button" value="Change attendees"
														onclick="window.location.href = 'changeMeetingAttendee.form'" />
													</td>
													<td><input type="button" value="Add attendee"
														onclick="window.location.href ='addMeetingAttendee.form'" />
													</td>
													<td><input type="button"
														value="Send invitation emails"
														onclick="window.location.href ='sendInvitationToAttendee.form'" />
													</td>
												</c:otherwise>
											</c:choose>
										</c:when>
										<c:otherwise>
											<td><input type="button" value="Change attendees"
												disabled="disabled" />
											</td>
											<td><input type="button" value="Add attendee"
												disabled="disabled" />
											</td>
											<td><input type="button" value="Send invitation emails"
												disabled="disabled" />
											</td>
										</c:otherwise>
									</c:choose>
									<td><input type="button" value="MDT lists"
										onclick="window.location.href ='mdtList.form'" /></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
					<td align="center">
						<br/>
				
						<br/>
				
						<div class="meetingNavigationPanel" style="width:300px;">
						
							<c:if test="${emdt.currentMeeting != null}">
								<a href="resumeMeeting.form">Return to Current Meeting <img src="../images/16x16/arrow_undo.png" /> </a> <br/>
							</c:if>
							 <br/>
							<a href="setMeetingFilter.form?filterId=0">Select Another Meeting <img src="../images/16x16/bullet_go.png" /> </a> 
							<br/>
							
						</div>
						<br/>
						
						
						<br/>
					</td>
					</tr>
				</table>
			</smvc:form>
		</td>
	</tr>
</table>
