templates/admin/Button/sales_management_button.html.twig line 1

Open in your IDE?
  1. {% if object.id and not object.operacion %}
  2.     {% set disabled = 'disabled' %}
  3.     {% if object.estado.key|default('') == constant('App\\Enum\\EstadoValoracionEnum::ESTADO_ACEPTADA') and not(object.valoracionesRelojesStocks|length) %}
  4.         {% set disabled = '' %}
  5.     {% endif %}
  6.     <li id="action-sales-management" class="action">
  7.         <a class="sonata-action-element {{ disabled }}" href=""
  8.             title="{{ 'link_action_sales_management'|trans({}, 'SonataAdminBundle') }}"
  9.             data-error_exportacion="{{ 'action_sales_management_message_error_exportacion'|trans({}, 'SonataAdminBundle') }}" data-error_permuta="{{ 'action_sales_management_message_error_permuta'|trans({}, 'SonataAdminBundle') }}"
  10.         >
  11.             <i class="far fa-handshake fa-2x"></i>
  12.         </a>
  13.     </li>
  14.     <script type="application/javascript">
  15.         $(document).on("click", "#navbar-prometeo li#action-sales-management a", function(event)
  16.         {
  17.             let title = $(this).data("modal_show_title") || i18n.titleControlSalesManagement;
  18.             let cssClass = $(this).data("modal_show_class") || 'sales-management-default';
  19.             if(!$("input[id$=_exportacion]").is(":checked") && !$("table.table-valoraciones-relojes-stocks tbody tr").length )
  20.             {
  21.                 event.preventDefault();
  22.                 $("section.content form").attr("action",  $("section.content form").attr("action") + '&action=sales-management').trigger("submit");
  23.             }
  24.             if($("input[id$=_exportacion]").is(":checked"))
  25.             {
  26.                 let message = $(this).data("error_exportacion");
  27.                 AlertUtils.dangerSmall(title, message, null, AlertUtils.Buttons.simple, null, cssClass);
  28.                 event.preventDefault();
  29.             }
  30.             if($("table.table-valoraciones-relojes-stocks tbody tr").length > 0)
  31.             {
  32.                 let message = $(this).data("error_permuta");
  33.                 AlertUtils.dangerSmall(title, message, null, AlertUtils.Buttons.simple, null, cssClass);
  34.                 event.preventDefault();
  35.             }
  36.         });
  37.     </script>
  38. {% endif %}