<%@ 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(validateForm.form()){
                if(obj == 1){
                    if($("#officeId").val()==null || $("#officeId").val()==''){
                        parent.layer.msg("请输入用户部门!", {icon: 2});
                        return false;
                    }
                    if($("#roleIdsId").val()==null || $("#roleIdsId").val()==''){
                        parent.layer.msg("请输入用户岗位!", {icon: 2});
                        return false;
                    }
                    $('#flag').val('yes');
                }else{
                    $('#flag').val('no');
                }
                $("#inputForm").submit();
                return true;
            }

            return false;
        }
        $(document).ready(function() {
            $("#name").focus();
            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({
                elem: '#startTime', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                event: 'focus' //响应事件。如果没有传入event，则按照默认的click
            });
            laydate({
                elem: '#endTime', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                event: 'focus' //响应事件。如果没有传入event，则按照默认的click
            });
        });
    </script>
</head>
<body>
<div class="single-form">
    <div class="container">
            <form:form id="inputForm" modelAttribute="companyinfo" action="${ctx}/sys/company/saveApplyOnCompany" 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"/>

                <div class="form-group layui-row first lw6">
                    <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="user.loginName" readonly="true" htmlEscape="false" minlength="11" maxlength="11" class="form-control layui-input required number text-muted isMobile userName"/>
                        </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="user.mobile" readonly="true" htmlEscape="false" maxlength="11" minlength="11" class="form-control layui-input text-muted number required isMobile"/>
                        </div>
                    </div>
                    <div class="layui-item layui-col-sm6">
                        <label class="layui-form-label">邮箱：</label>
                        <div class="layui-input-block">
                            <form:input path="user.email" readonly="true" htmlEscape="false" maxlength="100" class="form-control layui-input email"/>
                        </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="user.name" readonly="true" htmlEscape="false" maxlength="50" 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="name" readonly="true" value="${office.name}" class="form-control layui-input required"/>
                            <input type="hidden" name="companyId" value="${companyinfo.companyId}"/>
                        </div>
                    </div>
                    <div class="layui-item layui-col-sm6">
                        <label class="layui-form-label">审批管理员：</label>
                        <div class="layui-input-block">
                            <form:input path="name"  readonly="true" value="${companyinfo.masterName}" class="form-control layui-input required"/>
                            <input type="hidden" name="master" value="${companyinfo.master}"/>
                            <input type="hidden" name="userId" value="${companyinfo.userId}"/>
                        </div>
                    </div>
                    <div class="layui-item layui-col-sm6">
                        <label class="layui-form-label">归属部门：</label>
                        <div class="layui-input-block">
                            <div class="input-group with-icon">
                                <sys:treeselect id="office" name="user.office.id" value="${companyinfo.user.office.id}" labelName="user.office.name" labelValue="${companyinfo.user.office.name}"
                                                title="部门" url="/sys/office/treeData?type=2" cssClass="form-control  layui-input" notAllowSelectParent="true"/>
                            </div>
                        </div>
                    </div>
                    <div class="layui-item layui-col-sm6">
                        <label class="layui-form-label">用户岗位：</label>
                        <div class="layui-input-block with-icon">
                            <sys:treeselectRole id="roleIds" name="user.roleIds" value="${companyinfo.user.roleIds}" labelName="user.roleNames" labelValue="${companyinfo.user.roleNames}"
                                                title="选择岗位" url="/sys/office/treeDataRole?type=2&isAll=false&userId=${user.id}" cssClass="form-control layui-input" allowClear="true" notAllowSelectParent="true"/>
                            <label id="roleIdList-error" class="error" for="roleIds"></label>
                        </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="act.comment" class="form-control"  rows="4" maxlength="127"/>
                        </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="${companyinfo.act.procInsId}"/>
                        <act:histoicFlow procInsId="${companyinfo.act.procInsId}"/>
                    </div>
                </div>--%>
                <div class="form-group layui-row page-end"></div>
            </form:form>
    </div>
</div>
</body>
</html>

