<%@ 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="hrm.title" /></TITLE>
  <jsp:include page="GenIncludes.jsp" />
  <meta http-equiv="pragma" content="no-cache" >
</head>

<BODY onload="doBaseOnLoad()"  scroll="auto">
<html:form  action="HrmMyWorkflowBaseAction" name="HrmMyWorkflowForm" type="wenrgise.hrms.webtier.form.HrmMyWorkflowForm" >
<bean:define id="ParentForm" name="HrmMyWorkflowForm" toScope="request" />
<jsp:include page="GenMenu.jsp" flush="true" />
<bean:define id="left" name="ParentForm" property="positionRequested"/>
<bean:define id="right" name="ParentForm" property="totalCount"/>
<table cellSpacing=0 bgColor=#bdd0ef>
<tr height=27>
  <td colSpan=11></td>
</tr>
  <TR > 
    <TD ><img name="ParentForm" property="butQuery" alt="Query (Ctrl+Q)" class="icon" src="../includes/images/query.jpg" onclick="doBaseQueryMode()" /><img name="ParentForm" property="butInsert" alt="Insert (Alt+N)" src="../includes/images/insert_dis.jpg"  ></TD>
    <TD width="2%"></TD>
    <TD ><enrgise:img name="ParentForm" property="butExecute" onmouseover='this.src="../includes/images/execute_act.jpg"' onmouseout='this.src="../includes/images/execute.jpg"' alt="Execute (Ctrl+U)" src="../includes/images/execute.jpg" onclick="doBaseExecute()" /><enrgise:img name="ParentForm" property="butSave" onmouseover='this.src="../includes/images/save_act.jpg"' onmouseout='this.src="../includes/images/save.jpg"' alt="Save (Ctrl+S)" src="../includes/images/save.jpg" onclick="doBaseSave()" />
    <img name="ParentForm" property="butDelete" src="../includes/images/delete_dis.jpg" ><enrgise:img name="ParentForm" property="butRefresh" onmouseover='this.src="../includes/images/refresh_act.jpg"' onmouseout='this.src="../includes/images/refresh.jpg"' alt="Refresh (Ctrl+R)"  src="../includes/images/refresh.jpg" onclick="doBaseRefresh()" />
    <img name="ParentForm" property="butPrint" src="../includes/images/print_dis.jpg" ></TD>
    <TD width="2%" bgColor=#bdd0ef></TD>
    <TD><enrgise:img name="ParentForm" property="butExit" onmouseover='this.src="../includes/images/exit_act.jpg"' onmouseout='this.src="../includes/images/exit.jpg"' alt="Exit (Alt+X)"  src="../includes/images/exit.jpg"   onclick="doBaseExit()" />
    <enrgise:img name="ParentForm" property="butHelp" onmouseover='this.src="../includes/images/help_act.jpg"' onmouseout='this.src="../includes/images/help.jpg"' alt="Help (Ctrl+?)" src="../includes/images/help.jpg" onclick="doBaseHelp()" /></TD>
    <TD width="50%"></TD>
    <TD ><enrgise:img name="ParentForm" property="butPrevHeader" src='../includes/images/butn_prev.jpg' onmouseover='this.src="../includes/images/butn_prev_act.jpg"' onmouseout='this.src="../includes/images/butn_prev.jpg"' alt="Butn_prev (Ctrl+<)" onclick="doBasePrevHeader()" /></td>
    <td class=dtlNavText><bean:write  name="left" /> of 
    <bean:write name="right" /></td>
    <td align=right><enrgise:img name="ParentForm" property="butNextHeader" src="../includes/images/butn_next.jpg" onmouseover='this.src="../includes/images/butn_next_act.jpg"' onmouseout='this.src="../includes/images/butn_next.jpg"' alt="Butn_next (Ctrl+>)" onclick="doBaseNextHeader()" /></td>
    <td align=right><enrgise:text property="newPositionRequested" size="1"  maxlength="3" onkeydown="isInteger(event)" title="wenrgise.common.jumpDetail" alt="N" disabledClass="locked" styleClass="optional" /></td>
    <td ><enrgise:img name="ParentForm" property="butJumpHeader" alt="Go (Ctrl+G)" src="../includes/images/go.jpg" onmouseover='this.src="../includes/images/go_act.jpg"' onmouseout='this.src="../includes/images/go.jpg"' onclick="doBaseJumpHeader()" /></td>
    <td > </td>
    
</TR>
</table>
<table>
<tr>
  <td colspan="11" class="userText"></td>
</tr>
<enrgise:checkSession/>
</TABLE>

<!-- Icon Menu -->
<!--Top Most Blue Bar-->
<TABLE cellSpacing=0 bgColor=#bdd0ef>
    <tr>
        <TD  colSpan=12 class=mainHeader height=10><bean:message key="hrm.HrmMyWorkflow.Header" /></TD>
    </TR>
      
</TABLE>
<!--//  Display Errors -->
<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>
<!--//  Display Errors --> 

<TABLE cellSpacing=0 cellPadding=0 border=0 >
    <TR>
        <TD>
        
        <TABLE cellSpacing=0 cellPadding=0 >
         <TR>
            <TD class=subHeader colspan=6><bean:message key="hrm.HrmMyWorkflow.WorkflowMaster" /></TD>
         </TR>
         <TR>
            <TD colspan=8 bgColor=#4682b4><IMG height=1 src="../includes/images/pixel.gif" width=1 border=0></TD>
         </TR>      
        <!-- Header Starts -->
        
               <!--td class="labelText"><bean:message key="hrm.HrmMyWorkflow.id" /></td>
               <td><enrgise:text  property="id" name="HrmMyWorkflowForm" titleKey="hrm.HrmMyWorkflow.id" maxlength="20" size="23" styleClass="required" disabledClass="locked"  onchange="doBaseValidate()" /><enrgise:img name="HrmMyWorkflowForm" height="16" align="center" src="../includes/images/lov.jpg"   property="butId" onclick="return ShowWorkflwCode();" /></td> 
               <td class="labelText"><bean:message key="hrm.HrmMyWorkflow.requestType" /> </td>
                <td><enrgise:text  property="requestType" name="HrmMyWorkflowForm"  titleKey="hrm.HrmMyWorkflow.requestType" maxlength="40" size="26" styleClass="locked" disabledClass="locked" onchange="doChangeHeader();" /></td> -->
                <td class="labelText"><bean:message key="hrm.HrmMyWorkflow.id" /></td>
                <td><html:select property="id" styleClass="required" name="HrmMyWorkflowForm"  onchange="doChangeHeader();doBaseValidate();">
                                                  <html:option value="" >All</html:option>
                                                  <html:option value="1" >Leave</html:option>
                                                  </html:select></td>
               <td class="labelText"><bean:message key="hrm.HrmMyWorkflow.workflowType" /></td>
               <td><enrgise:select property="workflowType" titleKey="HrmMyWorkflow.workflowType"  styleClass="required" disabledClass="locked" onchange="doBaseValidate()"  >
                    <enrgise:option value="W" ><bean:message   key="hrm.HrmMyWorkflow.worklist" /></enrgise:option>
                    <enrgise:option value="I" ><bean:message   key="hrm.HrmMyWorkflow.intimation" /></enrgise:option> 
                   </enrgise:select>
               </td> 
                 
                <td class="labelText"><bean:message key="hrm.HrmMyWorkflow.txtStatus" /></td>
                 <td><enrgise:select property="txtStatus" titleKey="hrm.HrmMyWorkflow.txtStatus"  styleClass="required" disabledClass="locked" onchange="doBaseValidate()"  >
                      <enrgise:option value="P" ><bean:message   key="hrm.HrmMyWorkflow.pending" /></enrgise:option>      
                      <enrgise:option value="A" ><bean:message   key="hrm.HrmMyWorkflow.approved" /></enrgise:option>      
                      <enrgise:option value="R" ><bean:message   key="hrm.HrmMyWorkflow.rejected" /></enrgise:option>      
                      <enrgise:option value="D" ><bean:message   key="hrm.HrmMyWorkflow.deleted" /></enrgise:option>     
                      <enrgise:option value="F" ><bean:message   key="hrm.HrmMyWorkflow.finalized" /></enrgise:option>
                      </enrgise:select>
                  </td> 
                  </tr>
                              
                  <tr height=10>
            <td colspan=6></td>
          </tr>
          </table>  
         <table cellspacing=0 cellpadding=0 border=0>         
      <!-- Detail Information Row starts -->
          <TR>
            <TD colspan=6>
            <TABLE cellSpacing=0 cellPadding=0 >
             <tr>
                <td bgcolor="#4682B4" ></td>
                <enrgise:tab name="HrmMyWorkflowForm" property="butWorkflowDtlTab" styleClass="actTabText" disabledClass="lockedTab" src="../includes/images/formtab_r.gif" ><bean:message key="hrm.HrmMyWorkflow.subHeader" /></enrgise:tab>
                <td width="82%"> </td>
            </tr>   
              
            <!-- Detail table Container starts -->
              <TD colSpan=6>
              <TABLE cellSpacing=0 cellPadding=0 border=0>
                <TBODY>
                 <TR>
                  <TD >
                  <DIV id=divDtlTable style="height:300px">
                    <TABLE  border="0" cellSpacing=0 cellPadding=0 id="workFlow">
                     <TBODY>
                        <tr>
                          <TD class=tableHeader width="1%"><input type="checkbox" name="selectAll"  onclick="toggleCheckBox('checked')"  /></td>
                          <td class=tableHeader ><bean:message key="hrm.HrmMyWorkflow.requestId" /></td>
                          <td class=tableHeader ><bean:message key="hrm.HrmMyWorkflow.requestor" /></td>
                          <td class=tableHeader ><bean:message key="hrm.HrmMyWorkflow.requestorName" /></td>
                          <td class=tableHeader ><bean:message key="hrm.HrmMyWorkflow.approver" /></td>
                          <td class=tableHeader ><bean:message key="hrm.HrmMyWorkflow.approverName" /></td>
                          <td class=tableHeader ><bean:message key="hrm.HrmMyWorkflow.level" /></td>
                          <td class=tableHeader ><bean:message key="hrm.HrmMyWorkflow.butAct" /></td>
                        </tr>
        
           <logic:iterate id="HrmMyWorkflow" name="HrmMyWorkflowForm" property="arrHrmMyWorkflowDtl" type="wenrgise.hrms.bean.HrmMyWorkflowDtlBean"  indexId="idx"  >
                               <logic:notEqual name="HrmMyWorkflow" property="status" value="D" >
                                 <tr>
                                     <td><html:checkbox property="checked" value="check" name="HrmMyWorkflowForm" alt="<%=idx.toString()%>" onclick="boxClicked(this.alt); " />
                                     <html:hidden property="itemChecked" name="HrmMyWorkflow" />
                                     <html:hidden property="status" name="HrmMyWorkflow" />
                                     <html:hidden property="detailId"  name="HrmMyWorkflow" />
                                     <html:hidden property="docDtlId" name="HrmMyWorkflow"  />
                                     </td>
                                     
                                     
                                    <td class=tableText ><html:text property="requestId" maxlength="100" size="15" titleKey="hrm.HrmMyWorkflow.requestId" name="HrmMyWorkflow" style="width:100%" styleClass="locked" readonly="true" alt="A" onchange='<%="doChangeDetail("+idx.toString()+")"%>'  /></td>
                                    
                                     <td class=tableText ><html:text property="requestor" maxlength="100" size="15" titleKey="hrm.HrmMyWorkflow.requestor" name="HrmMyWorkflow" style="width:100%" styleClass="locked" readonly="true" alt="A" onchange='<%="doChangeDetail("+idx.toString()+")"%>' /></td> 
                                     <td class=tableText ><html:text property="requestorName" maxlength="100" size="15" titleKey="hrm.HrmMyWorkflow.requestorName" name="HrmMyWorkflow"  style="width:100%" styleClass="locked" readonly="true" alt="N" onchange='<%="doChangeDetail("+idx.toString()+")"%>' /></td>
                                     <td class=tableText ><html:text property="approver" maxlength="100" size="15" titleKey="hrm.HrmMyWorkflow.approver" name="HrmMyWorkflow" style="width:100%" styleClass="locked" readonly="true" alt="N" onchange='<%="doChangeDetail("+idx.toString()+")"%>' /></td>
                                     <td class=tableText ><html:text property="approverName" maxlength="100" size="15" titleKey="hrm.HrmMyWorkflow.approverName" name="HrmMyWorkflow" style="width:100%" styleClass="locked" readonly="true" alt="A" onchange='<%="doChangeDetail("+idx.toString()+")"%>' /></td> 
                                     <td class=tableText ><html:text property="level" maxlength="100" size="15" titleKey="hrm.HrmMyWorkflow.level" name="HrmMyWorkflow" style="width:100%" styleClass="locked" readonly="true" alt="A" onchange='<%="doChangeDetail("+idx.toString()+")"%>' /></td> 
                                     <td  align="center" ><enrgise:button altKey="hrm.HrmMyWorkflow.butAct" styleClass="bottomBarText" name="HrmMyWorkflowForm" property="butAct" style="width:100%" onclick='<%="doDelegate("+idx.toString()+")"%>'>Act on Worklist</enrgise:button></td>
                                 </tr>
                              </logic:notEqual>
            </logic:iterate>         
                
        </TBODY>
                      </TABLE>
                      </DIV>
                      </TD>
                    </TR>
               <tr>
                <td>	
               <jsp:include page="GenDetailMenu.jsp" flush="true" />
		            </TD>
		            <td> </td>
               </tr>
        </TABLE>
      </td>
     </tr>
      <TR>
        <TD background="../includes/images/line_r.gif"><IMG src="../includes/images/pixel.gif" border=0></TD>
      </TR>
      
  </TABLE>
</td>
</tr>
              <!-- Tab Table Ends -->
 	 
<!-- Bottom Blue Bar -->
       <TR>
            <td>
            <TABLE  cellspacing="0" cellpadding="0" border=0>
                     <tr>
                        <td width=40% align=center bgColor=#4682b4></td>
                        <td  bgColor=#4682b4></td>
                        <td  bgColor=#4682b4></td>                
                        <td 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 -->

<!--//Common hidden fields      -->
<html:hidden name="HrmMyWorkflowForm"  property="screenMode" />
<html:hidden name="HrmMyWorkflowForm"  property="screenName" value="HrmMyWorkflow" />
<html:hidden name="HrmMyWorkflowForm"  property="forwardedPage" />
<html:hidden property="positionRequested" name="HrmMyWorkflowForm" />
<html:hidden property="userPageRequested"  />
<html:hidden property="userPositionRequested" />
<html:hidden property="pageRequested" />
<html:hidden property="actionName" name="HrmMyWorkflowForm" />
<html:hidden property="headerPrimaryKey" name="HrmMyWorkflowForm" />
<html:hidden property="headerDataChanged" name="HrmMyWorkflowForm" />
<html:hidden property="detailDataChanged" name="HrmMyWorkflowForm" />
<html:hidden property="firstLoad" name="HrmMyWorkflowForm" />
<html:hidden property="txtIndex" name="HrmMyWorkflowForm"  />
<html:hidden property="buttonName" name="HrmMyWorkflowForm" />
<html:hidden property="employeeNoId" name="HrmMyWorkflowForm"  />
<html:hidden property="empId" name="HrmMyWorkflowForm"  />
<html:hidden property="requestType" name="HrmMyWorkflowForm"  />

<!--//For LOV-->
<html:hidden property="lovKey" name="HrmMyWorkflowForm"  />
<html:hidden property="txtSearchFields" name="HrmMyWorkflowForm"  />
<html:hidden property="txtDisplayFields" name="HrmMyWorkflowForm"  />
<html:hidden property="id" name="HrmMyWorkflowForm" />
<input type="hidden" name="queryParam" >

<!--//Page specific Hidden fields-->



</html:form>
</body>
</html:html>

<script language= "javascript">

function doOnLoad()
{
  if(document.forms[0].firstLoad.value!="false")
  {
    return  "HrmMyWorkflowOnLoadAction.do"; 
  }
}
function doValidate()
{
  return "HrmMyWorkflowValidateAction.do";
}

function ShowWorkflwCode()
{
        document.forms[0].txtIndex.value ="";
        document.forms[0].lovKey.value = "WorkId" + document.forms[0].screenName.value + document.forms[0].screenMode.value;
        document.forms[0].txtSearchFields.value = "hrm.HrmMyWorkflow.id,hrm.HrmMyWorkflow.requestType";
        document.forms[0].txtDisplayFields.value = "id,id,requestType";
        showLov('<html:rewrite page="/hrms/jsp/CommonSearchScreen.jsp" />','HrmMyWorkflowForm');
        return true;
}

function doExecute()
{
  if(document.forms[0].workflowType.value == 'NO'){
    alert('Please select the Workflow Type');
    return  "HrmMyWorkflowOnLoadAction.do"; 
  }
  else if(document.forms[0].txtStatus.value == "NO"){
    alert('Please select the Status');
    return  "HrmMyWorkflowOnLoadAction.do";  
  }
  else return "HrmMyWorkflowGetHeaderAction.do";
}

function doExit()
{

  return "HrmMyWorkflowExitAction.do";
}


function doRefresh()
{

  return "HrmMyWorkflowRefreshAction.do";
  
}


function doQueryMode()
{
 
  return "HrmMyWorkflowQueryModeAction.do";
}
function doChangeHeader()
{

 if(document.forms[0].screenMode.value=="U" || document.forms[0].screenMode.value=="N")

 document.forms[0].headerDataChanged.value="true";
}
function doPrevHeader()
{
  return "HrmMyWorkflowGetPrevHeaderAction.do"; 
}

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

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

function doPrevDetail()
{

  return "HrmMyWorkflowGetDetailPageAction.do";  
}

function doNextDetail()
{

  return "HrmMyWorkflowGetDetailPageAction.do";
}

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

function doGetDetail()
{

  return "HrmMyWorkflowGetDetailAction.do";
}

function doGetDetailTableName()
{
  return "workFlow";
}

function boxClicked(val)
{    
    if(document.getElementsByName("checked")[val].checked)
    {      
      document.getElementsByName("itemChecked")[val].value = "Y";      
    }
    else
    {     
      document.getElementsByName("itemChecked")[val].value = "N";     
    }      
}

function doOnChangeLov(lovName)
{
   if(lovName=="WorkIdHrmMyWorkflowQ")
    {
    doBaseValidate();
    }
}

 function doDelegate(i){
  var myContextRoot="/hrms/";
  var wflowtype = document.forms[0].workflowType.value;
  var status = document.forms[0].txtStatus.value;
  if (status == "P" && wflowtype == "W" ){
    switch (document.forms[0].requestType.value){
      // For Loan Application
      case "Loan Application":
         document.forms[0].action = myContextRoot + "HrmLnAppGetHeaderAction.do?headerPrimaryKey="+document.getElementsByName("docDtlId")[i].value;
         document.forms[0].submit();
      break;
      
      // For Staff Recruitment
       case "Initial Sanction of Outsourced Position":
         document.forms[0].action = myContextRoot + "HrmStaffRecrtmntGetHeaderAction.do?headerPrimaryKey="+document.getElementsByName("docDtlId")[i].value;
         document.forms[0].submit();
      break;
      
      //For Travel Expense Bill
      case "Travel expense Bill":
         document.forms[0].action = myContextRoot + "HrmTrvlngExpnsBillGetHeaderAction.do?headerPrimaryKey="+document.getElementsByName("docDtlId")[i].value;
         document.forms[0].submit();
      break;
      
      //For My Appraisal Data Validation
      case "My Appraisal Data Validation":
         document.forms[0].action = myContextRoot + "HrmMyApprDtlsGetHeaderAction.do?headerPrimaryKey="+document.getElementsByName("docDtlId")[i].value;
         document.forms[0].submit();
      break;
      
      //For Advance Application
      case "Advance Application":
         document.forms[0].action = myContextRoot + "HrmEmpAdvApplnGetHeaderAction.do?headerPrimaryKey="+document.getElementsByName("docDtlId")[i].value;
         document.forms[0].submit();
      break;
      
      //For Mediclaim Application
      case "Mediclaim":
         document.forms[0].action = myContextRoot + "HrmMediclaimApplnGetHeaderAction.do?headerPrimaryKey="+document.getElementsByName("docDtlId")[i].value;
         document.forms[0].submit();
      break;
      
      //For Miscellaneous Claim Application
      case "Miscellaneous Claim":
         document.forms[0].action = myContextRoot + "HrmEmpClaimGetHeaderAction.do?headerPrimaryKey="+document.getElementsByName("docDtlId")[i].value;
         document.forms[0].submit();
      break;
      //For Employee Confirmation
      case "Due for confirmation":
         document.forms[0].action = myContextRoot + "HrmEmpConformGetHeaderAction.do?headerPrimaryKey="+document.getElementsByName("docDtlId")[i].value;
         document.forms[0].submit();
      break;
      //For Leave Application
      case "Leave":
         document.forms[0].action = myContextRoot + "HrmLvApplnGetHeaderAction.do?headerPrimaryKey="+document.getElementsByName("docDtlId")[i].value;
         document.forms[0].submit();
      break;
      //For Leave Cancellation
      case "Leave Cancellation":
         document.forms[0].action = myContextRoot + "HrmEmpLeaveCancelBatchScreenGetHeaderAction.do?headerPrimaryKey="+document.getElementsByName("docDtlId")[i].value;
         document.forms[0].submit();
      break;
       default:
        null;
    }
   //target=document.forms[0].action;
    //doGetDetail();
    //window.open(target,'_blank','Status=yes,resizable=yes');
  }
 }  
 
</script>
