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

{% block css %}
    {{ block.super }}    
   
{% endblock %}



{% block js %}
    {{ block.super }}
    var E = window.wangEditor
	var editor = new E('#htmlEdit');
    $('.btn-save').click(function(){
		var editorData = editor.txt.html();
		$("#id_vendor_contents").val(editorData); 
		console.log(editorData);
        $.SubmitForm('#obj_form form','{{request.path}}');
    });
	
	
		var content = $("#id_vendor_contents").val();
        if (content!="None"){
            $("#htmlEdit").html(content);
        }

        editor.config.uploadImgServer = '/mall/points_product/upload/'
        editor.config.uploadImgMaxLength = 20
        editor.config.uploadImgMaxSize = 3 * 1024 * 1024 // 512kb
        editor.config.uploadFileName = 'file'
        editor.create()
   
{% endblock %}

 
{% block subtitle-1 %}
    {% trans '供应商与客户' %}
{% endblock %}
{% block subtitle-2 %}
    {% trans '供应商' %}
{% endblock %}      





{% block form_content %}
    {{ block.super }}
    
    <div class="form-group ">
        <label class="col-sm-2 control-label ">{% trans '供应商名称:' %} </label>
        <div class="col-sm-10">{{ form.name }}</div>
    </div>
    <div class="form-group ">
      <label class="col-sm-2 control-label ">{% trans '供应商外部编码:' %} </label>
      <div class="col-sm-10">{{ form.external_code }}</div>
    </div> 
    <div class="form-group ">
        <label class="col-sm-2 control-label ">{% trans '详细地址:' %} </label>
        <div class="col-sm-10">{{ form.address }}</div>
    </div>  
    <div class="form-group ">
      <label class="col-sm-2 control-label ">{% trans '联系人:' %} </label>
      <div class="col-sm-10">{{ form.contacts }}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">{% trans '联系电话:' %} </label>
        <div class="col-sm-10">{{ form.cellphone }}</div>
    </div>
    
    <div class="form-group ">
        <label class="col-sm-2 control-label ">{% trans '备注说明:' %} </label>
        <div class="col-sm-10">{{ form.remark }}</div>
    </div>   
	
	
    <div class="form-group ">
        <label class="col-sm-2 control-label ">{% trans '产品介绍:' %} </label>
        <div class="col-sm-10">
			<div id="htmlEdit"></div>
		</div>
    </div>   
	
	<input type="hidden" id="id_vendor_contents" name="contents" value="{{ form.instance.contents }}">
		
    <div>
        <a class="btn btn-primary btn-save" type="submit" style="float:right;">{% trans '保存' %}</a>
    </div>

{% endblock %}
