<%@ 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 type="text/javascript">
function applyAdd(){
	iframeWindow("<s:url action='attOvertimeApplyOperate'/>?oper=add",600,400,"添加加班单",refreshWindow);
}

function applyEdit(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择一条您要修改的记录。");
		return;
	}
	iframeWindow("<s:url action='attOvertimeApplyOperate'/>?oper=edit&apply.id="+getCheckedValue("sid"),600,400,
		"修改加班单",refreshWindow);
}

function applyDel(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择一条您要删除的加班单。");
		return;
	}
	msgConfirm("您确认要删除该加班单吗？",function(){
		iframeWindow("<s:url action='attOvertimeApplyDelete'/>?apply.id="+getCheckedValue("sid"),400,180,
			"删除加班单",refreshWindow);		
	});
}

function applySubmit(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择一条您要提交申请的加班单。");
		return;
	}
	msgConfirm("您确认提交申请吗？",function(){
		iframeWindow("<s:url action='attOvertimeApplySubmit'/>?apply.id="+getCheckedValue("sid"),400,180,
			"提交申请",refreshWindow);		
	});
}

function flowDetail(nodeId){
	iframeWindow("<s:url action='attApproveFlowDetail'/>?node.id="+nodeId,550,300,"审批流程");
}

</script>
</head>

<body>
<div class="body_list">
<s:include value="../common/body.jsp" />
<s:form action="attOvertimeApplyMineList" id="queryForm" onsubmit="return checkForm(this)">
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_line">
      <tr class="form_title">
        <td colspan="7">查询条件</td>
      </tr>
      <tr class="form_item">
        <td>工号：<s:textfield name="apply.applyEmplInfo.emplNo" title="工号必须为数字。" cssStyle="width:100px;"/></td>
        <td>部门：<s:textfield name="apply.applyEmplInfo.emplOrg.name" readonly="true" onClick="codeTree('emplOrgTree',gi('eimpOrgId'),this)" cssStyle="width:100px;" cssClass="find_input"/>
          <s:hidden name="apply.applyEmplInfo.emplOrg.id" id="eimpOrgId"/></td>
        <td>是否调休：
        <s:select cssStyle="width:100px;" name="apply.swapFlag.id" list='#request.SysCodeFinder.find("YES_NO")' headerKey="" headerValue="" listKey="id" listValue="codeName"/>
        </td>
        <td colspan="2">加班时间：
          <s:textfield name="apply.beginTime" readonly="true" onClick="showDate(this)" cssClass="date_input" cssStyle="width:85px;">
            <s:param name="value">
              <s:date name="apply.beginTime" format="yyyy-MM-dd"/>
            </s:param>
          </s:textfield>
          至
          <s:textfield name="apply.endTime" readonly="true" onClick="showDate(this)" cssClass="date_input" cssStyle="width:85px;">
            <s:param name="value">
              <s:date name="apply.endTime" format="yyyy-MM-dd"/>
            </s:param>
          </s:textfield></td>
      </tr>
      <tr class="form_item1">
        <td width="20%">姓名：<s:textfield name="apply.applyEmplInfo.name" cssStyle="width:100px;"/></td>
        <td width="20%">状态：<s:select cssStyle="width:100px;" name="apply.status.id" list='#request.SysCodeFinder.find("ATT_OVERTIME_APPLY_STATUS")' headerKey="" headerValue="" listKey="id" listValue="codeName"/></td>
        <td width="24%">加班原因：
          <s:textfield name="apply.cause" cssStyle="width:100px;"/></td>
        <td width="25%">　创建人：
          <s:textfield name="apply.createEmplInfo.name" cssStyle="width:100px;"/></td>
        <td width="11%" class="center"><input name="q" value="查 询" onclick="query()" type="button" /></td>
      </tr>
    </table>  
  
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"  style="margin:15px 0 5px 0;" >
    <tr>
      <td>
        <input type="button" name="delete" onclick="applyAdd()" value="添 加"/>
        <input type="button" name="delete" onclick="applyEdit()" value="修 改"/>
        <input type="button" name="delete" onclick="applyDel()" value="删 除"/>
        <input type="button" name="delete" onclick="applySubmit()" value="提交申请"/>
        <input type="button" name="delete" onclick="sysOperLog()" value="查看日志"/>
      </td>
    </tr>
  </table>
  
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_line">
    <tr class="list_title">
      <td width="3%" align="center"><input type="radio" name="array" onclick="checkedAll(this)" value="checkbox" /></td>
      <td width="6%">工号</td>
      <td width="5%">姓名</td>
      <td width="9%">部门</td>
      <td width="15%">加班时间</td>
      <td width="5%">是否<br />
        调休</td>
      <td width="14%">调休时间<br />
        总计|已调休|审批中</td>
      <td width="8%">调休截止</td>
      <td width="13%">加班原因</td>
      <td width="8%">申请时间</td>
      <td width="6%">创建人 </td>
       <td width="8%">状态</td>
      </tr>
    <s:iterator value="applyList" status="st">
        <s:set name="row_cls" value=""/><s:if test="#st.Even"><s:set name="row_cls" value="%{'row_a'}"/></s:if>
        <tr class="list_data <s:property value='#row_cls'/>">
          <td align="center"><input type="radio" name="array" value="<s:property value='id'/>" lang="sid"/>
          <s:hidden name="log_%{id}" value="%{#request.SysOperLogID.format('ATT_OVERTIME_APPLY',id)}" />
          </td>
          <td class="center"><s:property value="applyEmplInfo.emplNo"/></td>
          <td class="center"><s:property value="applyEmplInfo.name"/></td>
          <td class="center"><s:property value="applyEmplInfo.emplOrg.name"/></td>
          <td class="center" 
          	title='<s:date name="beginTime" format="yyyy-MM-dd HH:mm"/>至<s:date name="endTime" format="yyyy-MM-dd HH:mm"/>'>
          		<s:date name="beginTime" format="MM-dd HH:mm"/>至<s:date name="endTime" format="MM-dd HH:mm"/>
				<br />（<s:property value="overtimes"/>小时）
          </td>
          <td class="center"><s:property value="swapFlag.codeName"/></td>
          <td class="center">
          	<s:if test="swapTotal!=null">
          	<s:property value="swapTotal"/> | <s:property value="swapUsed"/> |  <s:property value="swapFreeze"/> 小时
            </s:if>
          </td>
          <td class="center"><s:date name="swapEnd" format="yyyy-MM-dd"/></td>
          <td><s:property value="cause"/></td>
          <td class="center" title='<s:date name="swapEnd" format="yyyy-MM-dd HH:mm"/>'>
          	<s:date name="createTime" format="MM-dd HH:mm"/>
          </td>
          <td class="center"><s:property value="createEmplInfo.name"/></td>          
               <td class="center" title="">
            <s:property value="status.codeName"/>
            <s:if test="attApproveLog!=null"> 
			 <br />
             <span style="color:#666; font-size:12px;" 
                	title="等待【<s:property value='attApproveLog.approver.name'/>】审批...">
					<a href="javascript:flowDetail('<s:property value='attApproveLog.attApproveFlowNode.id'/>');">（<s:property value='attApproveLog.approver.name'/>）</a>
			 </span>
			</s:if>			
          </td>   
        </tr>
    </s:iterator>
  </table>
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="list_page">
    <tr>
      <td width="44%" style="text-align:left;">当前总计可调休时间：<s:property value="plaintext"/>小时</td>
      <td width="56%"><cm:pager/></td>
    </tr>
  </table>

</s:form>
</div>
</body>
</html>