inizio sistemazione tag mailing list
This commit is contained in:
@@ -769,10 +769,6 @@
|
||||
<div class="alert alert-danger">{{ session('error') }}</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$calendarioConnessioni = \App\Models\CalendarioConnessione::orderBy('ordine')->get();
|
||||
@endphp
|
||||
|
||||
@if($calendarioConnessioni->count() > 0)
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover table-sm">
|
||||
@@ -1572,6 +1568,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="hidden" name="is_active" value="0">
|
||||
<input type="checkbox" class="custom-control-input" id="cal_is_active" name="is_active" value="1" checked>
|
||||
<label class="custom-control-label" for="cal_is_active">Connessione attiva</label>
|
||||
</div>
|
||||
|
||||
@@ -19,10 +19,11 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox mt-4">
|
||||
<input type="checkbox" class="custom-control-input" id="attiva" name="attiva" value="1" checked>
|
||||
<label class="custom-control-label" for="attiva">Lista attiva</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox mt-4">
|
||||
<input type="hidden" name="attiva" value="0">
|
||||
<input type="checkbox" class="custom-control-input" id="attiva" name="attiva" value="1" checked>
|
||||
<label class="custom-control-label" for="attiva">Lista attiva</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<h3 class="card-title"><i class="fas fa-edit mr-2"></i>Modifica Mailing List</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ url('/mailing-liste/' . $mailingList->id) }}" method="POST" id="ml-form">
|
||||
<form action="{{ route('mailing-liste.update', $mailingList->id) }}" method="POST" id="ml-form">
|
||||
@csrf @method('PUT')
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
@@ -20,6 +20,7 @@
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox mt-4">
|
||||
<input type="hidden" name="attiva" value="0">
|
||||
<input type="checkbox" class="custom-control-input" id="attiva" name="attiva" value="1" {{ $mailingList->attiva ? 'checked' : '' }}>
|
||||
<label class="custom-control-label" for="attiva">Lista attiva</label>
|
||||
</div>
|
||||
|
||||
@@ -18,6 +18,12 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
{{ 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">
|
||||
@@ -26,12 +32,15 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<button type="button" class="btn btn-sm btn-secondary mr-1" onclick="$('#table-settings-modal').modal('show')" title="Impostazioni tabella">
|
||||
<i class="fas fa-cog"></i>
|
||||
</button>
|
||||
@if($canWriteMailing)
|
||||
<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($canDeleteMailing)
|
||||
<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($canWriteMailing)
|
||||
<a href="{{ route('mailing-liste.create') }}" class="btn btn-success btn-sm">
|
||||
@@ -47,7 +56,7 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th style="width: 40px;" data-column="select">
|
||||
@if($canDeleteMailing)
|
||||
@if($canWriteMailing || $canDeleteMailing)
|
||||
<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>
|
||||
@@ -79,7 +88,7 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
@foreach($mailingLists as $lista)
|
||||
<tr data-id="{{ $lista->id }}">
|
||||
<td>
|
||||
@if($canDeleteMailing)
|
||||
@if($canWriteMailing || $canDeleteMailing)
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input row-checkbox" id="row-checkbox-{{ $lista->id }}" value="{{ $lista->id }}">
|
||||
<label class="custom-control-label" for="row-checkbox-{{ $lista->id }}"></label>
|
||||
@@ -128,6 +137,9 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
@if($canWriteMailing)
|
||||
<button type="button" class="btn btn-xs btn-info" onclick="openSingleTag({{ $lista->id }})" title="Assegna tag">
|
||||
<i class="fas fa-tags"></i>
|
||||
</button>
|
||||
<a href="{{ route('mailing-liste.edit', $lista->id) }}" class="btn btn-xs btn-warning" title="Modifica">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
@@ -159,6 +171,51 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
|
||||
<div id="vista-data" style="display:none;">{{ $vistaDefaultJson }}</div>
|
||||
|
||||
<div class="modal fade" id="massTagModal" tabindex="-1" role="dialog">
|
||||
@if($canWriteMailing)
|
||||
<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="{{ route('mailing-liste.mass-tag') }}">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<p class="mb-2">Operazione su <strong id="massTagCount">0</strong> mailing list selezionate.</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>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog">
|
||||
@if($canDeleteMailing)
|
||||
<div class="modal-dialog" role="document">
|
||||
@@ -194,6 +251,24 @@ function getSelectedIds() {
|
||||
return Array.from(document.querySelectorAll('.row-checkbox:checked')).map(cb => cb.value);
|
||||
}
|
||||
|
||||
function showMassTagModal() {
|
||||
const ids = getSelectedIds();
|
||||
if (ids.length === 0) {
|
||||
alert('Seleziona almeno una mailing list');
|
||||
return;
|
||||
}
|
||||
document.getElementById('massTagIds').value = ids.join(',');
|
||||
document.getElementById('massTagCount').textContent = ids.length;
|
||||
$('#massTagModal').modal('show');
|
||||
}
|
||||
|
||||
function openSingleTag(listId) {
|
||||
document.querySelectorAll('.row-checkbox').forEach(cb => cb.checked = false);
|
||||
var cb = document.getElementById('row-checkbox-' + listId);
|
||||
if (cb) cb.checked = true;
|
||||
showMassTagModal();
|
||||
}
|
||||
|
||||
function deleteSelected() {
|
||||
const selectedIds = getSelectedIds();
|
||||
if (selectedIds.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user