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

<smvc:form name="imageStatus" method="post" onsubmit = "return submitTheForm();">
<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")%>'/> 
  	<div>
		&nbsp;
	</div>
	&nbsp;
	<div class="bodySection1">&nbsp;
	
		<c:if test="${requestScope.successMsg != null and fn:length(requestScope.successMsg) != 0}">
			<div class="message"><img src="../images/16x16/information.png" alt="i" />&nbsp;
			<c:out value="${requestScope.successMsg}"/><br/><br/>
			</div>
		</c:if>
	
		<c:if test="${requestScope.errorMsg != null and fn:length(requestScope.errorMsg) != 0}">
			<div class="error"><img
				src="../images/16x16/error.png" alt="i" />&nbsp;
			<c:out value="${requestScope.errorMsg}"/><br/><br/>
			</div>
		</c:if>
	<c:set var="accessionNum" value='<%=request.getAttribute("accessionNum")%>'/>
	     <div class="rowDivSubPage">
				<div>
					<b>Change Image Status</b>
				</div>
				<div class="rowDivSmall">
					Use this page to indicate that an image study has arrived and is available in PACS.<br/>
					<ul>
					<li>Image studies sent via bbRad in 'automatic mode' will automatically have this status updated and should not need to be changed, unless you need to override this setting.
					<li>For images sent via manual transfer methods such as DVD, you may need to change this manually to indicate when the image has arrived in PACS.
					</ul>
				
				</div>
				<div>
					Image Accession Number:
					<c:if test="${accessionNum ne null}"><c:out value="${accessionNum}"/></c:if>
				&nbsp;&nbsp;
				</div>
				<div>
					&nbsp;
				</div>
				<c:set var="status1" value='<%=request.getAttribute("selectedStatus")%>'/>
				<div>
					Image Status:
						<c:choose>
							<c:when test="${accessionNum ne null}">
								<select name="selectedStatus" id="selectedStatus">	
							</c:when>
							<c:otherwise>
								<select name="selectedStatus" id="selectedStatus" disabled="disabled">
							</c:otherwise>
						</c:choose>
					
							<c:if test="${0 eq status1}">
								<option value="0" selected="selected">Image requested</option>	
							</c:if>
							<c:if test="${0 ne status1}">
								<option value="0">Image requested</option>	
							</c:if>
							<c:if test="${1 eq status1}">
								<option value="1" selected="selected">Image sent, transfer in progress</option>	
							</c:if>
							<c:if test="${1 ne status1}">
								<option value="1">Image sent, transfer in progress</option>
							</c:if>
							<c:if test="${2 eq status1}">
								<option value="2" selected="selected">Image has arrived - transfer completed</option>
							</c:if>
							<c:if test="${2 ne status1}">
								<option value="2">Image has arrived - transfer completed</option>
							</c:if>
							<c:if test="${3 eq status1}">
								<option value="3" selected="selected">Image transfer cancelled</option>
							</c:if>
							<c:if test="${3 ne status1}">
								<option value="3">Image transfer cancelled</option>
							</c:if>
							<c:if test="${4 eq status1}">
								<option value="4" selected="selected">Image transfer failed</option>
							</c:if>
							<c:if test="${4 ne status1}">
								<option value="4">Image transfer failed</option>
							</c:if>
							
						</select>
				</div>
				<div>
						&nbsp;
				</div>
				<div class="rowDivSmall">&nbsp;</div>	
				<div class="updateButtonHolderOn">
					<c:choose>
							<c:when test="${accessionNum ne null}">
								<input type="submit" value="Save changes"/>
							</c:when>
							<c:otherwise>
								<input type="submit" value="Save changes" disabled="disabled"/>
							</c:otherwise>
						</c:choose>
				
				<%--
				check this
				<input type="reset" value="Back" onclick="document.location.href ='imgStatusTracking.form'"/>
				--%>
				<input type="reset" value="Back" onclick="document.location.href ='../referrals/consultationNote.form?formName=<c:out value="${consultationNoteForm.view.formName}"/>"/>&filterFormId=<c:out value="${consultationNoteForm.view.form.id}"/>'"/>
					
				</div>
	      </div>
	</div>
</smvc:form>