{% load i18n admin_urls simpletags%}
<div class="submit-row">
    <div class="other-wrap">
        {% if show_save %}
            <button type="submit" class="el-button el-button--primary el-button--small" name="_save">
            {% trans 'Save' %}
            </button>
        {% endif %}

     {% if show_save_and_continue %}

            <button type="submit" class="el-button el-button--success el-button--small" name="_continue">
                {% trans 'Save and continue editing' %}
            </button>
        {% endif %}

         {% if show_save_as_new %}
            <el-button size="small" type="primary"
                       @click="formSubmit('_saveasnew','{% trans 'Save as new' %}',$event)">{% trans 'Save as new' %}</el-button>
        {% endif %}
        {% if show_save_and_add_another %}
            <button type="submit" class="el-button el-button--success is-plain el-button--small" name="_addanother">
                {% trans 'Save and add another' %}
            </button>
        {% endif %}


        <input type="hidden" name="actionName" value="actionValue" id="actionName">
    </div>

    <div class="delete-wrap">
        {% if show_delete_link %}
            {% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %}
            <el-button size="small" icon="el-icon-delete" type="danger" onclick="del('{% add_preserved_filters delete_url %}')"
                       style="float: left" plain>{% trans "Delete" %}</el-button>
        {% endif %}
    </div>
</div>
<script type="text/javascript">
    var submitrows=document.getElementsByClassName('submit-row');
    function del(url){
         window.location.href = url;
    }
    function prev() {
         window.location.href='{% get_model_url %}'
    }

    for(var i=0;i<submitrows.length;i++){
        new Vue({
        el: submitrows[i],
        data: {},
        methods: {
            formSubmit: function (name, v, e) {
                $("#actionName").attr('name', name).val(v);
                $("form").submit();
            }
        }
    })
    }

</script>