<%@ 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);
                    }
                }
            });
        });

        function setParentInfo(ids,names,nos,salarys){
            var $no = $("#no");
            var val = $no.val();
            $no.val(nos[0]+val);
        }

        function formatNum(obj) {
            var val = $(obj).val();
            if(val==null||val==''|| isNaN(val))return;
            var money = parseFloat((val + "").replace(/[^\d\.-]/g, "")).toFixed(2) + "";
            var l = money.split(".")[0].split("").reverse(),
                r = money.split(".")[1];
            t = "";
            for(i = 0; i < l.length; i ++ )
            {
                t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
            }
            $(obj).val(t.split("").reverse().join("") + "." + r);
        }

	</script>
</head>
<body>
<div class="single-form">
    <div class="container view-form">
		<form:form id="inputForm" modelAttribute="workJobGrade" action="${ctx}/workjobgrade/workJobGrade/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" class="form-control 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" 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" readonly="true" value="${workJobGrade.parent.name}" 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">
                        <form:input path="isLeaf" htmlEscape="false" readonly="true" class="form-control 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">
                        <input name="pay" htmlEscape="false" readonly onchange="formatNum(this)" value="<fmt:formatNumber pattern="#,##0.00#" value="${workJobGrade.pay}"/>" class="form-control layui-input required number"/>
                    </div>
                </div>
                <div class="layui-item layui-col-sm6">
                    <label class="layui-form-label">禁用状态：</label>
                    <div class="layui-input-block">
                        <form:input path="state" htmlEscape="false" readonly="true" class="form-control layui-input"/>
                    </div>
                </div>
                <div class="layui-item layui-col-sm12 with-textarea">
                    <label class="layui-form-label">职级描述：</label>
                    <div class="layui-input-block">
                        <form:textarea path="remarks" htmlEscape="false" readonly="true" rows="3" style="resize:none;" class="form-control"/>
                    </div>
                </div>
            </div>
	    </form:form>
    </div>
</div>
</body>
</html>