<%@ include file="/includes.jsp" %>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form" %>

<smvc:form name="imageTransferLog" modelAttribute="imageTransLogDTO" method="post" onsubmit = "return submitTheForm();" action="../referrals/imageTransferLog.form">
<input type="hidden" name="redirectParams" value="<c:out value="${requestScope['javax.servlet.forward.query_string']}" />" />
<input type="hidden" id="accessionNum" name="accessionNum" value='<%=request.getAttribute("accessionNum")%>'/> 
<input type="hidden" id="eventDate" name="eventDate" value="<c:out value="${imageTransLogDTO.eventDates}"/>"/> 
  	<div>
		&nbsp;
	</div>
	&nbsp;
	<div class="bodySection2" style="width: 80%;">&nbsp;
	
	<c:set var="accessionNum" value='<%=request.getAttribute("accessionNum")%>'/>
	     <div class="rowDivSubPage" style="width:100%">
				<div>
					<div class="leftDiv">
						<b>Image Transfer Tracking Log</b>
					</div>
					<div class="rightDiv">
						<img src="../referrals/images/back.jpg"/>
						<a title="Click here to go back to View Images" style="text-decoration: underline" href="../referrals/imgStatusTracking.form">
					    Back to View Images
				       </a>&nbsp;
			       </div>
			</div>
				</div>
				<div class="rowDivSmall">
					&nbsp;
				</div>

				
				<c:choose>
				
				    <c:when test="${(fn:length(imageTransLogDTO.eventDates) gt 0) and (fn:length(imageTransLogDTO.eventDescriptions) gt 0)}">
					    <div>
							Image transfer log for Accession Number:
							<b><c:if test="${accessionNum ne null}"><c:out value="${accessionNum}"/></c:if></b>
						</div>
						<div>
							&nbsp;
						</div>
						<table cellpadding="2">
							<tr>
								<th>Date and time</th><th align="left">User</th><th align="left">Method</th><th align="left">Message</th>
							</tr>
							<c:forEach items="${imageTransLogDTO.eventDates}" var="eventDates" varStatus="s">
								<tr>
									<td valign="top"><c:out value="${eventDates}"/> -</td><td valign="top"><c:out value="${imageTransLogDTO.userNames[s.count-1]}"/> &nbsp;</td><td valign="top"><c:out value="${imageTransLogDTO.transferMethods[s.count-1]}"/></td><td valign="top">- <c:out value="${imageTransLogDTO.eventDescriptions[s.count-1]}"/> <c:if test="${!empty imageTransLogDTO.errorMessages[s.count-1]}">(Error: <c:out value="${imageTransLogDTO.errorMessages[s.count-1]}"/>)</c:if> </td>
								</tr>
							</c:forEach>
						</table>
						
				    </c:when>
					<c:otherwise>
						   <div class="message" align="center">
							   <img src="../images/16x16/information.png" alt="i" />	
						      <b>No log details available.</b>
						   </div>
					</c:otherwise>
				</c:choose>
				
				<div>
				    &nbsp;
				</div>
					
	      
	</div>
</smvc:form>