<%@ taglib uri="/tags/struts-bean-el" prefix="bean-el" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html-el" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/tags/esr-core" prefix="esrcore" %>
<%@ taglib uri="/tags/fw" prefix="fw" %> 

<script language="javascript">

function deleteSetConfirm()
{
  var confirmMessage = "Do you really want to cancel this Handbook batch request?";
  return confirm(confirmMessage);
}
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShell">
<html-el:form action="/handBookBatchRequest" method="post">
  <%@ include file="/admin/csrfgentoken.jsp" %>
  <tr>
    <td>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTable">
        <tr>
          <td>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTableHead" >
              <tr>
	            <td class="moduleBlueBox">&nbsp;</td>
                <td class="moduleHeadline" nowrap><bean-el:message key="handBookBatchRequest.text.title"/></td>
                <td width="100%"></td>
                 <td nowrap class="moduleBlueLink" style="padding: 1px 8px 1px 8px"><fw:link action="/handBookBatchRequest.do?methodName=displayNew" module="/admin">
                 <bean-el:message key="text.handBookBatchRequestNew"/></fw:link></td>
              </tr>
            </table>
          </td>
        </tr>
 
        
          <tr>
          <td>
    	    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="moduleShellTableBody">
              <tr>
                <td>&nbsp;</td>
              </tr>
              <c:choose>
				<c:when test="${handBookBatchRequests == null}">
					  <tr>
						<td class="moduleLabel" style="text-align: left; padding-left: 20"><bean-el:message key="message.handBookBatchRequests.none"/></td>
					  </tr>
				</c:when>
				<c:otherwise>					
					<tr>
						<td class="moduleLabel" style="text-align: left; padding-left: 20"><bean-el:message key="message.handBookBatchRequests.instructions"/></td>
					</tr>
					<tr>
						<td class="moduleLabel" style="text-align: left; padding-left: 20"><bean-el:message key="message.handBookBatchRequests.note"/></td>
					</tr>
	 
					<tr><td>&nbsp;</td></tr>				
				            
	
            <c:set var="rowColor" value="darkValue" />            
            
			<tr><td class="value">
			<table summary="Table for Historical Hand Book Requests" width="100%">
				<thead>
					<tr>
 	 					<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.handBookBatchRequests.header.batchReleaseDate"/></th> 
					    <th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.handBookBatchRequests.header.requestNote"/></th>
					    <th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.handBookBatchRequests.header.handBookReleaseControl"/></th>
						<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.handBookBatchRequests.header.BatchRequestPriortyGroups"/></th>
						<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.handBookBatchRequests.header.maxPerJobNumber"/></th>
						<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.handBookBatchRequests.header.batchReleaseSize"/></th>																		
				        <th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.handBookBatchRequests.header.handBookRequestStatus"/></th>
						<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.handBookBatchRequests.header.requestCreatedDate"/></th>
				        <th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.handBookBatchRequests.header.handBookRequestStatusChangeDate"/></th>
						<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.handBookBatchRequests.header.Cancel"/></th>
					</tr>
				</thead>
    	      <tbody>
    	     		<c:set var="rowColor" value="darkValue" />
							<c:forEach var="handBookBatchRequest" items="${handBookBatchRequests}">
							   
                   				  <c:choose>
									<c:when test="${rowColor == 'darkValue'}">
										<c:set var="rowColor" value="value" />
									</c:when>
									<c:otherwise>
										<c:set var="rowColor" value="darkValue" />
									</c:otherwise>
								</c:choose>
				
								 <tr>		
										<td scope="row" width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
										<c:set var="cancelledStatusCode" value="3" />
										<c:set var="releaseDateStr"><esrcore:displayValue name="handBookBatchRequest" property="batchReleaseDate"/></c:set>
										<c:if
													test="${handBookBatchRequest.handBookRequestStatus.code!=cancelledStatusCode}">										
											<fw:link action="handBookBatchRequest.do?methodName=displayStatistics" paramId="releaseDate" paramName="releaseDateStr">
												<esrcore:displayValue name="handBookBatchRequest" property="batchReleaseDate"/>	
											</fw:link>
										</c:if>
										<c:if
												test="${handBookBatchRequest.handBookRequestStatus.code==cancelledStatusCode}">										
												<esrcore:displayValue name="handBookBatchRequest" property="batchReleaseDate"/>	
										</c:if>
										</td>
										
	
					
										<td width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" >
											<esrcore:displayValue name="handBookBatchRequest" property="requestNote" />
										</td>
										<td width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
											<esrcore:displayValue name="handBookBatchRequest" property="handBookReleaseControl" />
										</td>
										<td width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" >
										
										<c:forEach var="BatchRequestPriortyGroup" items="${handBookBatchRequest.batchRequestPriortyGroup}">
							
											 <table>
										   <tr>
										   <td width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap> 
												   <esrcore:displayValue name="BatchRequestPriortyGroup" property="priorityGroup" />
												   <esrcore:displayValue name="BatchRequestPriortyGroup" property="prioritySubGroup" />
											</td>
											</tr>
											</table>
										   
													</c:forEach>
										</td>
									
										<td width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
											<esrcore:displayValue name="handBookBatchRequest" property="maxPerJobNumber"/>							
										</td>

										<td width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
											<esrcore:displayValue name="handBookBatchRequest" property="batchReleaseSize"/>							
										</td>
										<td width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
											<esrcore:displayValue name="handBookBatchRequest" property="handBookRequestStatus" />
										</td>
										
										<td width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
											<esrcore:displayValue name="handBookBatchRequest" property="createdOn" />
										</td>
										<td width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
											<esrcore:displayValue name="handBookBatchRequest" property="modifiedOn" />
										</td>
										<c:set var="newStatusCode"
											value="1" />
										<td width="7%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
										  <c:if
													test="${handBookBatchRequest.handBookRequestStatus.code==newStatusCode}">
											<fw:link onclick="return(deleteSetConfirm()); return false" action="handBookBatchRequest.do?methodName=cancelBatch&amp;batchRequestId=${handBookBatchRequest.entityKey.keyValue}">
												Cancel					
											</fw:link>
											</c:if>
										</td>
									</tr>										
								</c:forEach>
				</tbody>
			 </table>
			 
			 
			</td></tr>
			  
			  </c:otherwise>
			</c:choose>
			  <tr>
                <td>&nbsp;</td>
              </tr>                            
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</html-el:form>
</table>

