<%@ 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(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  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);
					}
				}
			});
			
		});
	</script>
</head>
<body>
<div class="single-form">
	<div class="container view-form">
		<form:form id="inputForm" modelAttribute="workAttendanceInfo" action="${ctx}/workattendance/workAttendanceInfo/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<div class="form-group layui-row first">
				<div class="form-group-label"><h2>基本信息</h2></div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">工号:</label>
					<div class="layui-input-block with-icon">
						<form:input path="workStaffBasicInfo.no" htmlEscape="false" readonly="true" maxlength="30" class="form-control layui-input required"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">姓名:</label>
					<div class="layui-input-block">
						<form:input path="workStaffBasicInfo.name" htmlEscape="false" readonly="true" maxlength="30" class="form-control layui-input required"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">考勤日期:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="<fmt:formatDate value="${workAttendanceInfo.attendanceDate}" pattern="yyyy-MM-dd"/>"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">日期类型:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="${fns:getDictLabel(workAttendanceInfo.dateType, 'holidays_type', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">是否加班:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="${fns:getDictLabel(workAttendanceInfo.isOvertime, 'yes_no', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">加班时长:</label>
					<div class="layui-input-block with-icon">
						<form:input path="overtimeTime" htmlEscape="false" readonly="true" maxlength="30" class="form-control layui-input required"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">考勤类型:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="${fns:getDictLabel(workAttendanceInfo.attendanceType, 'attendance_info_type', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">假期名称:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="${workAttendanceInfo.leaveTypeName}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label double-line">是否计算出勤:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="${fns:getDictLabel(workAttendanceInfo.isCalculateAttendance, 'yes_no', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label double-line">是否计算补助:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="${fns:getDictLabel(workAttendanceInfo.isCalculateSubsidies, 'yes_no', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">考勤方式:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="${fns:getDictLabel(workAttendanceInfo.type, 'attendance_type', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">考勤时间:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="<fmt:formatDate value="${workAttendanceInfo.attendanceTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">考勤地点:</label>
					<div class="layui-input-block with-icon">
						<form:input path="attendancePlace" htmlEscape="false" readonly="true" maxlength="30" class="form-control layui-input required"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">是否迟到:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="${fns:getDictLabel(workAttendanceInfo.lateEarly, 'lateEarly', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">迟到时长:</label>
					<div class="layui-input-block with-icon">
						<form:input path="lateEarlyTime" htmlEscape="false" readonly="true" maxlength="30" class="form-control layui-input required"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label double-line">外勤出差是否有效:</label>
					<div class="layui-input-block with-icon">
						<input htmlEscape="false" readonly="true"  class="form-control layui-input" value="${fns:getDictLabel(workAttendanceInfo.isValid, 'yes_no', '')}"/>
					</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" >
					<table id="upTable" class="table table-bordered table-condensed details">
						<thead>
						<tr>
								<%-- <th>序号</th>--%>
							<th>文件预览</th>
							<th>上传人</th>
							<th>上传时间</th>
							<th width="150px">操作</th>
						</tr>
						</thead>
						<tbody id="file_attachment">
						<c:forEach items="${workAttendanceInfo.workAttachments}" var = "workClientAttachment" varStatus="status">
							<tr>
									<%-- <td>${status.index + 1}</td>--%>
								<c:choose>
									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}">
									</c:when>
									<c:otherwise>
										<c:choose>
											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
												<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','95%','95%','1')">${workClientAttachment.attachmentName}</a></td>
											</c:when>
											<c:otherwise>
												<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','95%','95%')">${workClientAttachment.attachmentName}</a></td>
											</c:otherwise>
										</c:choose>
									</c:otherwise>
								</c:choose>
								<td>${workClientAttachment.createBy.name}</td>
								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
								<td class="op-td">
									<div class="op-btn-box" >
										<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
											<%--   <c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
                                                   <a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFile')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
                                               </c:if>--%>
									</div>
								</td>
							</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
		</form:form>
	</div>
</div>
</body>
</html>