<%@ 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 confirmFormSubmission(){
	var res=confirm("Please confirm that you want to send the emails");
	return res;
}
</script>
<table width="100%">
	<tr>
		<td valign="top" align="center"><br /> 
				<smvc:form id="sendInviteForm"
				modelAttribute="sendInvitationForm" onsubmit="return confirmFormSubmission();" action="../meetings/sendInvitationToAttendee.form">
				<input type="hidden" name="redirectParams" value="<c:out value="${requestScope['javax.servlet.forward.query_string']}"/>" />
				<smvc:hidden path="action" id="actionRequired"/>
				
				<table>
					<tr>
						<td align="center"><br /> <c:if test="${message ne null}">
							<span class="message"><c:out value="${message}"/></span>
							</c:if> <c:if test="${error ne null}">
								<table width="100%" cellpadding="4"
									style="border: 2px Blue solid">
									<tr>
										<td><img src="../images/16x16/error.png" alt="!"
											border="0" />
										</td>
										<td>
											<div class="error"><c:out value="${error}"/></div> <br />
										</td>
									</tr>

								</table>
							</c:if></td>
					</tr>
				</table>
				<br />
				<table cellpadding="0" cellspacing="0" width="400">
					<tr>
						<td><tags:dialogBox title="Invite Attendees">
								<table>
									<tr>
										<td colspan="8">&nbsp;</td>
									</tr>
								
									<tr>
										<td class="label" align="center">Send<br/>Invitation?&nbsp;&nbsp;</td>
										<td class="label"
											title="Enter a system username to have this meeting appear in their diary">Attendee
											name</td>
										<td class="label"
											title="Click here to populate System user details in the Attendee record"></td>
										<td class="label"
											title="Enter if you want to invite this attendee via an e-mail">E-Mail</td>
										<td class="label"
											title="Optional: Enter if you want to invite this attendee via telephone">Telephone</td>
										<td class="label"
											title="Optional: Enter if you want to invite this attendee via fax">Fax</td>
										<td class="label"
											title="Optional: Enter if you want to invite this attendee via letter">Letter</td>
										<td class="label" title="Which invitation method to use">Use</td>
									</tr>
									<c:forEach var="attendee"
										items="${sendInvitationForm.meeting.attendees}" varStatus="s">
										<tr>
											<td class="input" align="center"
												title="Check to email attendee"><smvc:checkbox
													path="selected" value="${attendee.id}" cssClass="allNonInvert" /></td>
											<td class="input"
												title="Attendee name or username">
												<smvc:hidden path="meeting.attendees[${s.index}].user.username" />
												<smvc:input path="meeting.attendees[${s.index}].user.name" />
											</td>
											<td></td>
											<td class="input"
												title="Enter if you want to invite this attendee via an e-mail">
												<smvc:input path="meeting.attendees[${s.index}].user.email"
													size="12" />
											</td>
											<td class="input"><smvc:input
													path="meeting.attendees[${s.index}].telephone" size="12" />
											</td>
											<td class="input"><smvc:input
													path="meeting.attendees[${s.index}].fax" size="12" /></td>
											<td class="input"><smvc:input
													path="meeting.attendees[${s.index}].letter" size="10" /></td>
											<td class="input"><smvc:select
													path="meeting.attendees[${s.index}].inviteMethod">
													<smvc:option value="email"> E-Mail</smvc:option>
													<smvc:option value="telephone"> Tel.</smvc:option>
													<smvc:option value="fax"> Fax</smvc:option>
													<smvc:option value="letter"> Letter</smvc:option>
												</smvc:select>
											</td>
										</tr>
									</c:forEach>
									<tr>
										<td align="center">
											<a href="javascript:select('all')">all</a> <br/> <a href="javascript:select('none')">none</a> <br/> <a href="javascript:select('invert')">invert</a>
										</td>
										<td colspan="7"></td>
									</tr>
									
								</table>
							</tags:dialogBox>
						</td>
					</tr>
					<tr>
						<td colspan="8">&nbsp;</td>
					</tr>
					<tr>
						<td colspan="8">&nbsp;</td>
					</tr>
					<tr>
						<td><tags:dialogBox title="Email settings">
								<table cellpadding="6">
									<tr>
										<td>Meeting organiser email address (replies go here)</td>
										<td><smvc:input path="meeting.organiserEmailAddress" 
												size="60" cssStyle="width: auto;"/></td>
									</tr>
									<c:if
										test="${!('false' eq webapp.properties['emdt.meeting.invitation.includePatientDetails'])}">
										<tr>
											<td>Include meeting overview with link</td>
											<td><smvc:checkbox path="meeting.cbOveriewWithLink" disabled="yes"/>
											</td>
										</tr>
										 <!-- 
										 Don't show these for Spire
										<tr>
											<td>Include a patient summary</td>
											<td><smvc:checkbox path="meeting.cbEmailSummaryId"   cssStyle="display: none;"/>
												&nbsp;&nbsp; <smvc:select path="meeting.emailSummaryId"  cssStyle="display: none;">
													<smvc:option value="">-- no summary selected --</smvc:option>
													<c:forEach var="summary" items="${emdt.patientSummaries}">
														<smvc:option value="${summary.id}"><c:out value="${summary.title}"/></smvc:option>
													</c:forEach>
												</smvc:select>
											</td>
										</tr>
										<tr>
											<td>Attach meeting summary PDF</td>
											<td><smvc:checkbox path="meeting.cbAttachPDF"  cssStyle="display: none;" />
											</td>
										</tr>
										<tr>
											<td>Attach a File</td>
											<td><smvc:checkbox path="meeting.cbAttachFile"  cssStyle="display: none;"/>
											</td>
										</tr>
										<tr>
											<td colspan="2"><input type="file" onchange="setFileSize(this);" name="file" size="45" style="display: none;"   />
										</tr>
										  -->
										 
									</c:if>
								</table>
							</tags:dialogBox>
						</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td align="right">
							<input type="button" value="Cancel" onclick="javascript:window.location.href=('viewMeetingAttendee.form');" />
							<c:if test="${meetingAttendeesForm.meeting.totAttendees ne '0'}">&nbsp;&nbsp;&nbsp;
               				 <input type="submit" value="Save and Invite" onclick="setAction('Save and Invite');" />
							</c:if>
						</td>
					</tr>
				</table>
			</smvc:form></td>
	</tr>
</table>