Actualización de moelo user y relación many con asistencias, creación del modelo de asistencia y control por middleware y autenticación
This commit is contained in:
@@ -33,30 +33,59 @@
|
||||
{{-- scripts por vista --}}
|
||||
@yield('scripts')
|
||||
|
||||
@stack('scripts')
|
||||
|
||||
<script>
|
||||
window.addEventListener('swal', event => {
|
||||
document.addEventListener('livewire:init', () => {
|
||||
|
||||
console.log('Evento swal recibido:', event.detail);
|
||||
Livewire.on('swal', (data, ...payload) => {
|
||||
|
||||
if (!event.detail) return;
|
||||
// 🔥 compatibilidad Livewire viejo y nuevo
|
||||
if (Array.isArray(data)) {
|
||||
data = data[0];
|
||||
}
|
||||
|
||||
if (!data && payload.length) {
|
||||
data = payload[0];
|
||||
}
|
||||
|
||||
if (!data || !data.text) {
|
||||
console.warn('SweetAlert disparado sin datos', data);
|
||||
return;
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
icon: event.detail.icon ?? 'info',
|
||||
title: event.detail.title ?? 'Aviso',
|
||||
text: event.detail.text ?? '',
|
||||
icon: data.icon ?? 'info',
|
||||
title: data.title ?? 'Aviso',
|
||||
text: data.text,
|
||||
timer: data.timer ?? null,
|
||||
showConfirmButton: data.confirm ?? true,
|
||||
});
|
||||
|
||||
if (data.reload) {
|
||||
setTimeout(() => location.reload(), data.reload);
|
||||
}
|
||||
|
||||
if (data.closeModal) {
|
||||
$('#exampleModal').modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
Livewire.on('open-prospecto-modal', () => {
|
||||
$('#exampleModal').modal('show');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
window.addEventListener('close-modal', () => {
|
||||
const modal = bootstrap.Modal.getInstance(
|
||||
document.getElementById('logoutSessionsModal')
|
||||
);
|
||||
modal?.hide();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
window.addEventListener('close-modal', () => {
|
||||
const modal = bootstrap.Modal.getInstance(
|
||||
document.getElementById('logoutSessionsModal')
|
||||
);
|
||||
modal?.hide();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user