<%@ 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" %> 

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShell">
<html-el:form action="/batchProcess" 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="label.batchProcessManagement.mainHeader"/></td>
              </tr>
            </table>
          </td>
        </tr>
          <td>
    	    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="moduleShellTableBody">
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td class="moduleLabel" style="text-align: left; padding-left: 20" nowrap><bean-el:message key="message.batchProcessManagement.instructions"/></td>
              </tr>
			  <tr>
                <td>&nbsp;</td>
              </tr>              
	
            <c:set var="rowColor" value="darkValue" />            
            
			<tr><td class="value">
			<table summary="Table for Managing Batch Processes">
				<thead>
					<tr>
						<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.batchProcessManagement.header.id"/></th>
						<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.batchProcessManagement.header.description"/></th>
						<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.batchProcessManagement.header.nextFireTime"/></th>
						<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.batchProcessManagement.header.status"/></th>
						<th scope="col" style="text-align:left; padding: 7 0 7 5" class="darkLabel"><bean-el:message key="label.batchProcessManagement.header.actions"/></th>																		
					</tr>
				</thead>
				<tbody>
					<c:forEach var="job" items="${jobs}">			
						<%  			
							java.util.HashMap params = new java.util.HashMap();
							params.put("jobName", (( gov.va.med.fw.batchprocess.BatchProcessDetailStatus) 
								pageContext.getAttribute("job")).getBatchProcessDetail().getJobName());
							params.put("jobGroup", (( gov.va.med.fw.batchprocess.BatchProcessDetailStatus) 
								pageContext.getAttribute("job")).getBatchProcessDetail().getGroupName());								
							pageContext.setAttribute("linkParams",params);
						%>
					
						<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="20%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
							<esrcore:displayValue name="job" property="batchProcessDetail.jobName"/>							
						</td>
						<td width="20%" align="left" valign="top" class="<c:out value="${rowColor}"/>">
							<esrcore:displayValue name="job" property="batchProcessDetail.jobDescription"/>
						</td>
						<td width="20%" align="left" valign="top" class="<c:out value="${rowColor}"/>">
							<esrcore:displayDate name="job" dateProperty="triggerStatus.nextFireTime" displayTime="true"/>
						</td>	
						<td width="20%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
							<c:choose>
								<c:when test="${job.active}">
									<esrcore:displayValue name="job" property="triggerStatus.status"/>								
								</c:when>
								<c:otherwise>
									<span style="color:#FF0000">
										<esrcore:displayValue name="job" property="triggerStatus.status"/>
									</span>										
								</c:otherwise>
							</c:choose>
						</td>					
						<td width="20%" align="left" valign="top" class="<c:out value="${rowColor}"/>" nowrap>
							
							<c:if test="${job.batchProcessDetail.executableFromManagementPage}">
								<fw:link action="batchProcess.do?methodName=Execute" name="linkParams">
									<bean-el:message key="link.batchProcessManagement.execute"/>
								</fw:link> | 
								<fw:link action="batchProcess.do?methodName=Execute with Args" name="linkParams">
									<bean-el:message key="link.batchProcessManagement.viewExecuteWithArgs"/>
								</fw:link>
							</c:if>
							<c:if test="${job.batchProcessDetail.executableFromManagementPage == false}">
									<bean-el:message key="link.batchProcessManagement.execute"/>
								 			| 
									<bean-el:message key="link.batchProcessManagement.viewExecuteWithArgs"/>
							</c:if> 
											|  
							<fw:link action="batchProcess.do?methodName=Config" name="linkParams">
								<bean-el:message key="link.batchProcessManagement.viewConfig"/>
							</fw:link> | 
							<fw:link action="batchProcess.do?methodName=History" name="linkParams">
								<bean-el:message key="link.batchProcessManagement.history"/>
							</fw:link>
						</td>						
					</tr>		
				</c:forEach>
			</tbody>
			</table>
			</td></tr>
			  
			  <tr>
                <td>&nbsp;</td>
              </tr>                            
              <tr>
	            <td>
					<table border="0" align="center" cellspacing="3" cellpadding="0">
						<tr>
							<td>
								<img alt=""  src="../images/buttonEndLeft.gif"/><html-el:submit property="methodName" 
									style="width:90; vertical-align: top;" styleClass="buttonText">
								<bean-el:message key="button.batchProcessManagement.pauseAll"/>
								</html-el:submit><img alt=""  src="../images/buttonEndRight.gif"/>
							</td>							
							<td>
								<img alt=""  src="../images/buttonEndLeft.gif"/><html-el:submit property="methodName" 
									style="width:90; vertical-align: top;" styleClass="buttonText">
								<bean-el:message key="button.batchProcessManagement.resumeAll"/>
								</html-el:submit><img alt=""  src="../images/buttonEndRight.gif"/>
							</td>							
						</tr>							
					</table>
                </td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</html-el:form>
</table>

