<%@ 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">
        $(document).ready(function() {
            laydate.render({
                elem: '#beginDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                format: 'yyyy-MM-dd',
                type : 'date'
            });

            laydate.render({
                elem: '#endDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                format: 'yyyy-MM-dd',
                type : 'date'
            });
        });
        function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            if(validateForm.form()){
                $("#inputForm").submit();
                return true;
            }
            return false;
        }
        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 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">
        <form:form id="inputForm" modelAttribute="projectPlanWeekly" action="${ctx}/projectplan/weekly/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">
                        <input path="id" type="hidden"  id="id"  class="form-control required layui-input" value="${projectPlanWeekly.id}"/>
                        <input path="user.name" htmlEscape="false" readonly="readonly"   id="userId"  class="form-control required layui-input" value="${projectPlanWeekly.user.name}"/>
                    </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 path="office.name" htmlEscape="false" readonly="readonly"   id="officeId"  class="form-control required layui-input" value="${projectPlanWeekly.office.name}"/>
                    </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 id="beginDate" name="beginDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date required layui-input"
                               value="<fmt:formatDate value="${projectPlanWeekly.beginDate}" 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 id="endDate" name="endDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date required layui-input"
                               value="<fmt:formatDate value="${projectPlanWeekly.endDate}" pattern="yyyy-MM-dd"/>"/>
                    </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="remarks"  htmlEscape="false" rows="5" maxlength="127" readonly="true" class="form-control"/>
                    </div>
                </div>
                <c:if test="${projectPlanWeekly.weeklyStatus} !='0'">
                    <div class="layui-item layui-col-sm12  with-textarea" style="margin-top: 10px">
                        <label class="layui-form-label">未完成原因：</label>
                        <div class="layui-input-block">
                            <form:textarea path="remarksReason"  htmlEscape="false" rows="5" maxlength="127" readonly="true" class="form-control"/>
                        </div>
                    </div>
                </c:if>
            </div>
            <div class="form-group layui-row page-end"></div>
        </form:form>
    </div>
</div>
</body>
</html>
