113 lines
2.4 KiB
PHP
113 lines
2.4 KiB
PHP
@include('layouts._partials.error')
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
@include('layouts._partials.head')
|
|
@vite([ 'resources/js/app.js'])
|
|
|
|
|
|
{{-- Livewire styles --}}
|
|
@livewireStyles
|
|
|
|
</head>
|
|
|
|
<body id="page-top" class="sidebar-toggled">
|
|
<div id="wrapper">
|
|
|
|
@include('layouts._partials.menu')
|
|
|
|
<div id="content-wrapper" class="d-flex flex-column">
|
|
<div id="content">
|
|
@include('layouts._partials.header')
|
|
@yield('content')
|
|
</div>
|
|
|
|
@include('layouts._partials.footer')
|
|
</div>
|
|
</div>
|
|
|
|
|
|
{{-- JS base --}}
|
|
@include('layouts._partials.scripts')
|
|
|
|
{{-- Livewire --}}
|
|
@livewireScripts
|
|
|
|
{{-- scripts por vista --}}
|
|
@yield('scripts')
|
|
|
|
@stack('scripts')
|
|
|
|
<script>
|
|
document.addEventListener('livewire:init', () => {
|
|
|
|
Livewire.on('swal', (data, ...payload) => {
|
|
|
|
// 🔥 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: 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();
|
|
});
|
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
function toggleSidebarByScreen() {
|
|
if (window.innerWidth < 768) {
|
|
document.body.classList.add("sidebar-toggled");
|
|
document.querySelector(".sidebar").classList.add("toggled");
|
|
} else {
|
|
document.body.classList.remove("sidebar-toggled");
|
|
document.querySelector(".sidebar").classList.remove("toggled");
|
|
}
|
|
}
|
|
|
|
toggleSidebarByScreen();
|
|
window.addEventListener("resize", toggleSidebarByScreen);
|
|
|
|
});
|
|
</script>
|
|
|
|
@stack('modals')
|
|
|
|
</body>
|
|
</html>
|