modifiche siderbar e correzioni
This commit is contained in:
@@ -23,6 +23,17 @@
|
||||
<label>Descrizione Breve</label>
|
||||
<input type="text" name="descrizione_evento" class="form-control" value="{{ old('descrizione_evento') }}" placeholder="Breve descrizione">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Tipo Evento</label>
|
||||
<select name="tipo_evento" class="form-control">
|
||||
<option value="">Seleziona tipo...</option>
|
||||
@foreach($tipologieEventi as $tipo)
|
||||
<option value="{{ $tipo->nome }}" {{ old('tipo_evento') === $tipo->nome ? 'selected' : '' }}>
|
||||
{{ $tipo->descrizione ?: $tipo->nome }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Descrizione Completa</label>
|
||||
<textarea name="descrizione" class="form-control" rows="3">{{ old('descrizione') }}</textarea>
|
||||
|
||||
@@ -22,7 +22,19 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Tipo Evento</label>
|
||||
<input type="text" name="tipo_evento" class="form-control" value="{{ old('tipo_evento', $evento->tipo_evento) }}" placeholder="es. Catechesi, Liturgia, Animazione">
|
||||
<select name="tipo_evento" class="form-control">
|
||||
<option value="">Seleziona tipo...</option>
|
||||
@foreach($tipologieEventi as $tipo)
|
||||
<option value="{{ $tipo->nome }}" {{ old('tipo_evento', $evento->tipo_evento) === $tipo->nome ? 'selected' : '' }}>
|
||||
{{ $tipo->descrizione ?: $tipo->nome }}
|
||||
</option>
|
||||
@endforeach
|
||||
@if($evento->tipo_evento && !\App\Models\TipologiaEvento::where('nome', $evento->tipo_evento)->exists())
|
||||
<option value="{{ $evento->tipo_evento }}" selected>
|
||||
{{ $evento->tipo_evento }} (disattivato)
|
||||
</option>
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Descrizione Completa</label>
|
||||
|
||||
@@ -98,9 +98,19 @@ $canDeleteEventi = Auth::user()->canDelete('eventi');
|
||||
@endif
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a href="{{ request()->fullUrlWithQuery(['sort' => 'tipo_evento', 'direction' => request('sort') === 'tipo_evento' && request('direction') === 'asc' ? 'desc' : 'asc']) }}" class="text-dark">
|
||||
Tipologia
|
||||
@if(request('sort') === 'tipo_evento')
|
||||
<i class="fas fa-sort-{{ request('direction') === 'asc' ? 'up' : 'down' }} ml-1"></i>
|
||||
@else
|
||||
<i class="fas fa-sort ml-1 text-muted"></i>
|
||||
@endif
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a href="{{ request()->fullUrlWithQuery(['sort' => 'tipo_recorrenza', 'direction' => request('sort') === 'tipo_recorrenza' && request('direction') === 'asc' ? 'desc' : 'asc']) }}" class="text-dark">
|
||||
Tipo
|
||||
Ricorrenza
|
||||
@if(request('sort') === 'tipo_recorrenza')
|
||||
<i class="fas fa-sort-{{ request('direction') === 'asc' ? 'up' : 'down' }} ml-1"></i>
|
||||
@else
|
||||
@@ -162,6 +172,20 @@ $canDeleteEventi = Auth::user()->canDelete('eventi');
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ Str::limit($evento->descrizione_evento, 50) ?: '-' }}</td>
|
||||
<td>
|
||||
@if($evento->tipo_evento)
|
||||
@php
|
||||
$tipologiaEvento = \App\Models\TipologiaEvento::where('nome', $evento->tipo_evento)->first();
|
||||
@endphp
|
||||
@if($tipologiaEvento)
|
||||
<span class="badge badge-primary">{{ $tipologiaEvento->descrizione ?: $tipologiaEvento->nome }}</span>
|
||||
@else
|
||||
<span class="badge badge-secondary">{{ $evento->tipo_evento }}</span>
|
||||
@endif
|
||||
@else
|
||||
<span class="text-muted">-</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($evento->tipo_recorrenza && $evento->tipo_recorrenza !== 'singolo')
|
||||
<span class="badge badge-info">{{ $evento->periodicita_label }}</span>
|
||||
@@ -211,7 +235,7 @@ $canDeleteEventi = Auth::user()->canDelete('eventi');
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="8" class="text-center text-muted py-4">
|
||||
<td colspan="9" class="text-center text-muted py-4">
|
||||
<i class="fas fa-calendar fa-2x mb-2"></i>
|
||||
<p class="mb-0">Nessun evento trovato</p>
|
||||
</td>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="card-body">
|
||||
<table class="table table-sm table-borderless mb-0">
|
||||
<tr>
|
||||
<td style="width: 150px;"><strong>Tipo:</strong></td>
|
||||
<td style="width: 150px;"><strong>Ricorrenza:</strong></td>
|
||||
<td>
|
||||
@if($evento->tipo_recorrenza && $evento->tipo_recorrenza !== 'singolo')
|
||||
<span class="badge badge-info">{{ $evento->periodicita_label }}</span>
|
||||
@@ -52,6 +52,21 @@
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@if($evento->tipo_evento)
|
||||
<tr>
|
||||
<td><strong>Tipologia:</strong></td>
|
||||
<td>
|
||||
@php
|
||||
$tipologia = \App\Models\TipologiaEvento::where('nome', $evento->tipo_evento)->first();
|
||||
@endphp
|
||||
@if($tipologia)
|
||||
<span class="badge badge-primary">{{ $tipologia->descrizione ?: $tipologia->nome }}</span>
|
||||
@else
|
||||
<span class="badge badge-secondary">{{ $evento->tipo_evento }}</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if($evento->tipo_recorrenza === 'settimanale')
|
||||
<tr>
|
||||
<td><strong>Giorno:</strong></td>
|
||||
|
||||
@@ -29,6 +29,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="#tipologie-eventi" class="list-group-item list-group-item-action" data-toggle="tab">
|
||||
<i class="nav-icon fas fa-calendar mr-2"></i> Tipologie Eventi
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -315,6 +318,80 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="tipologie-eventi">
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Tipologie Eventi</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="text-muted">Gestisci le tipologie disponibili per gli eventi del calendario.</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="#addTipologiaEventoModal">
|
||||
<i class="fas fa-plus"></i> Nuova Tipologia
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table class="table table-bordered table-striped" id="tipologie-eventi-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 40px;">Ordine</th>
|
||||
<th>Nome</th>
|
||||
<th>Descrizione</th>
|
||||
<th style="width: 100px;">Stato</th>
|
||||
<th style="width: 150px;">Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tipologie-eventi-sortable">
|
||||
@foreach($tipologieEventi as $tipologia)
|
||||
<tr data-id="{{ $tipologia->id }}">
|
||||
<td class="text-center">
|
||||
<i class="fas fa-arrows-alt handle" style="cursor: grab;"></i>
|
||||
</td>
|
||||
<td>
|
||||
<span class="tipologia-evento-nome">{{ $tipologia->nome }}</span>
|
||||
</td>
|
||||
<td>{{ $tipologia->descrizione ?? '-' }}</td>
|
||||
<td>
|
||||
@if($tipologia->attiva)
|
||||
<span class="badge badge-success">Attiva</span>
|
||||
@else
|
||||
<span class="badge badge-secondary">Disattivata</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-warning" onclick="editTipologiaEvento({{ $tipologia->id }}, '{{ addslashes($tipologia->nome) }}', '{{ addslashes($tipologia->descrizione ?? '') }}', {{ $tipologia->attiva ? 'true' : 'false' }})">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
@if($tipologia->eventi()->count() == 0)
|
||||
<form method="POST" action="{{ route('impostazioni.tipologie-eventi.destroy', $tipologia->id) }}" style="display: inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questa tipologia?')">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<button type="button" class="btn btn-xs btn-danger" disabled title="Eventi associati: {{ $tipologia->eventi()->count() }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -446,11 +523,93 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="addTipologiaEventoModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form method="POST" action="{{ route('impostazioni.tipologie-eventi.store') }}">
|
||||
@csrf
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Nuova Tipologia Evento</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="tipologia_evento_nome">Nome *</label>
|
||||
<input type="text" name="nome" id="tipologia_evento_nome" class="form-control" required maxlength="50" placeholder="es. catechesi">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tipologia_evento_descrizione">Descrizione</label>
|
||||
<input type="text" name="descrizione" id="tipologia_evento_descrizione" class="form-control" maxlength="255" placeholder="es. Catechesi">
|
||||
</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="editTipologiaEventoModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form method="POST" action="" id="editTipologiaEventoForm">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<input type="hidden" name="id" id="edit_tipologia_evento_id">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Modifica Tipologia Evento</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="edit_tipologia_evento_nome">Nome *</label>
|
||||
<input type="text" name="nome" id="edit_tipologia_evento_nome" class="form-control" required maxlength="50">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="edit_tipologia_evento_descrizione">Descrizione</label>
|
||||
<input type="text" name="descrizione" id="edit_tipologia_evento_descrizione" class="form-control" maxlength="255">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="edit_tipologia_evento_attiva" name="attiva" value="1">
|
||||
<label class="custom-control-label" for="edit_tipologia_evento_attiva">Attiva</label>
|
||||
</div>
|
||||
</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>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.0/Sortable.min.js"></script>
|
||||
<script>
|
||||
function activateTabFromHash() {
|
||||
var hash = window.location.hash;
|
||||
if (hash) {
|
||||
var tabLink = document.querySelector('.list-group a[href="' + hash + '"]');
|
||||
if (tabLink) {
|
||||
$(tabLink).tab('show');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
activateTabFromHash();
|
||||
});
|
||||
|
||||
$(window).on('hashchange', function() {
|
||||
activateTabFromHash();
|
||||
});
|
||||
|
||||
function editTipologia(id, nome, descrizione, attiva) {
|
||||
$('#edit_tipologia_id').val(id);
|
||||
$('#edit_tipologia_nome').val(nome);
|
||||
@@ -469,6 +628,15 @@ function editRuolo(id, nome, descrizione, attiva) {
|
||||
$('#editRuoloModal').modal('show');
|
||||
}
|
||||
|
||||
function editTipologiaEvento(id, nome, descrizione, attiva) {
|
||||
$('#edit_tipologia_evento_id').val(id);
|
||||
$('#edit_tipologia_evento_nome').val(nome);
|
||||
$('#edit_tipologia_evento_descrizione').val(descrizione);
|
||||
$('#edit_tipologia_evento_attiva').prop('checked', attiva);
|
||||
$('#editTipologiaEventoForm').attr('action', '/impostazioni/tipologie-eventi/' + id);
|
||||
$('#editTipologiaEventoModal').modal('show');
|
||||
}
|
||||
|
||||
var sortableTipologie = Sortable.create(document.getElementById('tipologie-sortable'), {
|
||||
handle: '.handle',
|
||||
animation: 150,
|
||||
@@ -509,11 +677,34 @@ var sortableRuoli = Sortable.create(document.getElementById('ruoli-sortable'), {
|
||||
}
|
||||
});
|
||||
|
||||
var sortableTipologieEventi = Sortable.create(document.getElementById('tipologie-eventi-sortable'), {
|
||||
handle: '.handle',
|
||||
animation: 150,
|
||||
onEnd: function(evt) {
|
||||
var order = [];
|
||||
$('#tipologie-eventi-sortable tr').each(function() {
|
||||
order.push($(this).data('id'));
|
||||
});
|
||||
|
||||
fetch('{{ route('impostazioni.tipologie-eventi.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') {
|
||||
sortableRuoli.refresh();
|
||||
}
|
||||
if (target === '#tipologie-eventi') {
|
||||
sortableTipologieEventi.refresh();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -204,23 +204,11 @@ $appName = \App\Models\AppSetting::getAppName() ?? 'Glastree';
|
||||
@endif
|
||||
@if(Auth::user()->isSuperAdmin())
|
||||
<li class="nav-item has-treeview">
|
||||
<a href="#" class="nav-link">
|
||||
<a href="/impostazioni" class="nav-link">
|
||||
<i class="nav-icon fas fa-cog"></i>
|
||||
<p>Impostazioni <i class="right fas fa-angle-left"></i></p>
|
||||
</a>
|
||||
<ul class="nav nav-treeview">
|
||||
<li class="nav-item">
|
||||
<a href="/impostazioni#tipologie" class="nav-link">
|
||||
<i class="nav-icon fas fa-file"></i>
|
||||
<p>Tipologie Documenti</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/impostazioni#ruoli" class="nav-link">
|
||||
<i class="nav-icon fas fa-users-cog"></i>
|
||||
<p>Tipi di Ruolo</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/impostazioni/email" class="nav-link">
|
||||
<i class="nav-icon fas fa-envelope"></i>
|
||||
|
||||
Reference in New Issue
Block a user