versione 2.0.0
This commit is contained in:
@@ -9,6 +9,7 @@ $columnLabels = [
|
||||
'nome' => 'Nome',
|
||||
'email' => 'Email',
|
||||
'telefono' => 'Telefono',
|
||||
'tag' => 'Tag',
|
||||
];
|
||||
$vistaDefaultJson = $vista ? $vista->toJson() : 'null';
|
||||
$allColumnsJson = json_encode($allColumns);
|
||||
@@ -47,6 +48,12 @@ $canDeleteIndividui = Auth::user()->canDelete('individui');
|
||||
<a class="dropdown-item" href="#" onclick="showCreateMailingListModal(); return false;">
|
||||
<i class="fas fa-list mr-2"></i>Crea Mailing List
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" onclick="showMassGruppoModal(); return false;">
|
||||
<i class="fas fa-users mr-2"></i>Assegna Gruppo
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" onclick="showMassTagModal(); return false;">
|
||||
<i class="fas fa-tags mr-2"></i>Assegna Tag
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="#" onclick="deleteSelected(); return false;">
|
||||
<i class="fas fa-trash mr-2"></i>Elimina Selezionati
|
||||
@@ -124,6 +131,8 @@ $canDeleteIndividui = Auth::user()->canDelete('individui');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('partials._tag-filter-bar', ['filterTags' => $allTags])
|
||||
|
||||
<div class="card-body p-0">
|
||||
@if($individui->count() > 0)
|
||||
<table class="table table-bordered table-hover table-striped mb-0" id="individui-table">
|
||||
@@ -150,6 +159,9 @@ $canDeleteIndividui = Auth::user()->canDelete('individui');
|
||||
@if(in_array('telefono', $visibleColumns))
|
||||
<th data-sortable="true" data-column="telefono" onclick="sortTable('telefono')">Telefono <i class="fas fa-sort float-right"></i></th>
|
||||
@endif
|
||||
@if(in_array('tag', $visibleColumns))
|
||||
<th>Tag</th>
|
||||
@endif
|
||||
<th style="width: 120px;">Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -181,6 +193,13 @@ $canDeleteIndividui = Auth::user()->canDelete('individui');
|
||||
@if(in_array('telefono', $visibleColumns))
|
||||
<td>{{ $ind->getTelefonoPrimarioAttribute() ?: '-' }}</td>
|
||||
@endif
|
||||
@if(in_array('tag', $visibleColumns))
|
||||
<td>
|
||||
@foreach($ind->tags as $tag)
|
||||
<a href="{{ route('individui.index', ['tag[]' => $tag->slug]) }}" class="badge" style="background-color: {{ $tag->color ?? '#6c757d' }}; color: #fff;">{{ $tag->name }}</a>
|
||||
@endforeach
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
@if($canWriteIndividui)
|
||||
<a href="{{ url('/individui/' . $ind->id . '/edit') }}" class="btn btn-xs btn-warning" title="Modifica">
|
||||
@@ -415,6 +434,88 @@ $canDeleteIndividui = Auth::user()->canDelete('individui');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- MODAL: Assegna Gruppo massivo --}}
|
||||
<div class="modal fade" id="massGruppoModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-info">
|
||||
<h5 class="modal-title text-white"><i class="fas fa-users mr-2"></i>Assegna Gruppo</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal"><span>×</span></button>
|
||||
</div>
|
||||
<form id="massGruppoForm" method="POST" action="/individui/mass-gruppo">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<p class="mb-2">Operazione su <strong id="massGruppoCount">0</strong> individui 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="mgModeAssign" value="assign" checked>
|
||||
<label class="form-check-label" for="mgModeAssign">Assegna a gruppo</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="mode" id="mgModeRemove" value="remove">
|
||||
<label class="form-check-label" for="mgModeRemove">Rimuovi da gruppo</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Seleziona Gruppi</label>
|
||||
<select name="gruppi[]" class="form-control" multiple size="8">
|
||||
@foreach($gruppi as $g)
|
||||
<option value="{{ $g->id }}">{{ $g->nome }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<small class="text-muted">Seleziona con Ctrl/Cmd per scegliere più gruppi</small>
|
||||
</div>
|
||||
<input type="hidden" name="ids" id="massGruppoIds" value="">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annulla</button>
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-users mr-1"></i> Applica</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</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 bg-info">
|
||||
<h5 class="modal-title text-white"><i class="fas fa-tags mr-2"></i>Gestione Tag</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal"><span>×</span></button>
|
||||
</div>
|
||||
<form id="massTagForm" method="POST" action="/individui/mass-tag">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<p class="mb-2">Operazione su <strong id="massTagCount">0</strong> individui 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="indMtModeAssign" value="assign" checked>
|
||||
<label class="form-check-label" for="indMtModeAssign">Assegna tag</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="mode" id="indMtModeRemove" value="remove">
|
||||
<label class="form-check-label" for="indMtModeRemove">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" data-dismiss="modal">Annulla</button>
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-tags mr-1"></i> Applica</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
@@ -444,7 +545,7 @@ function applyColumnFilter() {
|
||||
if (!col || !val) return;
|
||||
|
||||
const rows = document.querySelectorAll('#table-body tr');
|
||||
const colIndex = { codice: 1, cognome: 2, nome: 3, email: 4, telefono: 5, azioni: 6 }[col];
|
||||
const colIndex = { codice: 1, cognome: 2, nome: 3, email: 4, telefono: 5, tag: 6, azioni: 7 }[col];
|
||||
|
||||
rows.forEach(row => {
|
||||
const cells = row.querySelectorAll('td');
|
||||
@@ -476,7 +577,7 @@ function sortTable(column) {
|
||||
currentSort = { column: column, direction: 'asc' };
|
||||
}
|
||||
|
||||
const colIndex = { codice: 0, cognome: 1, nome: 2, email: 3, telefono: 4, azioni: 5 }[column];
|
||||
const colIndex = { codice: 1, cognome: 2, nome: 3, email: 4, telefono: 5, tag: 6, azioni: 7 }[column];
|
||||
const tbody = document.getElementById('table-body');
|
||||
const rows = Array.from(tbody.querySelectorAll('tr'));
|
||||
|
||||
@@ -500,7 +601,7 @@ function sortTable(column) {
|
||||
}
|
||||
|
||||
function toggleColumn(column, visible) {
|
||||
const colIndex = { codice: 1, cognome: 2, nome: 3, email: 4, telefono: 5, azioni: 6 }[column];
|
||||
const colIndex = { codice: 1, cognome: 2, nome: 3, email: 4, telefono: 5, tag: 6, azioni: 7 }[column];
|
||||
const ths = document.querySelectorAll('#individui-table thead th');
|
||||
const rows = document.querySelectorAll('#table-body tr');
|
||||
|
||||
@@ -890,6 +991,28 @@ function updateMlCheckboxEmail(id, email) {
|
||||
}
|
||||
}
|
||||
|
||||
function showMassGruppoModal() {
|
||||
const ids = getSelectedIds();
|
||||
if (ids.length === 0) {
|
||||
alert('Seleziona almeno un individuo');
|
||||
return;
|
||||
}
|
||||
document.getElementById('massGruppoIds').value = ids.join(',');
|
||||
document.getElementById('massGruppoCount').textContent = ids.length;
|
||||
$('#massGruppoModal').modal('show');
|
||||
}
|
||||
|
||||
function showMassTagModal() {
|
||||
const ids = getSelectedIds();
|
||||
if (ids.length === 0) {
|
||||
alert('Seleziona almeno un individuo');
|
||||
return;
|
||||
}
|
||||
document.getElementById('massTagIds').value = ids.join(',');
|
||||
document.getElementById('massTagCount').textContent = ids.length;
|
||||
$('#massTagModal').modal('show');
|
||||
}
|
||||
|
||||
async function createMailingList() {
|
||||
const nome = document.getElementById('ml-nome').value.trim();
|
||||
if (!nome) {
|
||||
|
||||
Reference in New Issue
Block a user