<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="cm" uri="/commons-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>请假类型</title>
<link href="../resources/style/base.css" rel="stylesheet" type="text/css"/>
<s:include value="../common/head.jsp" />
<script language="javascript" src="../resources/js/calendar/calendar.js"></script>
</head>

<body>
<s:include value="../common/body.jsp" />
<script language="javascript">
function changeYear(){
	var isYear=$("#attKindId").val()=="<s:property value='@com.hrmex.web.constants.ConstantCode$YesNo@YES'/>";	
	if(isYear){
		$("#yearBody").show();
		$("#yearTypeId").attr("disabled",false);
		$("#yearEnddayId").attr("disabled",false);
		$("#yearExprId").attr("disabled",false);		
	}else{
		$("#yearBody").hide();
		$("#yearTypeId").attr("disabled",true);
		$("#yearEnddayId").attr("disabled",true);
		$("#yearExprId").attr("disabled",true);
	}
}
$(function(){
	changeYear();
});
</script>

<s:form action="attLeaveTypeOperate" namespace="/att"  onsubmit="return checkForm(this)">

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr class="form_tr">
      <td align="right"><span class="required">•</span>公式编号：</td>
      <td >
      	<s:if test="leaveType.isSystem">
    		<s:property value="leaveType.varNo"/>
            <s:hidden name="leaveType.varNo" />
       	</s:if>
        <s:else>
        	<s:textfield name="leaveType.varNo" title="公式编号为必填项，且必须为数字。" cssStyle="width:50px;"/>
            <span class="info">在薪资帐套中会引用到公式编号。</span>
        </s:else>
       </td>
    </tr>
    <tr class="form_tr">
      <td align="right"><span class="required">•</span>名称：</td>
      <td >
        <s:if test="leaveType.isSystem">
    		<s:property value="leaveType.name"/>
          	<s:hidden name="leaveType.name" />
       	</s:if>
        <s:else>
        	 <s:textfield name="leaveType.name" maxlength="50" title="名称为必填项" cssStyle="width:225px;"/>
        </s:else>
      </td>
    </tr>
    <tr class="form_tr">
      <td align="right"><span class="required">•</span>是否包含节假日：</td>
      <td >
      <s:select cssStyle="width:225px;" title="是否包含节假日 为必填项"  name="leaveType.containHoliday.id"  list='#request.SysCodeFinder.find("YES_NO")'  headerKey="" headerValue="" listKey="id" listValue="codeName"/>
      </td>
    </tr>  
    <tr class="form_tr">
      <td align="right"><span class="required">•</span>是否为年额度型：</td>
      <td >
       <s:select cssStyle="width:225px;" id="attKindId" onchange="changeYear()" title="假期是否为年额度型 为必填项"  name="leaveType.isYearKind.id"  list='#request.SysCodeFinder.find("YES_NO")'  headerKey="" headerValue="" listKey="id" listValue="codeName"/>
      </td>
    </tr>
	<tbody id="yearBody" style="display:none;">
        <tr class="form_tr">
          <td align="right"><span class="required">•</span>额度有效期：</td>
          <td >
          <s:select id="yearTypeId" cssStyle="width:60px;" title="额度有效 为必填项"  name="leaveType.yearType.id"  list='#request.SysCodeFinder.find("ATT_LEAVE_YEAR_TYPE")'  headerKey="" headerValue="" listKey="id" listValue="codeName"/>
          <s:textfield id="yearEnddayId" name="leaveType.yearEndday" title="额度有效 为必填项" readonly="true" onClick="showCalendar('MM-dd',this)" cssClass="date_input" cssStyle="width:155px;"/>
          </td>
        </tr>      
        <tr class="form_tr">
          <td align="right" valign="top"><span class="required">•</span>额度计算公式：</td>
          <td  valign="top"><s:textarea id="yearExprId" name="leaveType.yearExpr" title="本年额度计算公式 为必填项" cssStyle="width:225px;height:50px;"/>
           <div class="info">
           		以上公式计算结果值单位为<strong>“天”</strong>
           </div>
		   <div style="margin:5px 0 0 0;">
		   <a href="javascript:showHide('varBox')">[查看可引用的公式变量]</a>
		   </div>
           <div id="varBox" style="width:265px; font-size:13px; line-height:20px; border:1px #E4E4E4 solid; padding:5px; background-color:#FFF; display:none;">
           	   <s:iterator value="varList" status="st">  
                <div>
                	<span class="code_box"><s:property value="varName"/></span><s:property value="varDesc"/>
                </div>
                </s:iterator>
                <div><strong>注意：</strong>以上公式变量的值，是以当年的12月31日为截止日期进行计算的。</div>
             </div>           
          </td>
        </tr>
        <tr class="form_tr">
          <td align="right" valign="top"><span class="required">•</span>计算结果最小单位：</td>
          <td valign="top">    
				<s:select id="yearUnitId" cssStyle="width:225px;" title="计算结果最小单位 为必填项"  name="leaveType.yearUnit.id"  list='#request.SysCodeFinder.find("ATT_LEAVE_RESULT_MIN_UNIT_TYPE")'  headerKey="" headerValue="" listKey="id" listValue="codeName"/>   
          </td>
        </tr>        
    </tbody>  
    <tr class="form_tr">
      <td align="right"><span class="required">•</span>状态：</td>
      <td ><s:select cssStyle="width:225px;" title="状态 为必填项"  name="leaveType.recordStatus"  list='@com.hrmex.web.constants.EnumRecordStatus@values()'  headerKey="" headerValue="" listKey="code" listValue="desc"/></td>
    </tr>
    <tr class="form_tr">
      <td align="right">备注：</td>
      <td ><s:textarea name="leaveType.descr"  cssStyle="width:225px;height:50px;"/></td>
    </tr>        
    <tr class="form_tr">
      <td width="35%" align="right">&nbsp;</td>
      <td width="65%" >
        <s:if test="oper=='edit'">
          <input type="submit" name="button" id="button" value="修 改" />
          </s:if>
        <s:if test="oper=='add'">
          <input type="submit" name="button" id="button" value="添 加" />
          </s:if>
        &nbsp; 
        <!-- back begin -->
        <input name="winID" type="hidden" value="${param.winID}" />
        <input type="button" onclick="iframeWindowClose('${param.winID}')" name="button" id="button" value="返 回" />  
        <!-- back end -->
        <s:hidden name="leaveType.id" />
        <s:hidden name="oper" />
        </td>
    </tr>
  </table>
    
</s:form>
</body>
</html>