templates/admin/promocion/accion_delete_button.html.twig line 1

Open in your IDE?
  1. <!-- START admin/promocion/accion_delete_button.html.twig -->
  2. {% if is_granted('ROLE_SUPER_ADMIN') %}
  3.     <span id="field_actions_{{ admin.uniqid }}_acciones" class="action-delete_accion" style="display: none;">
  4.         <a href="#" class="btn btn-danger btn-sm sonata-ba-action" title="{{ 'link_delete_accion'|trans({}, 'SonataAdminBundle') }}">
  5.             <i class="fa fa-trash"></i> {{ 'link_delete_accion'|trans({}, 'SonataAdminBundle') }}
  6.         </a>
  7.     </span>
  8.     <script type="text/javascript">
  9.         $(document).on("click", "span.action-delete_accion", function(e)
  10.         {
  11.             e.preventDefault();
  12.             const id = $(this).data("id");
  13.             const url = routes.apiAccionDelete.replace(/\/0$/, `/${id}`);
  14.             let title = $(this).data("title_record_delete") || i18n.titleModalRecordDelete;
  15.             let message = $(this).data("message_record_delete") || i18n.messageModalRecordDelete;
  16.             AlertUtils.warning(title, message, null, AlertUtils.Buttons.doble, {
  17.                 that: this,
  18.                 onClose: function (dialog) {
  19.                     dialog.close();
  20.                 },
  21.                 onAccept: function (dialog) {
  22.                     AjaxUtils.ajaxCall(url, null, {
  23.                         successCallback: function(data)
  24.                         {
  25.                             window.location = window.location.pathname;
  26.                         },
  27.                         failCallback: function(xhr, textStatus, errorThrown)
  28.                         {
  29.                             AjaxUtils.ajaxErrorMessage(xhr, textStatus, errorThrown);
  30.                         }
  31.                     }, "DELETE");
  32.                     dialog.close();
  33.                 }
  34.             }, "alert-utils");
  35.         });
  36.     </script>
  37. {% endif %}
  38. <!-- END admin/promocion/accion_delete_button.html.twig -->