++ Primo Caricamento

This commit is contained in:
2026-03-30 19:15:13 +02:00
commit 663a68d59b
47 changed files with 3561 additions and 0 deletions

View File

@@ -0,0 +1,129 @@
@extends('layouts.app')
@section('title', 'Impostazioni')
@section('page-title', 'Impostazioni Applicazione')
@section('content')
{{--
Nota: queste impostazioni sono DINAMICHE modificabili senza toccare il codice.
Sono diverse dalle variabili nel .env (che richiedono un restart del container).
SettingService salva i valori nel database e li mette in cache Redis.
Ogni modifica qui si riflette immediatamente nell'applicazione.
--}}
<div class="row justify-content-center">
<div class="col-lg-10">
<div class="alert alert-info border-0 shadow-sm mb-4">
<i class="bi bi-info-circle me-2"></i>
Queste impostazioni si applicano immediatamente. La cache viene aggiornata ad ogni salvataggio.
Per la configurazione dell'infrastruttura (database, SMTP, ecc.) modifica il file <code>.env</code>.
</div>
<form method="POST" action="{{ route('settings.update') }}">
@csrf
@method('PUT')
{{-- ═══ Visualizza per gruppo ══════════════════════════════════════ --}}
@foreach ($config['groups'] as $groupName => $keys)
<div class="card mb-4">
<div class="card-header bg-white border-0 pt-4 pb-0 px-4">
<h5 class="fw-semibold mb-1">
@switch($groupName)
@case('Azienda') <i class="bi bi-building me-2 text-primary"></i>@break
@case('Visualizzazione')<i class="bi bi-palette me-2 text-warning"></i>@break
@case('Funzionalità') <i class="bi bi-toggles me-2 text-success"></i>@break
@default <i class="bi bi-gear me-2 text-muted"></i>
@endswitch
{{ $groupName }}
</h5>
</div>
<div class="card-body px-4 pb-4">
<div class="row g-3">
@foreach ($keys as $key)
@php
$type = $config['types'][$key] ?? 'string';
$desc = $config['descriptions'][$key] ?? $key;
$default = $config['defaults'][$key] ?? '';
$value = $current[$key] ?? $default;
@endphp
<div class="{{ $type === 'text' ? 'col-12' : 'col-md-6' }}">
<label class="form-label fw-medium" for="setting_{{ $key }}">
{{ $desc }}
</label>
@if ($type === 'boolean')
{{--
Checkbox: invia "1" se selezionato.
Il controller aggiunge "false" per quelli non spuntati.
--}}
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox"
id="setting_{{ $key }}" name="{{ $key }}"
value="1"
{{ $value ? 'checked' : '' }}>
<label class="form-check-label text-muted small" for="setting_{{ $key }}">
{{ $value ? 'Abilitato' : 'Disabilitato' }}
</label>
</div>
@elseif ($type === 'text')
<textarea id="setting_{{ $key }}" name="{{ $key }}"
rows="3" class="form-control {{ $errors->has($key) ? 'is-invalid' : '' }}">{{ old($key, $value) }}</textarea>
@error($key)<div class="invalid-feedback">{{ $message }}</div>@enderror
@elseif ($type === 'integer')
<input type="number" id="setting_{{ $key }}" name="{{ $key }}"
class="form-control {{ $errors->has($key) ? 'is-invalid' : '' }}"
value="{{ old($key, $value) }}" min="1">
@error($key)<div class="invalid-feedback">{{ $message }}</div>@enderror
@elseif ($key === 'theme_color')
<div class="input-group">
<input type="color" class="form-control form-control-color"
style="max-width: 60px;"
id="color_preview_{{ $key }}"
value="{{ $value }}"
oninput="document.getElementById('setting_{{ $key }}').value = this.value">
<input type="text" id="setting_{{ $key }}" name="{{ $key }}"
class="form-control font-monospace {{ $errors->has($key) ? 'is-invalid' : '' }}"
value="{{ old($key, $value) }}"
placeholder="#0d6efd"
oninput="document.getElementById('color_preview_{{ $key }}').value = this.value">
</div>
@error($key)<div class="invalid-feedback">{{ $message }}</div>@enderror
@else
<input type="text" id="setting_{{ $key }}" name="{{ $key }}"
class="form-control {{ $errors->has($key) ? 'is-invalid' : '' }}"
value="{{ old($key, $value) }}">
@error($key)<div class="invalid-feedback">{{ $message }}</div>@enderror
@endif
{{-- Mostra il valore default come suggerimento --}}
<div class="form-text text-muted">
Default: <code>{{ is_bool($default) ? ($default ? 'true' : 'false') : $default }}</code>
</div>
</div>
@endforeach
</div>
</div>
</div>
@endforeach
<div class="d-flex justify-content-end gap-2">
<a href="{{ route('dashboard') }}" class="btn btn-outline-secondary">Annulla</a>
<button type="submit" class="btn btn-primary">
<i class="bi bi-floppy me-1"></i>Salva Impostazioni
</button>
</div>
</form>
</div>
</div>
@endsection