{% for label, messages in app.flashes %} {% for message in messages %} <script> (function() { function showFlash() { if (window.Swal && window.Swal.fire) { const icons = { success: 'success', danger: 'error', warning: 'warning', info: 'info' }; Swal.fire({ toast: true, position: 'bottom-end', icon: icons['{{ label }}'] || 'info', title: "{{ message|e('js') }}", showConfirmButton: false, timer: 2000, width: '430px', customClass: { popup: 'toast-slide toast-offset' }, showClass: { popup: 'animate__animated animate__slideInUp' }, hideClass: { popup: 'animate__animated animate__slideOutDown' } }); } else { // Reintentar después de 100ms setTimeout(showFlash, 100); } } // Iniciar cuando el DOM esté listo if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', showFlash); } else { showFlash(); } })(); </script> {% endfor %}{% endfor %}