finale 2.0.0
This commit is contained in:
@@ -44,6 +44,9 @@
|
||||
<a href="#ruoli" class="list-group-item list-group-item-action" data-toggle="tab">
|
||||
<i class="nav-icon fas fa-users-cog mr-2"></i> Tipi di Ruolo
|
||||
</a>
|
||||
<a href="#tag" class="list-group-item list-group-item-action" data-toggle="tab">
|
||||
<i class="nav-icon fas fa-tags mr-2"></i> Tag
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1068,6 +1071,136 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- === TAG === --}}
|
||||
<div class="tab-pane" id="tag">
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Tag</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="text-muted">Gestisci i tag (etichette) per classificare individui, gruppi, eventi e documenti.</p>
|
||||
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success">{{ session('success') }}</div>
|
||||
@endif
|
||||
@if(session('error'))
|
||||
<div class="alert alert-danger">{{ session('error') }}</div>
|
||||
@endif
|
||||
|
||||
<div class="mb-3">
|
||||
<button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#addTagModal">
|
||||
<i class="fas fa-plus"></i> Nuovo Tag
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table class="table table-bordered table-striped" id="tag-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 40px;">Ordine</th>
|
||||
<th>Tag</th>
|
||||
<th>Nome</th>
|
||||
<th>Slug</th>
|
||||
<th style="width: 100px;">Colore</th>
|
||||
<th style="width: 150px;">Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tag-sortable">
|
||||
@foreach($tags as $tag)
|
||||
<tr data-id="{{ $tag->id }}">
|
||||
<td class="text-center">
|
||||
<i class="fas fa-arrows-alt handle" style="cursor: grab;"></i>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge" style="background-color: {{ $tag->color ?? '#6c757d' }}; color: #fff;">
|
||||
{{ $tag->name }}
|
||||
</span>
|
||||
</td>
|
||||
<td><span class="tag-nome">{{ $tag->name }}</span></td>
|
||||
<td><code>{{ $tag->slug }}</code></td>
|
||||
<td>
|
||||
<span class="tag-color-preview" style="display:inline-block;width:24px;height:24px;border-radius:4px;background:{{ $tag->color ?? '#6c757d' }};border:1px solid #dee2e6;vertical-align:middle;"></span>
|
||||
<span class="tag-color-value">{{ $tag->color ?? '-' }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-warning" onclick="editTag({{ $tag->id }}, '{{ addslashes($tag->name) }}', '{{ $tag->color ?? '' }}')">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
<form method="POST" action="{{ route('impostazioni.tag.destroy', $tag->id) }}" style="display: inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questo tag?')">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ===== MODALI TAG ===== --}}
|
||||
<div class="modal fade" id="addTagModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form method="POST" action="{{ route('impostazioni.tag.store') }}">
|
||||
@csrf
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Nuovo Tag</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="tagName">Nome *</label>
|
||||
<input type="text" name="name" id="tagName" class="form-control" required maxlength="100" placeholder="es. giovani">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tagColor">Colore</label>
|
||||
<input type="color" name="color" id="tagColor" class="form-control" style="height:38px;padding:4px;" value="#007bff">
|
||||
<small class="text-muted">Scegli un colore per il badge del tag</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annulla</button>
|
||||
<button type="submit" class="btn btn-primary">Salva</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="editTagModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form method="POST" action="" id="editTagForm">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Modifica Tag</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="editTagName">Nome *</label>
|
||||
<input type="text" name="name" id="editTagName" class="form-control" required maxlength="100">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="editTagColor">Colore</label>
|
||||
<input type="color" name="color" id="editTagColor" class="form-control" style="height:38px;padding:4px;">
|
||||
<small class="text-muted">Scegli un colore per il badge del tag</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annulla</button>
|
||||
<button type="submit" class="btn btn-primary">Salva</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1618,6 +1751,32 @@ var sortableTipologieEventi = Sortable.create(document.getElementById('tipologie
|
||||
}
|
||||
});
|
||||
|
||||
function editTag(id, name, color) {
|
||||
$('#editTagName').val(name);
|
||||
$('#editTagColor').val(color || '#007bff');
|
||||
$('#editTagForm').attr('action', '/impostazioni/tag/' + id);
|
||||
$('#editTagModal').modal('show');
|
||||
}
|
||||
|
||||
var sortableTag = Sortable.create(document.getElementById('tag-sortable'), {
|
||||
handle: '.handle',
|
||||
animation: 150,
|
||||
onEnd: function(evt) {
|
||||
var order = [];
|
||||
$('#tag-sortable tr').each(function() {
|
||||
order.push($(this).data('id'));
|
||||
});
|
||||
fetch('{{ route('impostazioni.tag.reorder') }}', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ order: order })
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
var target = $(e.target).attr('href');
|
||||
if (target === '#ruoli') {
|
||||
@@ -1626,6 +1785,9 @@ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
if (target === '#tipologie-eventi') {
|
||||
sortableTipologieEventi.refresh();
|
||||
}
|
||||
if (target === '#tag') {
|
||||
sortableTag.refresh();
|
||||
}
|
||||
if (target === '#calendario') {
|
||||
if (typeof sortableCalendario !== 'undefined') {
|
||||
sortableCalendario.refresh();
|
||||
|
||||
Reference in New Issue
Block a user