<%@ 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" flush="true" />
</HEAD>

<BODY  onkeydown="hotKeys(event);"; scroll=auto>

<html:form name="HrmAppKPAForm" action="HrmAppKPABaseAction" type="wenrgise.hrms.webtier.form.HrmAppraisalKPAForm">
<bean:define id="ParentForm" name="HrmAppKPAForm" toScope="request" />
<jsp:include page="GenIconMenu.jsp" flush="true" />


<!--Top Most Blue Bar-->
<TABLE cellSpacing=0 bgColor=#bdd0ef>
    <TR>
        <TD  colSpan=12 class=mainHeader ><bean:message  key="hrm.HrmHrmAppraisalKPA.heading" /></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 >
        <!--Master Information Starts -->
         <TR>
            <TD class=subHeader colspan=6><bean:message key="hrm.HrmHrmAppraisalKPA.appraisalKPAHeader" /></TD>
         </TR>
         <TR>
            <TD  bgColor=#4682b4 colspan=6><IMG height=1 src="../includes/images/pixel.gif" width=1 border=0></TD>
         </TR>
         <TR>
            <td class=labelText><bean:message key="hrm.HrmHrmAppraisalKPA.kpaGroupCode" /></td>
            <td><enrgise:text   property="kpaGroupCode"   size="23" styleClass="required" disabledClass="required" onchange="doChangeHeader();" /><enrgise:img src="../includes/images/lov.jpg" height="16" align="center" property="butKpaGroupCode" name="HrmAppKPAForm" onclick="ShowKPAGrpCode();" /></td>
            
            <td class=labelText><bean:message key="hrm.HrmHrmAppraisalKPA.description" /></td>
            <td ><enrgise:text  property="description"    size="40" disabledClass="required" styleClass="required" onchange="doChangeHeader();" /></td>
         
          </TR>
          
          <TR>
          
            <td class="labelText"><bean:message key="hrm.HrmHrmAppraisalKPA.ratingRequired" /></td>
            <td><enrgise:checkbox property="ratingRequired" name="HrmAppKPAForm" titleKey="hrm.HrmHrmAppraisalKPA.ratingRequired" styleClass="required" disabledClass="required" onclick="doHeaderCheckBox(this);"  onchange="doChangeHeader();" /><html:hidden property="ratingRequired" name="HrmAppKPAForm" /></td>
           
            <td class="labelText" ><bean:message key="hrm.HrmHrmAppraisalKPA.txtAppraiserType"  /></td>
               <td>  <enrgise:select property="txtAppraiserType"  name="HrmAppKPAForm"  titleKey="hrm.HrmHrmAppraisalKPA.txtAppraiserType"  styleClass="required" disabledClass="optional" onchange="doChangeHeader();">
                                      <enrgise:option value="" ><bean:message key="hrm.HrmHrmAppraisalKPA.select" /></enrgise:option>  
                                      <enrgise:option value="0" ><bean:message key="hrm.HrmHrmAppraisalKPA.appraiser" /></enrgise:option>      
                                      <enrgise:option value="1" ><bean:message key="hrm.HrmHrmAppraisalKPA.self" /></enrgise:option>
                                      <enrgise:option value="2" ><bean:message key="hrm.HrmHrmAppraisalKPA.reviwer" /></enrgise:option>
                                       
                                       
                </enrgise:select>
                </td>
                </TR>
                <TR>
  
                <td class=labelText><bean:message key="hrm.HrmHrmAppraisalKPA.statusOfHeader" /></td>
                <td ><html:text  property="statusOfHeader"    size="26"  styleClass="locked" readonly="true" onchange="doChangeHeader();" /></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 width=10 bgColor=#4682b4><IMG height=1 src="../includes/images/pixel.gif" width=10 border=0></TD>
                <TD class=actTabText noWrap bgColor=#4682b4><bean:message key="hrm.HrmHrmAppraisalKPA.detail" /><IMG height=1 src="../includes/images/pixel.gif" width=10 border=0></TD>
                <TD><IMG height=19  src="../includes/images/formtab_r.gif" width=10  border=0></TD>
                <TD width="100%" background="../includes/images/line_t.gif">&nbsp;</TD>
                <TD background="../includes/images/line_t.gif"><IMG height=1 src="../includes/images/pixel.gif" width=10 border=0></TD>
              </TR>
              <!-- Detail table Container starts -->
              <TD colSpan=6>
              <TABLE cellSpacing=0 cellPadding=0 border=0>
                <TBODY>
                 <TR>
                  <TD >
                  <DIV id=divDtlTable style="height:250px">
                    <TABLE  border="0" cellSpacing=0 cellPadding=0>
                     <TBODY>
                        <TR>
                       <TD class=tableHeader width="1%"><input type=checkbox property="selectAll" onclick="toggleCheckBox('checked')" disabled="true" /></TD>
                          <TD class=tableHeader width="19%"><bean:message  key="hrm.HrmHrmAppraisalKPA.txtSrlNo" /></td>
                          <TD class=tableHeader width="19%"><bean:message key="hrm.HrmHrmAppraisalKPA.txtKpaCode" /></td>                          
                          <TD class=tableHeader width="19%"><bean:message  key="hrm.HrmHrmAppraisalKPA.txtDescription" /></td>
                          <TD class=tableHeader width="19%"><bean:message  key="hrm.HrmHrmAppraisalKPA.txtMandatoryFlag" /></td>
                          <TD class=tableHeader width="19%"><bean:message  key="hrm.HrmHrmAppraisalKPA.txtWeightage" /></td>
                         
                          
                          
                          
                        </TR> 
                        
                       <logic:iterate id="ApprisalInfo" name="HrmAppKPAForm" property="arylstAppraisalKpa" type="wenrgise.hrms.bean.HrmAppraisalKPADtlBean" indexId="idx">
                                
                            <logic:notEqual name="ApprisalInfo" property="status" value="D" >                                                        
                                <TR>
                                  <td align="left" ><html:checkbox property="checked" name="HrmAppKPAForm" alt="<%=idx.toString()%>" disabled="true" /></td>
                                                                    
                                  <td><enrgise:text property="txtSrlNo"  name="ApprisalInfo"  maxlength="4" styleClass="required" disabledClass="required"  style="width:100%" size="26" onchange='<%="doChangeDetail("+idx.toString()+");"%>'  onkeypress="isInteger(event);" />  </td>
                                  <td ><enrgise:text property="txtKpaCode"   name="ApprisalInfo" maxlength="20"  styleClass="required" disabledClass="required"  style="width:100%" size="26"  onchange='<%="doChangeDetail("+idx.toString()+")"%>' /> </td>
                                  <td><enrgise:text property="txtDescription"  name="ApprisalInfo" maxlength="250" disabledClass="required" styleClass="required"   style="width:100%" size="26" onchange='<%="doChangeDetail("+idx.toString()+");"%>'  />  </td>
                                  <td  width="1%" align="center"><enrgise:checkbox property="mandatoryFlag"  name="ApprisalInfo"  disabledClass="required"  alt="<%=idx.toString()%>" onclick='<%="doDetailCheckBox(this," + idx.toString() + ");"%>' onchange='<%="doChangeDetail("+idx.toString()+")"%>' /><html:hidden property="mandatoryFlag"  name="ApprisalInfo"  /></td>        
                                  <td><enrgise:text property="txtWeightage"  name="ApprisalInfo" disabledClass="optional" styleClass="optional"   style="width:100%" size="26" onkeypress="isInteger(event)" maxlength="5" onchange='<%="doChangeDetail("+idx.toString()+");"%>'  />  </td>
                                 
                                  
                                 
                                                          
                                   <html:hidden property="kpaCodeId" name="ApprisalInfo"  />
                                   <html:hidden property="itemChecked" name="ApprisalInfo" />
                                   <html:hidden property="status" name="ApprisalInfo" />
                                   <html:hidden property="detailId" name="ApprisalInfo" />
                                </TR>
                        </logic:notEqual>
                       
                        <logic:equal name="ApprisalInfo" property="status" value="D" >
                                
                                 <TR>
                                  <td align="left" ><html:checkbox property="checked" name="HrmAppKPAForm" alt="<%=idx.toString()%>" disabled="true" /></td>
                                                                    
                                  <td><enrgise:text property="txtSrlNo"   readonly="true" maxlength="4" styleClass="locked" disabledClass="locked"  style="width:100%" size="26" onchange='<%="doChangeDetail("+idx.toString()+");"%>' onkeypress="isInteger(event);" />  </td>
                                  <td ><enrgise:text property="txtKpaCode"   readonly="true" maxlength="20"  styleClass="locked" disabledClass="locked"  style="width:100%" size="26"  onchange='<%="doChangeDetail("+idx.toString()+")"%>' /> </td>
                                  <td><enrgise:text property="txtDescription"  name="ApprisalInfo" maxlength="250" disabledClass="required" styleClass="required"   style="width:100%" size="26" onchange='<%="doChangeDetail("+idx.toString()+");"%>'  />  </td>
                                  <td  width="1%" align="center"><enrgise:checkbox property="mandatoryFlag"  name="ApprisalInfo"  disabledClass="required"  alt="<%=idx.toString()%>" onclick='<%="doDetailCheckBox(this," + idx.toString() + ");"%>' onchange='<%="doChangeDetail("+idx.toString()+")"%>' /><html:hidden property="mandatoryFlag"  name="ApprisalInfo"  /></td>        
                                  <td><enrgise:text property="txtWeightage"  name="ApprisalInfo" disabledClass="optional" styleClass="optional"   style="width:100%" size="26" onchange='<%="doChangeDetail("+idx.toString()+");"%>'  />  </td>
                                 
                                  
                                 
                                                          
                                   <html:hidden property="kpaCodeId" name="ApprisalInfo"  />
                                   <html:hidden property="itemChecked" name="ApprisalInfo" />
                                   <html:hidden property="status" name="ApprisalInfo" />
                                   <html:hidden property="detailId" name="ApprisalInfo" />
                                </TR>
                          </logic:equal>                                    
                    </logic:iterate>              
                                       

                      </TBODY>
                      </TABLE>
                      </DIV>
                      </TD>
                    </TR>
               
        </TABLE>
      </td>
     </TR>
       <tr>
                              <td colspan=11>	
                                <TABLE border=0>
                                  <TBODY>
                                  <tr>
                                   <td colspan=11>	
                                   <jsp:include  page = "GenDetailMenu.jsp" flush="true" />
                                   </TD>
                                 </tr>
                                </TBODY>
                              </TABLE>
                             </TD>
                            </tr>
                          
                          </TBODY>
                        </TABLE>
                      </td>
                    </tr>
                  </TABLE>
                </td>
	            </tr>
      
  </TABLE>
</td>
</TR>
              <!-- Tab Table Ends -->

      <!-- Bottom Blue Bar -->
       <TR>
            <td>
              <TABLE  cellspacing="0" cellpadding="0" border=0>
                     
                    <TR>
               <td align=center bgcolor=#4682b4 width="40%"></td>
               <td width="12%" bgcolor=#4682b4>
              
               <enrgise:button name="HrmAppKPAForm"   onclick="doFreeze();" property="butFreeze" styleClass="bottomBarText"> Freeze </enrgise:button>
               
               
               </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-->
    
</TBODY>
</TABLE>

<!-- Container Table Ends -->
<html:hidden name="HrmAppKPAForm" property="screenName" value="HrmAppraisalKPA" />
<html:hidden name="HrmAppKPAForm" property="forwardedPage" />
<html:hidden name="HrmAppKPAForm" property="positionRequested"  />
<html:hidden name="HrmAppKPAForm" property="screenMode" />
<html:hidden name="HrmAppKPAForm" property="buttonName" />
<html:hidden name="HrmAppKPAForm" property="headerPrimaryKey"/> 
<html:hidden property="kpaGrpId" name="HrmAppKPAForm"  />

<html:hidden property="lovKey" name="HrmAppKPAForm"  />
<html:hidden property="txtSearchFields" name="HrmAppKPAForm"  />
<html:hidden property="txtDisplayFields" name="HrmAppKPAForm"  />
<html:hidden property="txtIndex" name="HrmAppKPAForm"  />

<html:hidden property="detailDataChanged" name="HrmAppKPAForm"  />
<html:hidden property="headerDataChanged" name="HrmAppKPAForm"  />
<html:hidden property="firstLoad" name="HrmAppKPAForm"  />

<html:hidden property="userPageRequested" name="HrmAppKPAForm" />
<html:hidden property="userPositionRequested" name="HrmAppKPAForm" />
<html:hidden property="pageRequested" name="HrmAppKPAForm" />

<input type="hidden" name="multipleFlag" />

</html:form>
</body>
</html:html>
      
<script language="javascript">

function doQueryMode()
{
  return "HrmAppKpaQueryModeAction.do";
}




function doFreeze()
{
 document.forms[0].buttonName.value="butFreeze";
 document.forms[0].action=contextRoot+"HrmAppKpaFreezeAction.do";
 document.forms[0].submit();
}





function doInsertMode()
{
  return "HrmAppKpaNewModeAction.do";
}

function doHeaderCheckBox(elem)
{
  if(elem.checked)
  {
    document.getElementsByName(elem.name)[1].value="on";
  }
  else
  {
    document.getElementsByName(elem.name)[1].value="off";
  }
}


function doDetailCheckBox(elem, i)
{
  i=i*2;
   
  if(elem.checked)
   {
    document.getElementsByName(elem.name)[i+1].value="on";
   }
  else
  {
    document.getElementsByName(elem.name)[i+1].value="off";
  }
  
}

function doExecute()
{
  return "HrmAppKpaGetHeaderAction.do";
}

function doSave()

  {
  
 if(document.forms[0].headerDataChanged.value=="true")
    {
     preSaveHeader();
    }

 if (document.forms[0].detailDataChanged.value=="true")
    {
     preSaveDetail();
    }
  return "HrmAppKpaSaveAction.do";
  }

function doDelete()
{
  return "HrmAppKpaDeleteAction.do";
}

function doRefresh()
{
  return "HrmAppKpaRefreshAction.do";

}
function doExit()
{
  return "HrmAppKpaExitAction.do";

}

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

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

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

function doGetDetail()
{

  return "HrmAppKpaGetDetailAction.do";
}

function doAddRow()
{
  return "HrmAppKpaAddRowAction.do"; 
}

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


function doPrevDetail()
{

  return "HrmAppKpaGetDetailPageAction.do";  
}

function doNextDetail()
{

  return "HrmAppKpaGetDetailPageAction.do";
}

function doJumpDetail()
{
  return  "HrmAppKpaGetDetailPageAction.do"; 
}
 function doOnLoad()
{
  if(document.forms[0].firstLoad.value!="false")
  {
    return  "HrmAppKpaOnLoadAction.do"; 
  }
}

function ShowKPAGrpCode()
{
        document.forms[0].lovKey.value = "AppraisalKPAGroupCode" + document.forms[0].screenName.value + document.forms[0].screenMode.value;
        document.forms[0].txtSearchFields.value = "hrm.HrmHrmAppraisalKPA.kpaGroupCode,hrm.HrmHrmAppraisalKPA.description";
        document.forms[0].txtDisplayFields.value = "kpaGrpId,kpaGroupCode,description";
        document.forms[0].multipleFlag.value = "false";
        showLov('<html:rewrite page="/HRMS/JSP/CommonSearchScreen.jsp" />','HrmAppKPAForm');
        return true;
}


  function preSaveDetail()
{
 for(i=0 ; i < document.forms[0].mandatoryFlag.length; i++)
  {
    document.forms[0].mandatoryFlag[i].checked=false
  }
   
}

function preSaveHeader()
 {
    
    document.forms[0].ratingRequired.checked=false
   
 }

</script>