<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('审核学校信息')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-school-edit" th:object="${tbSchool}">
            <input name="id" id="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">学校中文名称：</label>
                <div class="col-sm-8">
                    <input name="schoolCnName" id="schoolCnName" th:field="*{schoolCnName}" 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">
                    <input name="schoolEnName" id="schoolEnName" th:field="*{schoolEnName}" 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">
                    <input name="schoolCnCountry" id="schoolCnCountry" th:field="*{schoolCnCountry}" 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">
                    <input id="schoolCnCity" th:field="*{schoolCnCity}" 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">-->
<!--                    <input id="schoolEnCountry" th:field="*{schoolEnCountry}" 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">-->
<!--                    <input id="schoolEnCity" th:field="*{schoolEnCity}" 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">
                    <input name="address" id="address" th:field="*{address}" 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">
                    <input name="lng" id="lng" th:field="*{lng}" 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">
                    <input name="lat" id="lat" th:field="*{lat}" 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">
                    <input name="phone" id="phone" th:field="*{phone}" 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">
                    <input name="website" id="website" th:field="*{website}" 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">
                    <input id="schoolTypeDesc" th:field="*{schoolTypeDesc}" 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">
                    <input id="schoolCampus" th:field="*{schoolCampus}" 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">
                    <input id="schoolArea" th:field="*{schoolArea}" 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">
                    <textarea rows="8" cols="40"  id="schoolIntroduction" th:field="*{schoolIntroduction}" class="form-control" disabled="true">
                        </textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">QS世界排名：</label>
                <div class="col-sm-8">
                    <input id="qsWorld" th:field="*{qsWorld}" class="form-control" type="text" disabled="true">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">QS地区排名：</label>
                <div class="col-sm-8">
                    <input id="qsArea" th:field="*{qsArea}" class="form-control" type="text" disabled="true">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">毕业后6个月就业率：</label>
                <div class="col-sm-8">
                    <input id="employmentRate" th:field="*{employmentRate}" 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">
                    <input th:field="*{qsEmployability}" id="qsEmployability" 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">
                    <input th:field="*{teachingLanguage}" id="teachingLanguage" 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">
                    <input th:field="*{internship}" id="internship" class="form-control" type="text" disabled="true">
                </div>
            </div>
            <input id="govAuth" th:field="*{govAuth}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">中国教育部认证：</label>
                <div class="col-sm-8">
                    <select id="govAuth1" class="form-control select2-multiple" disabled="true">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">学校logo：</label>
                <input type="hidden" id="schoolLogo" th:field="*{schoolLogo}">
                <div class="col-sm-8">
                    <div class="file-loading">
                        <input id="singleFile" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">学校封面：</label>
                <input type="hidden" id="schoolCover" th:field="*{schoolCover}">
                <div class="col-sm-8">
                    <div class="file-loading">
                        <input id="singleSchoolCover" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">学校背景图：</label>
                <input type="hidden" id="backgroundImage" th:field="*{backgroundImage}">
                <div class="col-sm-8">
                    <div class="file-loading">
                        <input id="singleFile1" name="file" type="file">
                    </div>
                </div>
            </div>
            <input id="liveType" th:field="*{liveType}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">住宿类型：</label>
                <div class="col-sm-8">
                    <select id="liveType1" class="form-control select2-multiple" disabled="true" multiple>
                    </select>
                </div>
            </div>
            <input id="airportPickup" th:field="*{airportPickup}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">是否有接机服务：</label>
                <div class="col-sm-8">
                    <select id="airportPickup1" class="form-control select2-multiple" disabled="true">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">审核结果：</label>
                <div class="col-sm-8">
                    <input name="checkResult" id="checkResult" th:field="*{checkResult}" class="form-control" type="text" required>
                </div>
            </div>
            <input id="checkStatusDesc" name="checkStatusDesc" th:field="*{checkStatusDesc}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">审核状态：</label>
                <div class="col-sm-8">
                    <select id="checkStatus" class="form-control select2-multiple" >
                        <option>请选择审核状态：</option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/schoolCheck";
        $("#form-school-edit").validate({
            focusCleanup: true
        });

        $(document).ready(function() {
            $.ajax({
                url: ctx+"system/dict/data/business_check_status",
                type: "get",
                dataType: "json",
                success: function(data){
                    for(var i=0; i<data.length; i++){
                        $("#checkStatus").append("<option value='" + data[i].dictValue + "'>" + data[i].dictLabel + "</option>");
                    }
                    var vtext = $("#checkStatusDesc")[0].value;
                    $("#checkStatus").find("option").each(function(){
                        if($(this).text() == vtext)	{
                            $(this).attr("selected",true);
                        }
                    });
                }
            });

            var vSel=$("#liveType").val();
            var varray=vSel.split(',');
            $("#liveType1").append("<option value='1'>校内</option>");
            $("#liveType1").append("<option value='2'>校外公寓</option>");
            for(var i=0;i<varray.length;i++){
                $("#liveType1").find("option").each(function(){
                    if($(this).val() == varray[i])	{
                        $(this).attr("selected",true);
                    }
                });
            }

            var vSele=$("#airportPickup").val();
            $("#airportPickup1").append("<option value='Y'>是</option>");
            $("#airportPickup1").append("<option value='N'>否</option>");
            $("#airportPickup1").find("option").each(function(){
                if($(this).val() == vSele)	{
                    $(this).attr("selected",true);
                }
            });

            var vSele1=$("#govAuth").val();
            $("#govAuth1").append("<option value='Y'>是</option>");
            $("#govAuth1").append("<option value='N'>否</option>");
            $("#govAuth1").find("option").each(function(){
                if($(this).val() == vSele1)	{
                    $(this).attr("selected",true);
                }
            });
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/editCheckStatus", $('#form-school-edit').serialize()+"&checkStatus="+$('#checkStatus')[0].value);
            }
        }

        initUpload();
        initSchoolCover();
        initUpload1();

        //初始化方法
        function initUpload() {
            var logoUrl = $("#schoolLogo").val();//拿到图片路径
            var preList = new Array();
            var initialPreviewConfig = new Array();
            //设置初始化区域值
            if (logoUrl != null && logoUrl != ''){
                var a = {
                    // caption : '主图'+(i+1),
                    // width: '120px',
                    url: '/common/del',
                    // key: i,
                    extra: {url: logoUrl}
                }
                preList.push(logoUrl);
                initialPreviewConfig.push(a);
            }

            $("#singleFile").fileinput({
                language: 'zh', //设置语言
                uploadUrl: "/common/upload", //上传的地址，改成自己的
                allowedFileExtensions:['bmp', 'gif', 'jpg', 'jpeg', 'png'],//接收的文件后缀
                initialPreviewAsData:true,
                initialPreview:preList,//预览图片
                uploadAsync: true, //默认异步上传
                showUpload: true, //是否显示上传按钮
                showRemove : false, //显示移除按钮
                showPreview : true, //是否显示预览
                showCaption: false,//是否显示标题
                browseClass: "btn btn-primary", //按钮样式
                dropZoneEnabled: false,//是否显示拖拽区域
                maxFileCount: 1, //表示允许同时上传的最大文件个数
                maxFileSize:10 *1024 *1024,
                messages: {maxFileSize:'文件上传的最大大小为 10MB',acceptFileTypes:'此文件是不支持的图片格式'    },
                enctype: 'multipart/form-data',
                validateInitialCount:true,
                msgFilesTooMany:5,
                autoReplace:false,
                initialPreviewConfig:initialPreviewConfig
            });
        }

        function initSchoolCover() {
            var logoUrl = $("#schoolCover").val();//拿到图片路径
            var preList = new Array();
            var initialPreviewConfig = new Array();
            //设置初始化区域值
            if (logoUrl != null && logoUrl != ''){
                var a = {
                    // caption : '主图'+(i+1),
                    // width: '120px',
                    url: '/common/del',
                    // key: i,
                    extra: {url: logoUrl}
                }
                preList.push(logoUrl);
                initialPreviewConfig.push(a);
            }

            $("#singleSchoolCover").fileinput({
                language: 'zh', //设置语言
                uploadUrl: "/common/upload", //上传的地址，改成自己的
                allowedFileExtensions:['bmp', 'gif', 'jpg', 'jpeg', 'png'],//接收的文件后缀
                initialPreviewAsData:true,
                initialPreview:preList,//预览图片
                uploadAsync: true, //默认异步上传
                showUpload: true, //是否显示上传按钮
                showRemove : false, //显示移除按钮
                showPreview : true, //是否显示预览
                showCaption: false,//是否显示标题
                browseClass: "btn btn-primary", //按钮样式
                dropZoneEnabled: false,//是否显示拖拽区域
                maxFileCount: 1, //表示允许同时上传的最大文件个数
                maxFileSize:10 *1024 *1024,
                messages: {maxFileSize:'文件上传的最大大小为 10MB',acceptFileTypes:'此文件是不支持的图片格式'    },
                enctype: 'multipart/form-data',
                validateInitialCount:true,
                msgFilesTooMany:5,
                autoReplace:false,
                initialPreviewConfig:initialPreviewConfig
            });
        }

        function initUpload1() {
            var logoUrl = $("#backgroundImage").val();//拿到图片路径
            var preList = new Array();
            var initialPreviewConfig = new Array();
            //设置初始化区域值
            if (logoUrl != null && logoUrl != ''){
                var a = {
                    // caption : '主图'+(i+1),
                    // width: '120px',
                    url: '/common/del',
                    // key: i,
                    extra: {url: logoUrl}
                }
                preList.push(logoUrl);
                initialPreviewConfig.push(a);
            }

            $("#singleFile1").fileinput({
                language: 'zh', //设置语言
                uploadUrl: "/common/upload", //上传的地址，改成自己的
                allowedFileExtensions:['bmp', 'gif', 'jpg', 'jpeg', 'png'],//接收的文件后缀
                initialPreviewAsData:true,
                initialPreview:preList,//预览图片
                uploadAsync: true, //默认异步上传
                showUpload: true, //是否显示上传按钮
                showRemove : false, //显示移除按钮
                showPreview : true, //是否显示预览
                showCaption: false,//是否显示标题
                browseClass: "btn btn-primary", //按钮样式
                dropZoneEnabled: false,//是否显示拖拽区域
                maxFileCount: 1, //表示允许同时上传的最大文件个数
                maxFileSize:10 *1024 *1024,
                messages: {maxFileSize:'文件上传的最大大小为 10MB',acceptFileTypes:'此文件是不支持的图片格式'    },
                enctype: 'multipart/form-data',
                validateInitialCount:true,
                msgFilesTooMany:5,
                autoReplace:false,
                initialPreviewConfig:initialPreviewConfig
            });
        }
    </script>
</body>
</html>