<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改入学时间')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-time-edit" th:object="${tbEnrollmentTime}">
            <input name="id" th:field="*{id}" type="hidden">
<!--            <input name="id" th:field="*{schoolCnName}" type="hidden">-->
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">学校：</label>
                <div class="col-sm-8">
                    <input id="schoolCnName" th:field="*{schoolCnName}" class="form-control" type="text" disabled="true">
                </div>
            </div>
<!--            <input name="id" th:field="*{majorName}" type="hidden">-->
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">专业：</label>
                <div class="col-sm-8">
                    <input  id="majorName" th:field="*{majorName}" class="form-control" type="text" disabled="true">
                </div>
            </div>
<!--            <input name="id" th:field="*{majorName}" type="hidden">-->
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">学位：</label>
                <div class="col-sm-8">
                    <input id="degreeCnName" th:field="*{degreeCnName}" class="form-control" type="text" disabled="true">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">入学时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="enrollmentTime" th:value="${#dates.format(tbEnrollmentTime.enrollmentTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">申请开始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="applyStartDate" th:value="${#dates.format(tbEnrollmentTime.applyStartDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">申请结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="applyEndDate" th:value="${#dates.format(tbEnrollmentTime.applyEndDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/time";
        $("#form-time-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-time-edit').serialize());
            }
        }

        $("input[name='enrollmentTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='applyStartDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='applyEndDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        // $(document).ready(function() {
        //     <!--异步请求-->
        //     $.ajax({
        //         <!--请求路径，与后端对应-->
        //         url: ctx + "system/school/getList",
        //         <!--请求类型-->
        //         type: "get",
        //         <!--期待的返回数据类型-->
        //         dataType: "json",
        //         <!--前端接收数据成功是执行的该函数-->
        //         success: function (data) {
        //             <!--使用循环解析后端传来的数据，并用使用js动态拼接html语言-->
        //             for (var i = 0; i < data.length; i++)
        //                 $("#schoolId").append("<option value='" + data[i].id + "'>" + data[i].schoolCnName + "</option>");
        //             var vtext1 = $("#schoolCnName")[0].value;
        //             $("#schoolId").find("option").each(function(){
        //                 if($(this).text() == vtext1)	{
        //                     $(this).attr("selected",true);
        //                 }
        //             });
        //         }
        //     });
        //
        //     $('#schoolId').change(function () {
        //         var sid=$('#schoolId')[0].value;
        //         $.ajax({
        //             <!--请求路径，与后端对应-->
        //             url: prefix + "/selectSchool/"+sid,
        //             <!--请求类型-->
        //             type: "get",
        //             <!--期待的返回数据类型-->
        //             dataType: "json",
        //             <!--前端接收数据成功是执行的该函数-->
        //             success: function (data) {
        //                 <!--使用循环解析后端传来的数据，并用使用js动态拼接html语言-->
        //                 for (var i = 0; i < data.length; i++)
        //                     $("#campusId").append("<option value='" + data[i].id + "'>" + data[i].schoolCampus + "</option>");
        //             }
        //         });
        //     });
        //
        //     $('#campusId').change(function () {
        //         var cid=$('#campusId')[0].value;
        //         $.ajax({
        //             <!--请求路径，与后端对应-->
        //             url: prefix + "/selectMajor/"+cid,
        //             <!--请求类型-->
        //             type: "get",
        //             <!--期待的返回数据类型-->
        //             dataType: "json",
        //             <!--前端接收数据成功是执行的该函数-->
        //             success: function (data) {
        //                 <!--使用循环解析后端传来的数据，并用使用js动态拼接html语言-->
        //                 for (var i = 0; i < data.length; i++)
        //                     $("#majorId").append("<option value='" + data[i].id + "'>" + data[i].majorCnName + "</option>");
        //             }
        //         });
        //     });
        //
        // });
    </script>
</body>
</html>