<!-- START admin/promocion/accion_delete_button.html.twig -->
{% if is_granted('ROLE_SUPER_ADMIN') %}
<span id="field_actions_{{ admin.uniqid }}_acciones" class="action-delete_accion" style="display: none;">
<a href="#" class="btn btn-danger btn-sm sonata-ba-action" title="{{ 'link_delete_accion'|trans({}, 'SonataAdminBundle') }}">
<i class="fa fa-trash"></i> {{ 'link_delete_accion'|trans({}, 'SonataAdminBundle') }}
</a>
</span>
<script type="text/javascript">
$(document).on("click", "span.action-delete_accion", function(e)
{
e.preventDefault();
const id = $(this).data("id");
const url = routes.apiAccionDelete.replace(/\/0$/, `/${id}`);
let title = $(this).data("title_record_delete") || i18n.titleModalRecordDelete;
let message = $(this).data("message_record_delete") || i18n.messageModalRecordDelete;
AlertUtils.warning(title, message, null, AlertUtils.Buttons.doble, {
that: this,
onClose: function (dialog) {
dialog.close();
},
onAccept: function (dialog) {
AjaxUtils.ajaxCall(url, null, {
successCallback: function(data)
{
window.location = window.location.pathname;
},
failCallback: function(xhr, textStatus, errorThrown)
{
AjaxUtils.ajaxErrorMessage(xhr, textStatus, errorThrown);
}
}, "DELETE");
dialog.close();
}
}, "alert-utils");
});
</script>
{% endif %}
<!-- END admin/promocion/accion_delete_button.html.twig -->