<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-teachFileCollection-edit" th:object="${teachFileCollection}">
        <input id="studentId" name="studentId" th:field="*{studentId}" type="hidden">
        <input id="classId" name="classId" th:field="*{classNo}" type="hidden">
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">课工场账号：</label>
                <div class="col-sm-8">
                    <input id="kgcNo" name="kgcNo" th:field="*{kgcNo}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">课工场uid：</label>
                <div class="col-sm-8">
                    <input id="kgcUid" name="kgcUid" th:field="*{kgcUid}" required="required" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">课工场昵称：</label>
                <div class="col-sm-8">
                    <input id="kgcNickname" name="kgcNickname" th:field="*{kgcNickname}" class="form-control"
                           type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8">
                    <!--<input id="status" name="status" th:field="*{status}" class="form-control" type="text">-->
                    <select id="status" name="status" class="form-control m-b"
                            th:with="type=${@dict.getType('teach_status')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:field="*{status}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">学生姓名：</label>
                <div class="col-sm-8">
                    <input id="studentName" name="studentName" th:field="*{studentName}" class="form-control"
                           type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">进班时间(报档时间)：</label>
                <div class="col-sm-8">
                    <input id="startTime" name="startTime" th:field="*{startTime}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">学生项目的地址：</label>
                <div class="col-sm-8">
                    <input id="postname" name="postname" th:field="*{postname}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">学生性别：</label>
                <div class="col-sm-8">
                    <!--<input id="studentSex" name="studentSex" th:field="*{studentSex}" class="form-control" type="text">-->
                    <select id="studentSex" name="studentSex" class="form-control m-b"
                            th:with="type=${@dict.getType('sys_user_sex')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:field="*{studentSex}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">籍贯：</label>
                <div class="col-sm-8">
                    <input id="nativePlace" name="nativePlace" th:field="*{nativePlace}" class="form-control"
                           type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">身份证号：</label>
                <div class="col-sm-8">
                    <input id="idCardNo" name="idCardNo" th:field="*{idCardNo}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">电话：</label>
                <div class="col-sm-8">
                    <input id="phone" name="phone" th:field="*{phone}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">学历：</label>
                <div class="col-sm-8">
                    <!--<input id="education" name="education" th:field="*{education}" class="form-control" type="text">-->
                    <select id="education" class="form-control m-b" th:with="type=${@dict.getType('teach_education')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{education}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">邮箱：</label>
                <div class="col-sm-8">
                    <input id="mail" name="mail" th:field="*{mail}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">家庭地址：</label>
                <div class="col-sm-8">
                    <input id="address" name="address" th:field="*{address}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">班级：</label>
                <div class="col-sm-8">
                    <input id="classNo" name="classNo" readonly="readonly" th:field="*{className}" class="form-control"
                           type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">学生来源：</label>
                <div class="col-sm-8">
                    <select id="extend1" class="form-control m-b"
                            th:with="type=${@dict.getType('teach_student_source')}">
                        <option value="">请选择</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:field="*{extend1}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">学前工作经历：</label>
                <div class="col-sm-8">
                    <input id="workExperience" name="workExperience" th:field="*{workExperience}" class="form-control"
                           type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">是否有基础：</label>
                <div class="col-sm-8">
                    <select id="base" name="base" class="form-control m-b"
                            th:with="type=${@dict.getType('teach_basic')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:field="*{base}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">毕业院校：</label>
                <div class="col-sm-8">
                    <input id="graduateInstitutions" name="graduateInstitutions" th:field="*{graduateInstitutions}"
                           class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">英语水平：</label>
                <div class="col-sm-8">
                    <select id="englishLevel" class="form-control m-b"
                            th:with="type=${@dict.getType('teach_english_level')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:field="*{englishLevel}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">专业：</label>
                <div class="col-sm-8">
                    <input id="major" name="major" th:field="*{major}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">学历性质：</label>
                <div class="col-sm-8">
                    <!--<input id="degreeInNature" name="degreeInNature" th:field="*{degreeInNature}" class="form-control"
                           type="text">-->
                    <select id="degreeInNature" name="degreeInNature" class="form-control m-b" th:with="type=${@dict.getType('teach_nature')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{degreeInNature}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">毕业时间：</label>
                <div class="col-sm-8">
                    <input id="graduateDate" name="graduateDate" th:field="*{graduateDate}" class="form-control"
                           type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">教材编号：</label>
                <div class="col-sm-8">
                    <input id="textbookNo" name="textbookNo" th:field="*{textbookNo}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">通行证：</label>
                <div class="col-sm-8">
                    <input id="trafficPermit" name="trafficPermit" th:field="*{trafficPermit}" class="form-control"
                           type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">邮政编码：</label>
                <div class="col-sm-8">
                    <input id="postalCode" name="postalCode" th:field="*{postalCode}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">学生姓名拼音：</label>
                <div class="col-sm-8">
                    <input id="studentNamePinyin" name="studentNamePinyin" th:field="*{studentNamePinyin}"
                           class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">就业意向城市：</label>
                <div class="col-sm-8">
                    <!--<input id="jobCity" name="jobCity" class="form-control" type="text">-->
                    <select id="jobCity" class="form-control m-b" th:with="type=${@dict.getType('teach_job_city')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:field="*{jobCity}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">与紧急联络人的关系：</label>
                <div class="col-sm-8">
                    <input id="emergencyContact" name="emergencyContact" th:field="*{emergencyContact}"
                           class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">紧急联系人电话：</label>
                <div class="col-sm-8">
                    <input id="emergencyContactPhone" name="emergencyContactPhone" th:field="*{emergencyContactPhone}"
                           class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input id="extend2" name="extend2" th:field="*{extend2}" class="form-control" type="text">
                </div>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
    var prefix = ctx + "teach/teachFileCollection";
    $("#form-teachFileCollection-edit").validate({
        rules: {
            xxxx: {
                required: true
            },
        }
    });

    //时间选择器
    $(function () {
        laydate.render({
            elem: '#startTime', trigger: 'click'
        });
        laydate.render({
            elem: '#graduateDate', trigger: 'click'
        });
    });

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

    function edit() {
        var studentId = $("input[name='studentId']").val();  //学生id
        var classId = $("input[name='classId']").val(); //班级编号
        var kgcNo = $("input[name='kgcNo']").val();  //课工场编号
        var kgcUid = $("input[name='kgcUid']").val();  //课工场UID
        var kgcNickname = $("input[name='kgcNickname']").val();  //课工场名称
        var status = $("#status option:selected").val();  //状态
        var startTime = $("#startTime").val();  //进班时间
        var postname = $("input[name='postname']").val();  //学生项目地址
        var studentName = $("input[name='studentName']").val();  //学生姓名
        var studentSex = $("#studentSex option:selected").val();  //学生性别
        var nativePlace = $("input[name='nativePlace']").val();  //籍贯
        var idCardNo = $("input[name='idCardNo']").val();  //身份证号
        var education = $("#education option:selected").val();  //学历
        var phone = $("input[name='phone']").val();  //电话
        var mail = $("input[name='mail']").val();  //邮箱
        var address = $("input[name='address']").val();  //地址
        var graduateInstitutions = $("input[name='graduateInstitutions']").val();  //毕业院校
        var workExperience = $("input[name='workExperience']").val();  //学前工作经历
        var base = $("#base option:selected").val();  //是否有基础
        var englishLevel = $("#englishLevel option:selected").val();  //英语水平
        var degreeInNature = $("#degreeInNature option:selected").val();  //学历性质
        var graduateDate = $("#graduateDate").val();  //毕业时间
        var major = $("input[name='major']").val();  //学前专业
        var extend1 = $("#extend1 option:selected").val();  //学员来源
        var extend2 = $("input[name='extend2']").val();  //备注
        var emergencyContact = $("#emergencyContact").val();  //与紧急联系人关系
        var emergencyContactPhone = $("#emergencyContactPhone").val();  //紧急联系人电话
        var postalCode = $("input[name='postalCode']").val();  //邮政编码
        var studentNamePinyin = $("input[name='studentNamePinyin']").val();  //学生姓名拼音
        var trafficPermit = $("input[name='trafficPermit']").val();  //通行证
        var textbookNo = $("input[name='textbookNo']").val();  //教材编号
        var jobCity = $("#jobCity option:selected").val();   //就业意向城市
        //var extend3 = $("input[name='extend3']").val();  //创建时间

        $.ajax({
            cache : true,
            type : "POST",
            url : prefix + "/edit",
            data : {
                "studentId": studentId,
                "classNo": classId,
                "kgcNo": kgcNo,
                "kgcUid": kgcUid,
                "kgcNickname": kgcNickname,
                "status": status,
                "startTime": startTime,
                "postname": postname,
                "studentName": studentName,
                "studentSex": studentSex,
                "nativePlace": nativePlace,
                "idCardNo": idCardNo,
                "education": education,
                "phone": phone,
                "mail": mail,
                "address": address,
                "graduateInstitutions": graduateInstitutions,
                "workExperience": workExperience,
                "base": base,
                "englishLevel": englishLevel,
                "degreeInNature": degreeInNature,
                "graduateDate": graduateDate,
                "major": major,
                "extend1":extend1,
                "extend2":extend2,
                //"extend3":extend3,
                "emergencyContact":emergencyContact,
                "emergencyContactPhone":emergencyContactPhone,
                "postalCode":postalCode,
                "studentNamePinyin":studentNamePinyin,
                "trafficPermit":trafficPermit,
                "textbookNo":textbookNo,
                "jobCity":jobCity
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }
</script>
</body>
</html>
