<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>离职申请管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		var validateForm;
		function doSubmit(obj){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            if(obj == 1){
                $('#flag').val('yes');
            }else{
                $('#flag').val('no');
            }
		  if(validateForm.form()){
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});

           			 laydate.render({
			            elem: '#date', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			            event: 'focus' //响应事件。如果没有传入event，则按照默认的click
			        });
            		laydate.render({
			            elem: '#endDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			            event: 'focus' //响应事件。如果没有传入event，则按照默认的click
			        });
		});

        function selectUserInfo(id) {
            $.ajax({
                type:'post',
                data:{
                    "id":id
                },
                url:'${ctx}/workregularapply/workRegularApply/userInfo',
                success:function(data){
                    setUserInfo(data);
                }
            })
        }
        function setUserInfo(obj){
            $("#sNo").val(obj.no);
            // $("#basicInfoId").val(obj.id);
            //$("#name").val(obj.name);
            $("#sStatus").val(obj.status);
            $("#sIdCard").val(obj.idCard);
            $("#sOffice").val(obj.office.name);
            $("#sJobGrade").val(obj.jobGrade.name);
            $("#entryDate").val(obj.entryDate);
            $("#baseSalary").val(obj.salary);
        }
	</script>
</head>
<body>
<div class="single-form view-form">
	<div class="container">
		<form:form id="inputForm" modelAttribute="workResignation" action="${ctx}/workresignation/workResignation/saveAudit" method="post" class="form-horizontal">
			<form:hidden path="id"/>
			<form:hidden path="home"/>
			<form:hidden path="act.taskId"/>
			<form:hidden path="act.taskName"/>
			<form:hidden path="act.taskDefKey"/>
			<form:hidden path="act.procInsId"/>
			<form:hidden path="act.procDefId"/>
			<form:hidden id="flag" path="act.flag"/>
			<sys:message content="${message}"/>
			<div class="form-group layui-row first lw16">
				<div class="form-group-label"><h2>基础信息</h2></div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>姓名：</label>
					<div class="layui-input-block with-icon">
						<div class="input-group">
							<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workResignation.workStaffBasicInfo.name}"/>
						</div>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">工号：</label>
					<div class="layui-input-block">
						<div class="input-group">
							<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workResignation.workStaffBasicInfo.no}"/>
							<span class="input-group-btn">
                            <label class="form-status"><c:choose><c:when test="${not empty workResignation.status}">${fns:getDictLabel(workResignation.status, 'audit_state', '')}</c:when><c:otherwise>新添</c:otherwise></c:choose></label>
                         </span>
						</div>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">员工状态：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workResignation.workStaffBasicInfo.status}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">身份证号码：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workResignation.workStaffBasicInfo.idCard}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">部门：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workResignation.workStaffBasicInfo.office.name}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">职级：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workResignation.jobGrade}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">基本工资：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workResignation.pay}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">入职日期：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  id="entryDate" readonly="true" class="form-control layui-input"
							   value="<fmt:formatDate value="${workResignation.workStaffBasicInfo.entryDate}" pattern="yyyy年MM月dd日"/>"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>离职类型：</label>
					<div class="layui-input-block">
						<input  htmlEscape="false" value="${fns:getDictLabel(workResignation.type, 'resignation_type', '')}" readonly="true" class="form-control layui-input"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">离职日期：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input"
							   value="<fmt:formatDate value="${workResignation.date}" pattern="yyyy年MM月dd日"/>"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>离职原因：</label>
					<div class="layui-input-block">
						<input  htmlEscape="false" value="${fns:getMainDictLabel(workResignation.reason, 'resignation_reason', '')}" readonly="true" class="form-control layui-input"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">考勤截止日期：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input"
							   value="<fmt:formatDate value="${workResignation.endDate}" pattern="yyyy年MM月dd日"/>"/>
					</div>
				</div>
			</div>
			<div class="form-group layui-row">
				<div class="form-group-label"><h2>审批意见</h2></div>
				<div class="layui-item layui-col-sm12 with-textarea">
					<label class="layui-form-label">审批意见：</label>
					<div class="layui-input-block">
						<form:textarea path="act.comment" class="form-control" rows="4" maxlength="127" />
						<input type="file" name="upload_files" style="display: none;">
					</div>
				</div>
			</div>

			<div class="form-group layui-row">
				<div class="form-group-label"><h2>审批流程</h2></div>
				<div class="layui-item layui-col-xs12 form-table-container" >
					<act:flowChart procInsId="${workResignation.act.procInsId}"/>
					<act:histoicFlow procInsId="${workResignation.act.procInsId}"/>
				</div>
			</div>
			<div class="form-group layui-row page-end"></div>
		</form:form>
	</div>
</div>
</body>
</html>