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