<%@ 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>
<html:base />
<head>
  <TITLE><bean:message  key="hrm.title" /></TITLE>
  <jsp:include page="GenIncludes.jsp" flush="true" />
</head>
<BODY onkeydown="hotKeys(event);"; scroll=auto>

<html:form  name="HrmAppTempForm" action="HrmAppTempSecBaseAction" type="wenrgise.hrms.webtier.form.HrmAppraisalTemplateForm">
<bean:define id="ParentForm" name="HrmAppTempForm" 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.HrmAppraisalTemplate.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 >
        <!--Inspection Header Starts -->
            <TR>
                  <TD class=subHeader colspan=6><bean:message  key="hrm.HrmAppraisalTemplate.header" /></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="hrm.HrmAppraisalTemplateKpa.templateName" /></td>
                  <td><enrgise:text  property="templateName" altKey="hrm.HrmAppraisalTemplateKpa.templateName" maxlength="255" size="23" styleClass="required" disabledClass="locked" /><enrgise:img src="../includes/images/lov.jpg" height="16" align="center" property="butTemplateName" name="HrmAppTempForm" onclick="ShowTemplateName();" /></td>
                  
                  <td class="labelText"><bean:message key="hrm.HrmAppraisalTemplateKpa.ratingCode" /> </td>
                  <td><html:text  property="ratingCode"  altKey="hrm.HrmAppraisalTemplateKpa.ratingCode" maxlength="255" size="23" styleClass="required" readonly="true"  /><enrgise:img src="../includes/images/lov.jpg" height="16" align="center" property="butRatingCode" name="HrmAppTempForm" onclick="ShowRatingCode();" /></td>
                  <td colspan="4"></td> 
                  <td width="6%"></td>
            </TR>
            <tr>
            
            
                  <td class="labelText"><bean:message key="hrm.HrmAppraisalTemplateKpa.obsolete" /></td>
                 <td><enrgise:checkbox property="obsolete"  titleKey="hrm.HrmAppraisalTemplateKpa.obsolete" styleClass="optional" disabledClass="locked" onclick="doHeaderCheckBox(this);"  onchange="doChangeHeader();" /><html:hidden property="obsolete" name="HrmAppTempForm" /></td>
                  <td class="labelText"><bean:message key="hrm.HrmAppraisalTemplateKpa.applicableToAll" /></td>
                 <td><enrgise:checkbox property="applicableToAll"  titleKey="hrm.HrmAppraisalTemplateKpa.applicableToAll" styleClass="optional" disabledClass="locked" onclick="doHeaderCheckBox(this);"  onchange="doChangeHeader();" /><html:hidden property="applicableToAll" name="HrmAppTempForm" /></td>

                <td class=labelText><bean:message key="hrm.HrmAppraisalTemplateKpa.statusOfHeader" /></td>
                <td ><html:text  property="statusOfHeader"    size="26"  styleClass="locked" readonly="true"  onchange="doChangeHeader();" /></td>
                  
            </tr>
              
          
            <tr height="5">
                 <td colspan="6"></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>                                             
                  <td bgcolor="#4682B4" width="10"><img src="../includes/images/pixel.gif" width="10" height="1" border="0"></td>
                  <td bgcolor="#4682B4" nowrap class=actTabText>Template Section<img src="../includes/images/pixel.gif" width="10" height="1" border="0"></td>
                  <TD><IMG height=21 src="../includes/images/formtab_r.gif" width=10  border=0></TD>  
                  
                  <td bgcolor="#76A2C7" width="10"><img src="../includes/images/pixel.gif" width="10" height="1" border="0"></td>
                  <td bgcolor="#76A2C7" nowrap class=disTabText onclick= "doGetTab('HrmAppraisalTemplateKPA','HrmAppraisalTemplateSectionGetTabAction.do')">Template KPA<img src="../includes/images/pixel.gif" width="10" height="1" border="0"></td>
                  <TD><IMG height=21 src="../includes/images/formtab_lb.gif" width=10  border=0></TD>  
                  
                  <td background="../includes/images/line_t.gif" width="80%">&nbsp;</td>
                  <td background="../includes/images/line_t.gif"><img src="../includes/images/pixel.gif" width="10" height="1" border="0"></td>
            </tr>
            
            
              <TR >
              
            <!-- Detail table Container starts -->
              <TD colSpan=8>
              <TABLE cellSpacing=0 cellPadding=0 border=0>
                <TBODY>
                 <TR>
                  <TD >
                  <DIV id=divDtlTable style="height:250px;width:1020px">
                    <TABLE  border="0" cellSpacing=0 cellPadding=0 id="HrmApprTempSec">
                     <TBODY>
                          <tr>
                            <TD class=tableHeader width="1%"><html:checkbox property="selectAll" onclick="toggleCheckBox('checked')" /></TD>
                            <TD class=tableHeader width="1%"><bean:message key="hrm.HrmAppraisalTemplate.srlNo" /></td>   
                            <TD class=tableHeader width="6%"><bean:message key="hrm.HrmAppraisalTemplate.sectionCode" /></td>                                
                            <TD class=tableHeader width="6%"><bean:message key="hrm.HrmAppraisalTemplate.appraiserType" /></td>   
                            <TD class=tableHeader width="6%"><bean:message key="hrm.HrmAppraisalTemplate.templateRemarks" /></td>                                
                            <TD class=tableHeader width="5%"><bean:message key="hrm.HrmAppraisalTemplate.parentSection" /></td>  
                            <TD class=tableHeader width="5%"><bean:message key="hrm.HrmAppraisalTemplate.ratingReqd" /></td>  
                            <TD class=tableHeader width="5%"><bean:message key="hrm.HrmAppraisalTemplate.sectionWeightage" /></td>                                
                         </tr>
                         
                         
                         
                           <logic:iterate id="HrmApprTempSec" name="HrmAppTempForm" property="arrAppTempSec" type="wenrgise.hrms.bean.HrmAppraisalTemplateSecDtlBean" indexId="idx" >
                           <logic:notEqual name="HrmApprTempSec" property="status" value="D" >
                           <tr class='<bean:write name="HrmAppTempForm" property="listRowClass"/>'  >
                             <td><html:checkbox property="checked" name="HrmAppTempForm" alt="<%=idx.toString()%>" onclick="boxClicked(this.alt);" />    
                             <html:hidden property="itemChecked" name="HrmApprTempSec" /><html:hidden property="status" name="HrmApprTempSec" /><html:hidden property="detailId"  name="HrmApprTempSec" /><html:hidden property="txtParentSecId"  name="HrmApprTempSec" />
                             
                              <TD><enrgise:text property="txtSrlNo" name="HrmApprTempSec"  maxlength="4" styleClass="required" disabledClass="locked" titleKey="hrm.HrmAppraisalTemplate.srlNo" onkeypress="isInteger(event)" onchange='<%="doChangeDetail("+idx.toString()+")"%>'  /></td>
                              <TD class=tableText ><enrgise:text property="txtSectionCode" name="HrmApprTempSec" maxlength="40" styleClass="required" disabledClass="locked" titleKey="hrm.HrmAppraisalTemplate.sectionCode" size="17" onchange='<%="doChangeDetail("+idx.toString()+")"%>'  /></td>
                              
                              <TD><enrgise:select property="txtAppraiserType" name="HrmApprTempSec" styleClass="required" disabledClass="locked" titleKey="hrm.HrmAppraisalTemplate.appraiserType"    onchange='<%="doChangeDetail("+idx.toString()+")"%>' >
                                            <enrgise:option value="" ><bean:message   key="hrm.pleaseSelect" /></enrgise:option>      
                                            <enrgise:option value="S" > <bean:message key="hrm.HrmAppraisalTemplate.selfAppraisal" /></enrgise:option>
                                            <enrgise:option value="A" > <bean:message key="hrm.HrmAppraisalTemplate.appraiser" /></enrgise:option>
                                            <enrgise:option value="R" > <bean:message key="hrm.HrmAppraisalTemplate.reviewer" /></enrgise:option>
                                  </enrgise:select></td>
                              <TD class=tableText ><enrgise:text property="txtTemplateRemarks" name="HrmApprTempSec" styleClass="optional" disabledClass="locked" titleKey="hrm.HrmAppraisalTemplate.templateRemarks" onchange='<%="doChangeDetail("+idx.toString()+")"%>' /></td>
                              <TD class=tableText ><enrgise:text property="txtParentSection" name="HrmApprTempSec" styleClass="optional" disabledClass="locked" titleKey="hrm.HrmAppraisalTemplate.parentSection" onchange='<%="doChangeDetail("+idx.toString()+")"%>' readonly="true" /><enrgise:img src="../includes/images/lov.jpg" height="15" align="center" styleClass="icon" name="HrmApprTempSec" property="butParentSecCode"  alt="<%=idx.toString()%>" onclick="return ShowParentCode(this.alt);"  /></td>
                              
                              <td align="center"><enrgise:checkbox  styleClass="optional"  disabledClass="locked" property="txtRatingReqd" name="HrmApprTempSec"  onclick='<%="doDetailCheckBox(this," + idx.toString() + ");"%>' onchange='<%="doChangeDetail("+idx.toString()+")"%>'  /></td>
                               <html:hidden property="txtRatingReqd" name="HrmApprTempSec" />
                              <TD class=tableText ><enrgise:text property="txtSectionWeightage" name="HrmApprTempSec" maxlength="3" styleClass="optional" disabledClass="locked" titleKey="hrm.HrmAppraisalTemplate.sectionWeightage" onkeypress="isInteger(event)" onchange='<%="doChangeDetail("+idx.toString()+")"%>'    />
                              
                            </tr>
                            </logic:notEqual>
                            
                            <logic:equal name="HrmApprTempSec" property="status" value="D"  >
                            <tr class='<bean:write name="HrmAppTempForm" property="listRowClass"/>'  >
                             <td><html:checkbox property="checked" value="check" disabled="true" name="HrmAppTempForm" alt="<%=idx.toString()%>" onclick="boxClicked(this.alt);" /></td>
                             <html:hidden property="itemChecked" name="HrmApprTempSec" /><html:hidden property="status" name="HrmApprTempSec" /><html:hidden property="detailId"  name="HrmApprTempSec" /><html:hidden property="txtParentSecId"  name="HrmApprTempSec" />
                              <TD><enrgise:text property="txtSrlNo" name="HrmApprTempSec" maxlength="4" styleClass="deletedRow" titleKey="hrm.HrmTransferOrder.applnNo" disabledClass="required"   alt="N" onchange='<%="doChangeDetail("+idx.toString()+")"%>' />
                              <TD class=tableText ><enrgise:text property="txtSectionCode" maxlength="40" name="HrmApprTempSec" styleClass="deletedRow" titleKey="hrm.HrmAppraisalTemplate.sectionCode" disabledClass="required"  size="10" alt="D" onchange='<%="doChangeDetail("+idx.toString()+")"%>' />
                              <TD><html:select property="txtAppraiserType" name="HrmApprTempSec" styleClass="deletedRow"   titleKey="hrm.HrmAppraisalTemplate.appraiserType"   onchange='<%="doChangeDetail("+idx.toString()+")"%>' >
                                          <html:option value="" ><bean:message   key="hrm.pleaseSelect" /></html:option>      
                                            <html:option value="S" > <bean:message key="hrm.HrmAppraisalTemplate.selfAppraisal" /></html:option>
                                            <html:option value="A" > <bean:message key="hrm.HrmAppraisalTemplate.appraiser" /></html:option>
                                            <html:option value="R" > <bean:message key="hrm.HrmAppraisalTemplate.both" /></html:option>
                                  </html:select></td>
                              <TD class=tableText ><html:text property="txtTemplateRemarks" name="HrmApprTempSec" styleClass="deletedRow" titleKey="hrm.HrmAppraisalTemplate.templateRemarks"   alt="P"  onchange='<%="doChangeDetail("+idx.toString()+")"%>' /></td>
                              <TD class=tableText ><html:text property="txtParentSection" name="HrmApprTempSec" styleClass="deletedRow" titleKey="hrm.HrmAppraisalTemplate.parentSection"   alt="P" onchange='<%="doChangeDetail("+idx.toString()+")"%>' /><enrgise:img src="../includes/images/lov.jpg" height="15" align="center" styleClass="icon" name="HrmAppTempForm" property="butParentSecCode"  alt="<%=idx.toString()%>"   /></td>
                              <td align="center"><enrgise:checkbox  formName="HrmAppraisalTemplateForm"  disabledClass="locked" property="txtRatingReqd" name="HrmApprTempSec"  onclick='<%="doDetailCheckBox(this," + idx.toString() + ");"%>' onchange='<%="doChangeDetail("+idx.toString()+")"%>'  /></td>
                               <html:hidden property="txtRatingReqd" name="HrmApprTempSec" />
                              <TD class=tableText ><html:text property="txtSectionWeightage" name="HrmApprTempSec" maxlength="3" styleClass="deletedRow" titleKey="hrm.HrmAppraisalTemplate.sectionWeightage"   alt="P" onchange='<%="doChangeDetail("+idx.toString()+")"%>'  />
                            </tr>
                            </logic:equal>
                            </logic:iterate>                                    
                         

                      </TBODY>
                      </TABLE>
                      </TD>
                    </TR>
                     <TABLE border=0>
                        <tbody>
                        <TR>
                          <td colspan=11>	
                              <jsp:include page="GenDetailMenu.jsp" />
                          </td>
                          <td width="6%"></td>
                        </TR>
                      
                        </tbody>
                   </TABLE>
                   </TBODY>
                </TABLE>
            </td>
          </tr>
          
        
     
           <!-- 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><enrgise:button  alt="Approve (Alt+P)" onclick="doApprove()" name="HrmAppTempForm" property="butApprove" styleClass="bottomBarText">A<u>p</u>prove</enrgise:button></td>
                        <td bgColor=#4682b4></td>
                        <td align=right bgColor=#4682b4><img src="../includes/images/man.jpg"></td>
                        <td width="6%"></td>
                   </TR>
                </table>
            </td>
          </tr>
	
<!-- Container Table Ending Columns Starts-->
    
</TBODY>
</TABLE>

<!-- Container Table Ends -->
<html:hidden name="HrmAppTempForm" property="screenName" value="HrmAppraisalTemplateSection" />
<html:hidden name="HrmAppTempForm" property="forwardedPage" />
<html:hidden name="HrmAppTempForm" property="positionRequested"  />
<html:hidden name="HrmAppTempForm" property="screenMode" />


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

<html:hidden property="lovKey" name="HrmAppTempForm"  />
<html:hidden property="txtSearchFields" name="HrmAppTempForm"  />
<html:hidden property="txtDisplayFields" name="HrmAppTempForm"  />
<html:hidden property="headerDataChanged" name="HrmAppTempForm" />
<html:hidden property="detailDataChanged" name="HrmAppTempForm" />
<html:hidden property="headerPrimaryKey" name="HrmAppTempForm" />
<html:hidden property="ratingId" name="HrmAppTempForm" />
<html:hidden property="templateId" name="HrmAppTempForm" />
<input type="hidden" name="multipleFlag" >
<input type="hidden" name="queryParam" >
<html:hidden property="buttonName" name="HrmAppTempForm" />
<html:hidden property="headerFlag" name="HrmAppTempForm" />

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

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 doQueryMode()
{

  return "HrmAppTempSecQueryModeAction.do";
}


function doInsertMode()
{

  return "HrmAppTempSecNewModeAction.do";
}


function doExecute()
{

  return "HrmAppTempSecGetHeaderAction.do";
}

function doSave()
{
  if (document.forms[0].detailDataChanged.value=="true")
  {

  preSaveDetail();
  }

  return "HrmAppTempSecSaveAction.do";
  
}

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


function doGetDetailTableName()
{
  return "HrmApprTempSec";
}

function doDelete()
{

  return "HrmAppTempSecDeleteAction.do";
  
}

function doRefresh()
{

  return "HrmAppTempSecRefreshAction.do";
  
}

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

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

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


function doGetDetail()
{

   return "HrmAppTempSecGetDetailAction.do";

}

function doAddRow()
{

  return "HrmAppTempSecAddRowAction.do"; 
}

function doDelRow()
{
 return "HrmAppTempSecDeleteRowAction.do";  
}
function doExit()
{
 return "HrmAppTempSecExitAction.do";  
}

function doGetDetailTableName()
{
  return "HrmAppTempSec";
}
function preSaveDetail()
{
for(i=0 ; i < document.forms[0].txtRatingReqd.length; i++)
  {
    document.forms[0].txtRatingReqd[i].checked=false
  }
}

function doPrevDetail()
{

  return "HrmAppTempSecGetDetailPageAction.do";  
}

function doNextDetail()
{

  return "HrmAppTempSecGetDetailPageAction.do";
}

function doJumpDetail()
{
  return  "HrmAppTempSecGetDetailPageAction.do"; 
}
function doValidate()
{
 return  "HrmAppTempSecValidateAction.do"; 
}

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

function ShowRatingCode()
{
  
  if(document.forms[0].screenMode.value=="Q")
  {
  
    document.forms[0].queryParam.value ="TmplId="+ document.forms[0].templateId.value +" " ;
    
    }
   
        document.forms[0].lovKey.value = "AprslRatingCode" + document.forms[0].screenName.value + document.forms[0].screenMode.value;
        document.forms[0].txtSearchFields.value = "hrm.HrmAppraisalTemplate.ratingCode";
        document.forms[0].txtDisplayFields.value = "ratingId,ratingCode";
        document.forms[0].multipleFlag.value = "false";
        showLov('<html:rewrite page="/hrms/jsp/CommonSearchScreen.jsp" />','HrmAppTempForm');
        return true;
    
}

function ShowTemplateName()
{
        document.forms[0].queryParam.value ="templateName="+ document.forms[0].templateName.value +" " ;
        document.forms[0].lovKey.value = "AprslTemplNameKPA" + document.forms[0].screenName.value + document.forms[0].screenMode.value;
        document.forms[0].txtSearchFields.value = "hrm.HrmAppraisalTemplate.templateName";
        document.forms[0].txtDisplayFields.value = "templateId,templateName";
        document.forms[0].multipleFlag.value = "false";
        showLov('<html:rewrite page="/hrms/jsp/CommonSearchScreen.jsp" />','HrmAppTempForm');
        return true;
}


function ShowParentCode(i)
{
        document.forms[0].lovKey.value = "AprslParentCode" + document.forms[0].screenName.value + document.forms[0].screenMode.value;
        document.forms[0].txtSearchFields.value = "hrm.HrmAppraisalTemplate.parentSection";
        document.forms[0].txtDisplayFields.value = "txtParentSecId,txtParentSection";
        document.forms[0].txtIndex.value = i;
        document.forms[0].queryParam.value="txtSectionCode="+ document.getElementsByName("txtSectionCode")[i].value+","+"txtHdrId="+ document.forms[0].headerPrimaryKey.value;
   
        // document.forms[0].multipleFlag.value = "false";
        showLov('<html:rewrite page="/hrms/jsp/CommonSearchScreen.jsp" />','HrmAppTempForm');
        return true;
}

function doApprove()
{
    document.forms[0].buttonName.value="butApprove";
    document.forms[0].action=contextRoot+"HrmAppTempSecButtonAction.do";
    document.forms[0].submit();
}
</script>