<%@ 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;
        $(document).ready(function() {

            validateForm = $("#inputForm").validate({
                submitHandler: function(form){
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                rules:{
                },
                messages:{
                },
                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);
                    }
                }
            });
        });
        function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            if(validateForm.form()){
                $("#inputForm").submit();
                return true;
            }else {
                parent.layer.msg("信息未填写完整!", {icon: 5});
            }
            return false;
        }

        function isNumber(val){
            if(val === "" || val ==null){
                return false;
            }
            var regPos = /^\d+(\.\d+)?$/; //非负浮点数
            var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
            if(regPos.test(val) || regNeg.test(val)){
                return true;
            }else{
                return false;
            }

        }

	</script>
	<style>
		/*超过5个汉字，调整label的长度，以下是配套的*/
		.layui-item .layui-form-label{
			width:90px;
		}
		.form-group .layui-item .layui-input-block,
		.query .layui-input-block {
			margin-left: 116px;
		}
	</style>
</head>
<body>
<div class="single-form">
	<div class="container view-form">
		<form:form id="inputForm" modelAttribute="leaveType" action="${ctx}/leavetype/leaveType/save" method="post" class="form-horizontal" >
			<form:hidden path="id"/>
			<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"><span class="require-item">*</span>假期名称：</label>
					<div class="layui-input-block">
						<form:input path="name" htmlEscape="false" readonly="true"  id="name"  class="form-control required layui-input" />
					</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">
						<form:input path="no" htmlEscape="false" readonly="true"  id="no"  class="form-control number required layui-input" />
					</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="parentName" htmlEscape="false" readonly="true"  id="no"  class="form-control number required layui-input" />
					</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">
						<form:input path="state" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${fns:getDictLabel(leaveType.state, 'is_disable', '')}"/>
					</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">
						<form:input path="model" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${fns:getDictLabel(leaveType.model, 'fake_model', '')}"/>
					</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">
						<form:input path="unit" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${fns:getDictLabel(leaveType.unit, 'false_unit', '')}"/>
					</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">
						<form:input path="method" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${fns:getDictLabel(leaveType.method, 'cumulative_way', '')}"/>
					</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">
						<form:input path="zero" readonly="true"  htmlEscape="false"   id="zero"  class="form-control number required layui-input" />
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label double-line"><span class="require-item">*</span>假期上限天数：</label>
					<div class="layui-input-block">
						<form:input path="maxDays" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${fns:getDictLabel(leaveType.maxDays, 'max_days', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label double-line"><span class="require-item">*</span>是否计算出勤：</label>
					<div class="layui-input-block">
						<form:input path="isAttendance" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${fns:getDictLabel(leaveType.isAttendance, 'yes_no', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label double-line"><span class="require-item">*</span>是否计算补助：</label>
					<div class="layui-input-block">
						<form:input path="isSubsidized" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${fns:getDictLabel(leaveType.isSubsidized, 'yes_no', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label double-line"><span class="require-item">*</span>是否结转下年：</label>
					<div class="layui-input-block">
						<form:input path="isNext" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${fns:getDictLabel(leaveType.isNext, 'yes_no', '')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12  with-textarea">
					<label class="layui-form-label"><span class="require-item">*</span>设置天数：</label>
					<div class="layui-input-block">
						<form:textarea path="setDays" readonly="true"  htmlEscape="false" rows="4"    maxlength="255" class="form-control required"/>
					</div>
				</div>
			</div>

			<div class="form-group layui-row page-end"></div>
		</form:form>
	</div>
</div>

</body>
</html>