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




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

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

        });       
    
    });
{% 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 %}
{#        {% if form.instance.id %}#}
{#            {% block subtitle-3 %}#}
{#                {% trans "修改" %}#}
{#            {% endblock %}#}
{#        {% else %}#}
{#            {% block subtitle-3 %}#}
{#                {% trans "新建" %}#}
{#            {% endblock %}#}
{#        {% endif %}#}
    </span>



{% block form_content %}
    {{ block.super }}
    
    <div class="form-group ">
        <label class="col-sm-2 control-label ">{% get_verbose_field_name form.instance 'name' %} </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.sn }}</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 %}
            {% if is_show %}
                <a class="btn btn-danger btn-delete" type="button"  >{% trans '删除' %}</a>
            {% endif %}
        {% endif %}
        <a class="btn btn-primary btn-save" type="submit" style="float:right;">{% trans '保存' %}</a>
    </div>
{% endblock %}
