<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改材料样例')" />
<!--    <th:block th:include="include :: summernote-css" />-->
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-demo-edit" th:object="${tbMaterialDemo}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">材料名称：</label>
                <div class="col-sm-8">
                    <input name="materialName" th:field="*{materialName}" class="form-control" type="text" disabled="true">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label is-required">材料封面：</label>
                <div class="col-sm-8">
                    <div class="fileinput fileinput-new" data-provides="fileinput">
                        <div class="fileinput-new thumbnail" style="width: 400px; height: 400px;">
                            <img id="imgId1" th:src="*{materialCover}"  disabled="true"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label is-required">材料内容：</label>
                <div class="col-sm-10">
                    <script id="editor" name="materialContent" type="text/plain" style="height: 300px;"></script>
                    <textarea id="materialContent" style="display: none;" disabled="true">[[*{materialContent}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label is-required">注意事项：</label>
                <div class="col-sm-8">
                    <input name="note" th:field="*{note}" class="form-control" type="text" disabled="true">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 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-2 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 :: ueditor-js" />
    <script type="text/javascript">
        var prefix = ctx + "system/checkDemo";
        $("#form-demo-edit").validate({
            focusCleanup: true
        });

        $(function () {
            var text = $("#materialContent").text();
            var ue = UE.getEditor('editor');
            ue.ready(function () {
                ue.setContent(text);
            });
        })

        function getContentTxt() {
            return UE.getEditor('editor').getContentTxt();
        }
        function submitHandler() {
            $.operate.save(prefix + "/edit", $('#form-demo-edit').serialize()+"&checkStatus="+$('#checkStatus')[0].value);
        }

        $(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);
                        }
                    });
                }
            });
        });
    </script>
</body>
</html>