<!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" />
    <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-supply-edit" th:object="${noticeSupply}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">关联商品类别表id：</label>
                <div class="col-sm-8">
                    <input name="typeId" disabled="" th:field="*{typeId}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商户表id：</label>
                <div class="col-sm-8">
                    <input name="merchantId" disabled="" th:field="*{merchantId}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">供应信息标题：</label>
                <div class="col-sm-8">
                    <input name="supplyTitle" disabled="" th:field="*{supplyTitle}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">供应信息详情：</label>
                <div class="col-sm-8" disabled="">
                    <input disabled="" id="supplyDetails" name="supplyDetails" th:field="*{supplyDetails}" type="hidden">
                    <div id="editor"  disabled="" class="summernote"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">生产厂家：</label>
                <div class="col-sm-8">
                    <input name="manufacturer" disabled="" th:field="*{manufacturer}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">联系人：</label>
                <div class="col-sm-8">
                    <input name="contacts" disabled="" th:field="*{contacts}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">联系电话：</label>
                <div class="col-sm-8">
                    <input name="telephone" disabled="" th:field="*{telephone}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">发布时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="releaseTime" disabled="" th:value="${#dates.format(noticeSupply.releaseTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">商品图片：</label>
                <div class="col-sm-8">
                    <textarea name="picture" disabled="" class="form-control" required>[[*{picture}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">供应信息状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box">
                        <label class="radio-box"> <input type="radio" disabled="" th:field="*{status}" name="status" value="0" checked /> 征集中 </label>
                        <label class="radio-box"> <input type="radio" disabled="" th:field="*{status}" name="status" value="1" /> 已结束 </label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: summernote-js" />
    <th:block th:include="include :: jasny-bootstrap-js" />
    <script type="text/javascript">
        var prefix = ctx + "notice/supply";
        $("#form-supply-edit").validate({
            focusCleanup: true
        });

        $(function() {
            $('.summernote').summernote({
                placeholder: '请输入内容',
                height : 170,
                lang : 'zh-CN',
                followingToolbar: false,
                callbacks: {
                    onImageUpload: function (files) {
                        sendFile(files[0], this);
                    }
                }
            });
            var content = $("#supplyDetails").val();
            $('#editor').summernote('code', content);
        });

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

        $("input[name='releaseTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>