fix 1.2.7
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
<a href="{{ route('eventi.create') }}" class="btn btn-success btn-sm">
|
||||
<i class="fas fa-plus mr-1"></i> Nuovo Evento
|
||||
</a>
|
||||
<button type="button" class="btn btn-info btn-sm" id="syncCalendarsBtn" onclick="syncCalendars()">
|
||||
<i class="fas fa-sync mr-1"></i> Sync
|
||||
</button>
|
||||
<form action="{{ route('eventi.export-selected-ics') }}" method="POST" class="d-inline">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-success btn-sm">
|
||||
@@ -40,10 +43,44 @@
|
||||
@section('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.10/index.global.min.js"></script>
|
||||
<script>
|
||||
function syncCalendars() {
|
||||
var btn = document.getElementById('syncCalendarsBtn');
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<i class="fas fa-spinner fa-spin mr-1"></i> Sync...';
|
||||
|
||||
fetch('{{ route('calendario-connessioni.sync-all') }}', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
var msg = data.connections + ' connessioni sincronizzate.';
|
||||
msg += ' Importati: ' + data.total_imported + ', Esportati: ' + data.total_exported + '.';
|
||||
if (data.success) {
|
||||
alert('✅ Sync completato!\n' + msg);
|
||||
} else {
|
||||
alert('⚠️ Sync completato con errori.\n' + msg);
|
||||
}
|
||||
if (window.calendar) {
|
||||
window.calendar.refetchEvents();
|
||||
}
|
||||
})
|
||||
.catch(function(err) {
|
||||
alert('❌ Errore sync: ' + err.message);
|
||||
})
|
||||
.finally(function() {
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="fas fa-sync mr-1"></i> Sync';
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var calendarEl = document.getElementById('calendar');
|
||||
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
window.calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
initialView: 'dayGridMonth',
|
||||
locale: 'it',
|
||||
headerToolbar: {
|
||||
@@ -97,7 +134,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
window.calendar.render();
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user