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




{% block js %}
    {{ block.super }}
    $('.btn-save').click(function(){
        $.SubmitForm('#obj_form form','{{request.path}}');
    });
	
	$("#id_user").val({{request.user.id}})

    //2020-11-24
    $('#data-content .btn-delete').click(function(){
        $.ajax({
            url:'/obj/delete/sales_voidlabel/{{form.instance.id}}/',                             
            success: function(data) {
                if(data.cnt>0){  
                    toastr.success('已删除!', '操作成功：',
                        {timeOut: 800, positionClass: "toast-center-center"}
                    );
                    $.RefreshContent("/obj/list/sales_voidlabel/");                   
                };
            },

        });       
    
    });
{% endblock %}
    {% block subtitle-1 %}
        {% trans "营销活动" %}
    {% endblock %}
    {% block subtitle-2 %}
        {% trans "失效标签" %}
    {% endblock %}

    <span style="margin-left:10px; color:green; ">
        {% block subtitle-3 %}
            {% if form.instance.id %}
                {% trans "修改" %}
            {% else %}
                {% trans "新建" %}
            {% endif %}
        {% endblock %} 
    </span>



{% block form_content %}
    {{ block.super }}
    
    <div class="form-group ">
        <label class="col-sm-2 control-label ">{% get_verbose_field_name form.instance 'label_code' %} </label>
        <div class="col-sm-10">{{ form.label_code }}</div>
    </div>    
    <div class="form-group ">
        <label class="col-sm-2 control-label ">{% get_verbose_field_name form.instance 'reason' %} </label>
        <div class="col-sm-10">{{ form.reason }}</div>
    </div>    
    <div class="form-group ">
        <label class="col-sm-2 control-label ">{% get_verbose_field_name  form.instance 'remark' %} </label>
        <div class="col-sm-10">{{ form.remark }}</div>
    </div>
    <div>

        {% if form.instance.id %}
            <a class="btn btn-danger btn-delete" type="button"  >{% trans '删除' %}</a>
        {% endif %}
        <a class="btn btn-primary btn-save" type="submit" style="float:right;">{% trans '保存' %}</a>
    </div>
{% endblock %}
