export calendar - modifica impostazioni
This commit is contained in:
@@ -17,6 +17,12 @@
|
||||
<a href="{{ route('eventi.create') }}" class="btn btn-success btn-sm">
|
||||
<i class="fas fa-plus mr-1"></i> Nuovo Evento
|
||||
</a>
|
||||
<form action="{{ route('eventi.export-selected-ics') }}" method="POST" class="d-inline">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-success btn-sm">
|
||||
<i class="fas fa-calendar-plus mr-1"></i> Esporta ICS
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@@ -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
|
||||
@@ -308,6 +308,9 @@
|
||||
<i class="fas fa-trash mr-1"></i> Elimina
|
||||
</button>
|
||||
</form>
|
||||
<a href="/eventi/{{ $evento->id }}/export-ics" class="btn btn-success">
|
||||
<i class="fas fa-calendar-plus mr-1"></i> Esporta ICS
|
||||
</a>
|
||||
<a href="/eventi" class="btn btn-secondary">
|
||||
<i class="fas fa-arrow-left mr-1"></i> Torna all'elenco
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user