<%@ 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="../code/vm/ExtCodeJs.htm"></script>
<script language="javascript" src="../resources/js/calendar/calendar.js"></script>
<script language="javascript">
function totalSwapHours(){
	var eid=$("#applyEmplInfoId").val();
	if(eid==""){
		showErrorBox(gi("applyEmplInfoId"));
		msgAlert("计算可调休时间之前，必须选择 “请假员工”。");
		return;
	}
	var endDate=$("#endTimeId").val();
	if(endDate==""){
		showErrorBox(gi("endTimeId"));
		msgAlert("计算可调休时间之前，必须选择请假 “结束时间”。");
		return;
	}
	endDate=endDate.substring(0,10);
	var calUrl="<s:url namespace='/att' action='attOvertimeApplyCalSwapHours'/>?apply.applyEmplInfo.id="+eid+"&apply.swapEnd="+endDate+"&uid="+getCodeUniqueID();

	$.get(calUrl, function(data){
		$("#swapHourId").html(endDate+" 及之前可调休 "+data+" 小时");
  	});
}

</script>
</head>

<body>
<s:include value="../common/body.jsp" />

<s:form action="attLeaveApplyOperate" 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 valign="top">
      <s:textfield name="apply.applyEmplInfo.name" readonly="true"  cssClass="find_input"  onClick="codeTable('emplInfoTable',gn('apply.applyEmplInfo.id'),this)" cssStyle="width:275px;"/>
      <s:hidden name="apply.applyEmplInfo.id" id="applyEmplInfoId"/>
      </td>
    </tr>
    <tr class="form_tr">
      <td align="right"><span class="required">•</span>请假类型：</td>
      <td valign="top">
      	    <s:textfield name="apply.attLeaveType.name" title="请假类型 为必填项" readonly="true" cssClass="find_input" onClick="codeTable('attLeaveTypeTable',gn('apply.attLeaveType.id'),this)" cssStyle="width:275px;"/>
      		<s:hidden name="apply.attLeaveType.id"/>
      </td>
    </tr>
    <tr class="form_tr">
      <td align="right"><span class="required">•</span>请假时间：</td>
      <td valign="top">
      <s:textfield name="apply.beginTime" title="请假时间 为必填项" readonly="true" onClick="showDateTime(this)" cssClass="date_input" cssStyle="width:125px;">
      		<s:param name="value"><s:date name="apply.beginTime" format="yyyy-MM-dd HH:mm"/></s:param>
      </s:textfield>
      至
      <s:textfield id="endTimeId" name="apply.endTime" title="请假时间 为必填项" readonly="true" onClick="showDateTime(this)" cssClass="date_input" cssStyle="width:125px;">
      		<s:param name="value"><s:date name="apply.endTime" format="yyyy-MM-dd HH:mm"/></s:param>
      </s:textfield>
      </td>
    </tr>
    <tr class="form_tr">
      <td align="right">&nbsp;</td>
      <td valign="top" style="padding:0 0 10px 0;">
	  <div class="info">
      	提示：<a href="javascript:totalSwapHours()">[点击计算]</a>请假结束时间之前的可调休时间。
		</div>
        <div id="swapHourId" style="color:#F00; font-size:14px; padding:5px;"></div>
      </td>
    </tr>
    <tr class="form_tr">
      <td align="right"><span class="required">•</span>请假事由：</td>
      <td valign="top"><s:textarea name="apply.cause" title="请假事由 为必填项" cssStyle="width:275px;height:80px;"/></td>
    </tr>
    <tbody id="yearBody" style="display:none;">
    </tbody>
    <tr class="form_tr">
      <td width="31%" align="right">&nbsp;</td>
      <td width="69%" valign="top"><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="apply.id" />
        <s:hidden name="oper"/></td>
    </tr>
  </table>
</s:form>
</body>
</html>