{% extends 'obj_form.html' %}
{% load i18n %}


{% block subtitle %}
<ol class="breadcrumb">
        <li>{% trans '公司管理' %}</li>
        <li>{% trans '质检报告' %}</li>
</ol>
{% endblock %}


{% block form_content %}
<script>

    $(document).ready(function () {

        var content = $("#id_contents").val();
        if (content!="None"){
            $("#htmlEdit").html(content);
        }

        var E = window.wangEditor
        var editor = new E('#htmlEdit')
        editor.config.uploadImgServer = '/mall/points_product/upload/'
        editor.config.uploadImgMaxLength = 20
        editor.config.uploadImgMaxSize = 3 * 1024 * 1024 // 512kb
        editor.config.uploadFileName = 'file'
        editor.create()

        $('.btn-save').click(function () {
            let editorData = editor.txt.html();
            $("#id_contents").val(editorData);
            $.SubmitForm('#obj_form form', '{{request.path}}',function (){
                //$('.alert').fadeIn();
                //setTimeout(function (){
                //    $('.alert').fadeOut();
                //},3000)
            });
        }); 
		

        $.datetimepicker.setLocale('zh');

        $('#id_dt').datetimepicker({
            i18n:{
                zh:{
                    months:['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月',],
                    dayOfWeek:["一", "二", "三", "四","五", "六", "日",]
                }
            },
            //timepicker:true,
            format:'Y-m-d',        
        });
		
    })

</script>
<style>
    input[type=checkbox]{
        display: inline-block;
        width: auto;
        height: auto;
        margin-top: 10px;
    }
	.xdsoft_datetimepicker {
		z-index: 10002
	}
</style>
<div class="alert alert-success" role="alert" style="display: none">提示：保存成功！</div>
<div class="form-group">
    <label class="col-sm-2 control-label ">质检报告标题</label>
    <div class="col-sm-8">{{ form.title }}</div>
</div>
<div class="form-group ">
    <label class="col-sm-2 control-label ">质检报告内容</label>
    <div class="col-sm-8">
        <div id="htmlEdit"></div>
    </div>
</div>
<div class="form-group ">
    <label class="col-sm-2 control-label ">质检报告日期</label>
    <div class="col-sm-8">
		{{form.dt}}
	</div>
</div>
<div class="form-group ">
    <label class="col-sm-2 control-label ">备注</label>
    <div class="col-sm-8">{{ form.remark }}</div>
</div>
<div class="form-group ">
    <label class="col-sm-2 control-label ">是否有效</label>
    <div class="col-sm-1">
        <div>
            {{ form.is_active }}
        </div>
    </div>
</div>
<div>
    <a class="btn btn-primary btn-save" type="button" style="float:right;">保存</a>
</div>
<input type="hidden" id="id_contents" name="contents" value="{{ form.instance.contents }}">
{% endblock %}