export calendar - modifica impostazioni

This commit is contained in:
2026-05-26 14:10:04 +02:00
parent 60ebd3b652
commit 982d754857
26 changed files with 1609 additions and 289 deletions
+31
View File
@@ -23,6 +23,9 @@ $canDeleteEventi = Auth::user()->canDelete('eventi');
<a href="/eventi/calendar" class="btn btn-sm btn-outline-primary mr-2">
<i class="fas fa-calendar-alt mr-1"></i> Calendario
</a>
<button type="button" class="btn btn-sm btn-success mr-2" onclick="exportSelectedIcs()">
<i class="fas fa-calendar-plus mr-1"></i> Esporta ICS
</button>
@if($canDeleteEventi)
<div class="btn-group mr-2">
<button type="button" class="btn btn-sm btn-danger" onclick="deleteSelected()">
@@ -311,5 +314,33 @@ function deleteSelected() {
$('#deleteModal').modal('show');
}
function exportSelectedIcs() {
const selectedIds = getSelectedIds();
const form = document.createElement('form');
form.method = 'POST';
form.action = '/eventi/export-ics';
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content || '{{ csrf_token() }}';
let html = `<input type="hidden" name="_token" value="${csrfToken}">`;
if (selectedIds.length > 0) {
selectedIds.forEach(function(id) {
html += `<input type="hidden" name="ids[]" value="${id}">`;
});
} else {
const params = new URLSearchParams(window.location.search);
params.forEach(function(value, key) {
if (key === 'search') html += `<input type="hidden" name="search" value="${value}">`;
if (key === 'gruppo_id') html += `<input type="hidden" name="gruppo_id" value="${value}">`;
if (key === 'tipo') html += `<input type="hidden" name="tipo" value="${value}">`;
});
}
form.innerHTML = html;
document.body.appendChild(form);
form.submit();
}
</script>
@endsection