pre version 2
This commit is contained in:
@@ -19,6 +19,12 @@ $entityType = $entityType ?? 'eventi';
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session('error'))
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
{{ session('error') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
@@ -33,12 +39,15 @@ $entityType = $entityType ?? 'eventi';
|
||||
<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($canWriteEventi)
|
||||
<button type="button" class="btn btn-sm btn-info mr-2" onclick="showMassTagModal()">
|
||||
<i class="fas fa-tags mr-1"></i> Tag
|
||||
</button>
|
||||
@endif
|
||||
@if($canDeleteEventi)
|
||||
<div class="btn-group mr-2">
|
||||
<button type="button" class="btn btn-sm btn-danger" onclick="deleteSelected()">
|
||||
<i class="fas fa-trash mr-1"></i> Elimina Selezionati
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-danger" onclick="deleteSelected()">
|
||||
<i class="fas fa-trash mr-1"></i> Elimina Selezionati
|
||||
</button>
|
||||
@endif
|
||||
@if($canWriteEventi)
|
||||
<a href="/eventi/import" class="btn btn-sm btn-warning mr-2">
|
||||
@@ -86,7 +95,7 @@ $entityType = $entityType ?? 'eventi';
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th style="width: 40px;" data-column="select">
|
||||
@if($canDeleteEventi)
|
||||
@if($canWriteEventi)
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="select-all" onchange="toggleSelectAll(this)">
|
||||
<label class="custom-control-label" for="select-all"></label>
|
||||
@@ -187,7 +196,7 @@ $entityType = $entityType ?? 'eventi';
|
||||
@forelse($eventi as $evento)
|
||||
<tr data-id="{{ $evento->id }}">
|
||||
<td>
|
||||
@if($canDeleteEventi)
|
||||
@if($canWriteEventi)
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input row-checkbox" id="row-checkbox-{{ $evento->id }}" value="{{ $evento->id }}">
|
||||
<label class="custom-control-label" for="row-checkbox-{{ $evento->id }}"></label>
|
||||
@@ -277,6 +286,9 @@ $entityType = $entityType ?? 'eventi';
|
||||
<a href="{{ url('/eventi/' . $evento->id . '/edit') }}" class="btn btn-xs btn-warning" title="Modifica">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<button type="button" class="btn btn-xs btn-info" onclick="openSingleTag({{ $evento->id }})" title="Assegna tag">
|
||||
<i class="fas fa-tags"></i>
|
||||
</button>
|
||||
<form action="{{ url('/eventi/' . $evento->id) }}" method="POST" class="d-inline">
|
||||
@csrf @method('DELETE')
|
||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Confermi l\'eliminazione?')" title="Elimina">
|
||||
@@ -327,8 +339,51 @@ $entityType = $entityType ?? 'eventi';
|
||||
|
||||
<div id="vista-data" style="display:none;">{{ $vistaDefaultJson }}</div>
|
||||
|
||||
{{-- MODAL: Gestione Tag massiva --}}
|
||||
<div class="modal fade" id="massTagModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-dialog-scrollable" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-tags mr-2"></i>Gestione Tag</h5>
|
||||
<button type="button" class="close" onclick="$('#massTagModal').modal('hide')">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form id="massTagForm" method="POST" action="/eventi/mass-tag">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<p class="mb-2">Operazione su <strong id="massTagCount">0</strong> eventi selezionati.</p>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label class="font-weight-bold">Azione</label>
|
||||
<div class="d-flex" style="gap:1.5rem;">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="mode" id="mtModeAssign" value="assign" checked>
|
||||
<label class="form-check-label" for="mtModeAssign">Assegna tag</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="mode" id="mtModeRemove" value="remove">
|
||||
<label class="form-check-label" for="mtModeRemove">Rimuovi tag</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('partials._tag-selector', ['label' => 'Seleziona tag'])
|
||||
|
||||
<input type="hidden" name="ids" id="massTagIds" value="">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" onclick="$('#massTagModal').modal('hide')">Annulla</button>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-tags mr-1"></i> Applica
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog">
|
||||
@if($canDeleteEventi)
|
||||
@if($canWriteEventi)
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-danger">
|
||||
@@ -358,10 +413,28 @@ function toggleSelectAll(source) {
|
||||
document.querySelectorAll('.row-checkbox').forEach(cb => cb.checked = source.checked);
|
||||
}
|
||||
|
||||
function showMassTagModal() {
|
||||
const ids = getSelectedIds();
|
||||
if (ids.length === 0) {
|
||||
alert('Seleziona almeno un evento');
|
||||
return;
|
||||
}
|
||||
document.getElementById('massTagIds').value = ids.join(',');
|
||||
document.getElementById('massTagCount').textContent = ids.length;
|
||||
$('#massTagModal').modal('show');
|
||||
}
|
||||
|
||||
function getSelectedIds() {
|
||||
return Array.from(document.querySelectorAll('.row-checkbox:checked')).map(cb => cb.value);
|
||||
}
|
||||
|
||||
function openSingleTag(eventId) {
|
||||
document.querySelectorAll('.row-checkbox').forEach(cb => cb.checked = false);
|
||||
var cb = document.getElementById('row-checkbox-' + eventId);
|
||||
if (cb) cb.checked = true;
|
||||
showMassTagModal();
|
||||
}
|
||||
|
||||
function deleteSelected() {
|
||||
const selectedIds = getSelectedIds();
|
||||
if (selectedIds.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user