templates/_partial/footer.html.twig line 1

Open in your IDE?
  1. {% set route = app.request.get('_route') %}
  2. {% set hide_footer_info = route in ['first_login'] %}
  3. {% if is_granted('IS_AUTHENTICATED_FULLY') %}
  4.     <script>
  5. $(document).ready(function() {
  6.   $('.modal').on('show.bs.modal', function () {
  7.     var $modalTitle = $(this).find('.modal-title');
  8.     if ($modalTitle.text().trim() === 'Declaración jurada de ausencia de conflictos de intereses y de confidencialidad para procesos de compra') {
  9.         $modalTitle.addClass('d-none')
  10.     }
  11.     
  12.     if ($modalTitle.text().trim() === 'Declaración jurada de ausencia de conflictos de intereses y de confidencialidad') {
  13.         $modalTitle.addClass('d-none')
  14.     }
  15.   });
  16. });
  17.         $(function () {
  18.             $(document).on('click', '[data-impersonate]', function () {
  19.                 var username = $(this).data('uname');
  20.                 alert('Se cambiará al usuario <strong>' + username + '</strong>', function () {
  21.                     $.get('?_switch_user=_exit').done(function () {
  22.                         $.get('?_switch_user=' + username).done(function () {
  23.                             window.location.href = "{{ path('dashboard') }}";
  24.                         })
  25.                     }).fail(function () {
  26.                         alert('Hubo un error al realizar la operación. Por favor intentelo nuevamente');
  27.                     });
  28.                 });
  29.             });
  30.             $(document).on('click', '#btn-profile-history', function(e) {
  31.                 e.preventDefault();
  32.                 var $btn = $(this);
  33.                 var url = $btn.data('history-url');
  34.                 var $modal = $('#modal_profile_history');
  35.                 if (!url) {
  36.                     console.error('URL del historial no encontrada');
  37.                     alert('Error: No se pudo obtener la URL del historial');
  38.                     return;
  39.                 }
  40.                 // Crear modal si no existe
  41.                 if ($modal.length === 0) {
  42.                     $('body').append('<div id="modal_profile_history" class="modal fade" aria-hidden="true" tabindex="-1"></div>');
  43.                     $modal = $('#modal_profile_history');
  44.                 }
  45.                 console.log('Cargando historial desde:', url);
  46.                 
  47.                 $.ajax({
  48.                     url: url,
  49.                     method: 'GET',
  50.                     dataType: 'html',
  51.                     success: function(response) {
  52.                         console.log('Respuesta recibida, actualizando modal');
  53.                         $modal.html(response);
  54.                         // Esperar un momento para que el DOM se actualice
  55.                         setTimeout(function() {
  56.                             // Usar el método de jQuery que funciona con Bootstrap 5
  57.                             if (typeof $modal.modal === 'function') {
  58.                                 $modal.modal('show');
  59.                             } else {
  60.                                 // Fallback: usar la API nativa de Bootstrap 5
  61.                                 try {
  62.                                     var BootstrapModal = window.bootstrap && window.bootstrap.Modal 
  63.                                         ? window.bootstrap.Modal 
  64.                                         : (typeof bootstrap !== 'undefined' ? bootstrap.Modal : null);
  65.                                     
  66.                                     if (BootstrapModal) {
  67.                                         var modalInstance = new BootstrapModal($modal[0], {
  68.                                             backdrop: true,
  69.                                             keyboard: true
  70.                                         });
  71.                                         modalInstance.show();
  72.                                     } else {
  73.                                         // Último recurso: mostrar manualmente
  74.                                         $modal.addClass('show').css('display', 'block');
  75.                                         $('body').addClass('modal-open');
  76.                                         if (!$('.modal-backdrop').length) {
  77.                                             $('body').append('<div class="modal-backdrop fade show"></div>');
  78.                                         }
  79.                                     }
  80.                                 } catch (e) {
  81.                                     console.error('Error al mostrar modal:', e);
  82.                                     // Mostrar manualmente como último recurso
  83.                                     $modal.addClass('show').css('display', 'block');
  84.                                     $('body').addClass('modal-open');
  85.                                     if (!$('.modal-backdrop').length) {
  86.                                         $('body').append('<div class="modal-backdrop fade show"></div>');
  87.                                     }
  88.                                 }
  89.                             }
  90.                         }, 100);
  91.                     },
  92.                     error: function(xhr, status, error) {
  93.                         console.error('Error al cargar el historial:', {
  94.                             status: xhr.status,
  95.                             statusText: xhr.statusText,
  96.                             responseText: xhr.responseText,
  97.                             url: url
  98.                         });
  99.                         
  100.                         var errorMsg = 'Error al cargar el historial';
  101.                         if (xhr.status === 404) {
  102.                             errorMsg = 'No se encontró el historial.';
  103.                         } else if (xhr.status === 403) {
  104.                             errorMsg = 'No tiene permisos para acceder al historial.';
  105.                         } else if (xhr.status === 401) {
  106.                             errorMsg = 'Debe estar autenticado para acceder al historial.';
  107.                         }
  108.                         
  109.                         alert(errorMsg + ' (Error ' + xhr.status + ')');
  110.                     }
  111.                 });
  112.             });
  113.             // Cargar perfil del proveedor mediante AJAX
  114.             $(document).on('click', '#btn-profile-supplier, .open-supplier-profile-modal', function(e) {
  115.                 e.preventDefault();
  116.                 var $btn = $(this);
  117.                 var url = $btn.data('profile-url') || $btn.attr('data-profile-url');
  118.                 var $modal = $('#modal_profile');
  119.                 var modalElement = $modal[0];
  120.                 if (!url) {
  121.                     console.error('URL del perfil no encontrada');
  122.                     alert('Error: No se pudo obtener la URL del perfil');
  123.                     return;
  124.                 }
  125.                 if (!modalElement) {
  126.                     console.error('Elemento del modal no encontrado');
  127.                     alert('Error: No se pudo encontrar el modal');
  128.                     return;
  129.                 }
  130.                 console.log('Cargando perfil desde:', url);
  131.                 
  132.                 $.ajax({
  133.                     url: url,
  134.                     method: 'GET',
  135.                     dataType: 'html',
  136.                     success: function(response) {
  137.                         console.log('Respuesta recibida, actualizando modal');
  138.                         $modal.html(response);
  139.                         // Esperar un momento para que el DOM se actualice
  140.                         setTimeout(function() {
  141.                             // Usar el método de jQuery que funciona con Bootstrap 5
  142.                             // Bootstrap 5 expone el plugin de jQuery automáticamente
  143.                             if (typeof $modal.modal === 'function') {
  144.                                 $modal.modal('show');
  145.                             } else {
  146.                                 // Fallback: usar la API nativa de Bootstrap 5
  147.                                 try {
  148.                                     // Intentar acceder a bootstrap desde window
  149.                                     var BootstrapModal = window.bootstrap && window.bootstrap.Modal 
  150.                                         ? window.bootstrap.Modal 
  151.                                         : (typeof bootstrap !== 'undefined' ? bootstrap.Modal : null);
  152.                                     
  153.                                     if (BootstrapModal) {
  154.                                         var modalInstance = new BootstrapModal(modalElement, {
  155.                                             backdrop: true,
  156.                                             keyboard: true
  157.                                         });
  158.                                         modalInstance.show();
  159.                                     } else {
  160.                                         // Último recurso: mostrar manualmente
  161.                                         $modal.addClass('show').css('display', 'block');
  162.                                         $('body').addClass('modal-open');
  163.                                         if (!$('.modal-backdrop').length) {
  164.                                             $('body').append('<div class="modal-backdrop fade show"></div>');
  165.                                         }
  166.                                     }
  167.                                 } catch (e) {
  168.                                     console.error('Error al mostrar modal:', e);
  169.                                     // Mostrar manualmente como último recurso
  170.                                     $modal.addClass('show').css('display', 'block');
  171.                                     $('body').addClass('modal-open');
  172.                                     if (!$('.modal-backdrop').length) {
  173.                                         $('body').append('<div class="modal-backdrop fade show"></div>');
  174.                                     }
  175.                                 }
  176.                             }
  177.                         }, 100);
  178.                     },
  179.                     error: function(xhr, status, error) {
  180.                         console.error('Error al cargar el perfil:', {
  181.                             status: xhr.status,
  182.                             statusText: xhr.statusText,
  183.                             responseText: xhr.responseText,
  184.                             url: url
  185.                         });
  186.                         
  187.                         var errorMsg = 'Error al cargar el perfil';
  188.                         if (xhr.status === 404) {
  189.                             errorMsg = 'No se encontró la página del perfil. Verifique que tenga un proveedor asociado.';
  190.                         } else if (xhr.status === 403) {
  191.                             errorMsg = 'No tiene permisos para acceder al perfil.';
  192.                         } else if (xhr.status === 401) {
  193.                             errorMsg = 'Debe estar autenticado para acceder al perfil.';
  194.                         }
  195.                         
  196.                         alert(errorMsg + ' (Error ' + xhr.status + ')');
  197.                     }
  198.                 });
  199.             });
  200.         });
  201.     </script>
  202. {% endif %}
  203.   <footer class="footer text-white py-3 fixed-bottom    ">
  204.     <div class="container">
  205.         <div class="row">
  206.             <div class="col-md-auto me-auto"><span class="mb-3 mb-md-0 text-sm text-body-secondary">BancoEstado Express 2019-{{ 'now'|date('Y') }}. Todos los derechos reservados.</span></div>
  207.             <div class="col-md-auto ms-auto justify-content-end  d-flex">
  208.                 <img src="{{ asset('/build/img/app-footer-logo.png') }}" alt="Logo BancoEstado Express" />
  209.             </div>
  210.         </div>
  211.     </div>
  212. </footer>