<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/enrgise-html.tld" prefix="enrgise" %>

<html:html>
	<HEAD>
  <html:base/>
    <TITLE><bean:message key="WFL.title" /></TITLE>
     <jsp:include page="GenIncludes.jsp" flush="true" />  
</head>

<BODY onkeydown="hotKeys(event);" onload="doOnLoad();" scroll=no >
<html:form  action="WflConditionBaseAction" name="WflConditionForm" type="wenrgise.workflow.webtier.form.WflConditionForm">
<bean:define id="ParentForm" name="WflConditionForm" toScope="request" />
<jsp:include page="GenIconMenu.jsp" flush="true" />


<enrgise:errors/>
 <logic:messagesPresent message="true">
<Table>
    <html:messages id="message" message="true">
    <TR><TD>
      <bean:write name="message"/>
    </TD></TR>
    </html:messages>
</Table>
</logic:messagesPresent>
<table>

<TR height=30>
   <TD  colSpan=11 class=mainHeader height=10><bean:message key="wfl.wflConditions.heading"  /></TD>
</TR>
</TABLE>
  
<!--container table starts -->
<TABLE cellSpacing=0 cellPadding=0 border=0 >
 <TBODY>
  <TR>
    <TD>
     <!-- Body table Starts -->
      <TABLE cellSpacing=0 cellPadding=0 >
        <!--General Informationrmation Row Starts -->
       <tr>
        <td  class="subHeader" colspan=6 >General Information</td>
       </tr>
        <tr>
                    <TD colspan=6 bgColor=#4682b4><IMG height=1 src="../INCLUDES/IMAGES/pixel.gif" width=1 border=0></TD>
       </tr>
       <tr>
                   <td class="labelText"   ><bean:message key="wfl.WorkFlowConditions.docCode" /></td>
                   <td><html:text  property="documentCode" titleKey="wfl.WorkFlowConditions.docCode" alt="AN" maxlength="25" size="23" readonly="true" styleClass="required" /><enrgise:img name="WflConditionForm" height="16" align="center" styleClass="icon" src="../includes/images/lov.jpg" property="butDocumentCode" onclick="return ShowDocumentCode()" /></td>
                   <td class="labelText"   ><bean:message key="wfl.WorkFlowConditions.docDesc" /></td>
                   <td><html:text  property="documentDesc" titleKey="wfl.WorkFlowConditions.docDesc" alt="AN" maxlength="25" size="26" readonly="true" styleClass="optional"  /></td>
       </tr> 
     
      </table>
       
     
         <table cellspacing=0 cellpadding=0 border=0>
         <!-- Detail Information Row starts -->
 	     <TR>
       <TD colspan=6>
            <!-- Tab Table Starts -->
          <TABLE cellSpacing=0 cellPadding=0 >
                
            <tr>
             <enrgise:tab name="WflConditionForm" property="butCondDtls" styleClass="actTabText" disabledClass="lockedTab" src="../includes/images/formtab_r.gif" ><bean:message key="wfl.WorkFlowConditions.conditions" /></enrgise:tab>                
             <td width="85%">&nbsp;</td>
            </tr>        
              <TR>                
              <!-- Detail table Container starts -->
                <TD colSpan=11>
                 <TABLE cellSpacing=0 cellPadding=0 border=0 >
                  <TBODY>
                   <TR>
                    <TD >
                     <DIV id=divDtlTable style="height:220px">
                      <TABLE  border="0" cellSpacing=0 cellPadding=0 id="condition" >
                       <TBODY>
                        <tr>
                            <td class=tableHeader width="1%"><enrgise:checkbox name="WflConditionForm" property="selectAll"  disabledClass="locked" onclick="toggleCheckBox('checked')"  /></td>
                            <TD  class=tableHeader width="29%"><bean:message  key="wfl.WorkFlowConditions.docDtlDesc" /></TD>
                            <TD class=tableHeader width="70%"><bean:message  key="wfl.WorkFlowConditions.condExp" /></td>
                         </tr> 
                   
                      <logic:iterate id="condition" name="WflConditionForm" property="arylstDocAttrDetail"  indexId="idx" type="wenrgise.workflow.bean.WflDocMstConditionsDtlBean" >
                      <logic:notEqual name="condition" property="status" value="D" >         
                         <tr>
                             <td ><enrgise:checkbox property="checked" disabledClass="locked" name="WflConditionForm"  onclick='<%="boxClicked("+idx.toString()+")"%>' />
                             <html:hidden property="detailId" name="condition" /><html:hidden property="itemChecked" name="condition" /><html:hidden property="status" name="condition" /></td>
                             <td><enrgise:text formName="WflConditionForm" property="docTypeDtlDesc"  name="condition" titleKey="pm.pumMaintainPP.employeeNo" size="60" styleClass="required" disabledClass="required"  alt="N"  onchange='<%="doChangeDetail("+idx.toString()+")"%>' /></td>
                              <td><html:text  property="conditionExpression" readonly="true"  onmouseover="this.title=this.value" name="condition"  styleClass="required"  size="96" alt="A"  onchange='<%="doChangeDetail("+idx.toString()+")"%>' /><enrgise:button altKey="wenrgise.WorkFlowConditions.alterCond" name="condition"  onclick='<%="ShowConditions("+idx.toString()+")"%>'   property="butCond"  styleClass="bottomBarText">Alter Conditions</enrgise:button></td>
                          </tr>
                            </logic:notEqual>
                           <logic:equal name="condition" property="status" value="D" >         
                         <tr>
                             <td ><enrgise:checkbox property="checked" disabledClass="locked" name="WflConditionForm"  onclick='<%="boxClicked("+idx.toString()+")"%>' />
                             <html:hidden property="detailId" name="condition" /><html:hidden property="itemChecked" name="condition" /><html:hidden property="status" name="condition" /></td>
                             <td><html:text  property="docTypeDtlDesc" name="condition" readonly="true" titleKey="pm.pumMaintainPP.employeeNo" size="60" styleClass="deletedRow"   alt="N"  onchange='<%="doChangeDetail("+idx.toString()+")"%>' /></td>
                              <td><html:text property="conditionExpression"  onmouseover="this.title=this.value" readonly="true" name="condition"  styleClass="deletedRow"  size="96" alt="A"  onchange='<%="doChangeDetail("+idx.toString()+")"%>' /><enrgise:button altKey="wenrgise.WorkFlowConditions.alterCond" name="condition" onclick='<%="ShowConditions("+idx.toString()+")"%>'   property="butCond"  styleClass="bottomBarText">Alter Conditions</enrgise:button></td>
                          </tr>
                     </logic:equal>
                       </logic:iterate>
                       </TBODY>
                      </TABLE>
                     </DIV>
                    </TD>
                   </TR>
                   <tr>
                      <td>	
            <!--Buttons-->     <jsp:include page="GenDetailMenu.jsp" />
                      </TD>                          
                  </tr>
                </tbody>
               </TABLE>
              </td>
             </tr>
           </TABLE>
          </td>
         </tr>
                <!-- Tab Table Ends -->

        <!-- Bottom Blue Bar -->
       <TR>
            <td>
              <TABLE  cellspacing="0" cellpadding="0" border=0>
                    <tr height="20">
                        <td colspan="5" bgColor=#4682b4></td>
                        <td align=right bgColor=#4682b4><img src="../includes/images/man.jpg" ></td>

                   </TR>
                </table>
            </td>
          </tr>
         

	  
<!-- Container Table Ending Columns Starts-->
       </TD>    
     </TR>
   </TBODY>
 </TABLE>

<!-- Container Table Ends -->
<!-- These four hidden fields must be present in pages where there is a detail part -->
<html:hidden name="WflConditionForm"  property="screenName" value="WflWorkflowConditions" />
<html:hidden name="WflConditionForm"  property="forwardedPage" />
<html:hidden property="screenMode" name="WflConditionForm"  />
<html:hidden property="positionRequested" name="WflConditionForm" />
<html:hidden property="userPageRequested" name="WflConditionForm" />
<html:hidden property="userPositionRequested" name="WflConditionForm" />
<html:hidden property="pageRequested" name="WflConditionForm" />
<html:hidden property="headerDataChanged" name="WflConditionForm" value="false" />
<html:hidden property="detailDataChanged" name="WflConditionForm" />
<html:hidden property="lovKey" name="WflConditionForm"  />
<html:hidden property="txtSearchFields" name="WflConditionForm"  />
<html:hidden property="txtDisplayFields" name="WflConditionForm"  />
<html:hidden property="index" name="WflConditionForm"  />
<html:hidden property="headerPrimaryKey" name="WflConditionForm"  />
<html:hidden property="firstLoad" name="WflConditionForm"  />
<html:hidden property="docId" name="WflConditionForm"  />
<html:hidden property="buttonName" name="WflConditionForm"  />
<html:hidden property="formStatus" name="WflConditionForm"   />
<input type="hidden" name="queryParam" >
<html:hidden property="txtIndex" name="WflConditionForm"  />

<!-- Hidden fields end -->
</html:form>
</body>
</html:html>
<script>
function doQueryMode()
{

  return "WflCondQueryModeAction.do";
}

function doInsertMode()
{

  return "WflCondNewModeAction.do";
}


function doExecute()
{

  return "WflCondGetHeaderAction.do";
}

function doSave()
{
   return "WflCondSaveAction.do";
}


function doDelete()
{

  return "WflCondDeleteAction.do";
  
}

function doRefresh()
{
  
  return "WflCondRefreshAction.do";
  
}

function doPrevHeader()
{
  return "WflCondGetNextHeaderAction.do"; 
}

function doNextHeader()
{
  return "WflCondGetNextHeaderAction.do"; 
}

function doJumpHeader()
{
  return "WflCondGetNextHeaderAction.do"; 
}

function doGetDetail()
{

  return "WflCondGetDetailAction.do";
}

function doAddRow()
{

  return "WflCondAddRowAction.do"; 
}

function doDelRow()
{
 return "WflCondDeleteRowAction.do";  
}

function doGetDetailTableName()
{
  return "condition";
}

function doPrevDetail()
{

  return "WflCondGetDetailPageAction.do";  
}

function doNextDetail()
{

  return "WflCondGetDetailPageAction.do";
}

function doJumpDetail()
{
  return  "WflCondGetDetailPageAction.do"; 
}

function doValidate()
{
    return "WflCondValidateAction.do"; 
 }
function doOnLoad()
{
  
   if(document.forms[0].firstLoad.value=="")
   {
       document.forms[0].submit();
    }
 }
 function ShowDocumentCode()
  {
          document.forms[0].lovKey.value = "DocCode" + document.forms[0].screenName.value + document.forms[0].screenMode.value;
          document.forms[0].txtSearchFields.value = "WFL.WFLDocAttrDtl.documentCode";
          document.forms[0].txtDisplayFields.value = "headerPrimaryKey,documentCode,documentDesc";
          showLov('<html:rewrite page="/hrms/jsp/CommonSearchScreen.jsp" />','WflConditionForm');
          return true;
         
  }
function doOnChangeLov(lovName)
{
  if(lovName=="DocCodeWflWorkflowConditionsQ")
  {
    doBaseValidate();
   }
}
function ShowConditions(i)
{
  document.forms[0].index.value=i;
  window.open('<html:rewrite page="/hrms/jsp/WflGenConditions.jsp" />');  
}
function boxClicked(val)
{    
    if(document.getElementsByName("checked")[val].checked)
    {      
      document.getElementsByName("itemChecked")[val].value = "Y";      
    }
    else
    {     
      document.getElementsByName("itemChecked")[val].value = "N";     
    }      
}
</script>