Blocco 2 - Esiti delle azioni Livewire come avvisi (trait Avvisa) invece di flash che comparivano alla pagina dopo. - PDF, miniature e versioni dei territori non più serviti da nginx su /storage: TerritorioFileController con login, permessi e cache privata. - Ripristino tutto o niente: verifica dell'archivio, una transazione con import, piantine, blocco account e scambio dei file annullabile. - Backup formato 2 con piantine, storico PDF e area KML. - Posto unico preso in un passo (Cache::lock) e rispettato anche da import XML e PDF. - Import PDF da cartella: abbinamento corretto (1-A, 12 B, ambigui), caricamento a lotti, file non PDF ignorati, PDF sostituito nello storico. - L'import XML elimina i file dei territori che non usa più; comando territori:file-orfani per quelli accumulati prima. Blocco 3 - Password attuale richiesta al cambio volontario; AuthenticateSession chiude le sessioni aperte altrove. - Niente nomi dei proclamatori in chiaro nel registro attività. - Export XML senza remember_token; chi riceve l'hash dal file deve cambiare password. - Campagne: ultimo giorno incluso, percentuale sui territori distinti. - Coda: retry_after 960 s, stop_grace_period 16m, Redis volatile-lru, impostazioni rilette a ogni job. - Azzeramento che cancella anche piantine, area KML e anteprime. - Pulsanti profilo e menu che non si nascondevano; icona del sito. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
2.1 KiB
PHP
72 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use Livewire\Component;
|
|
use Livewire\WithPagination;
|
|
use Spatie\Activitylog\Models\Activity;
|
|
|
|
class AuditLog extends Component
|
|
{
|
|
use WithPagination;
|
|
|
|
public string $search = '';
|
|
public string $filterEvent = '';
|
|
public string $filterCauser = '';
|
|
|
|
protected $queryString = [
|
|
'search' => ['except' => ''],
|
|
'filterEvent' => ['except' => ''],
|
|
'filterCauser' => ['except' => ''],
|
|
];
|
|
|
|
public function updatingSearch()
|
|
{
|
|
$this->resetPage();
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
$query = Activity::with('causer')->latest();
|
|
|
|
if ($this->search) {
|
|
$query->where(function ($q) {
|
|
$q->where('description', 'like', "%{$this->search}%")
|
|
->orWhere('subject_type', 'like', "%{$this->search}%")
|
|
->orWhere('properties', 'like', "%{$this->search}%");
|
|
});
|
|
}
|
|
|
|
if ($this->filterEvent) {
|
|
$query->where('description', $this->filterEvent);
|
|
}
|
|
|
|
if ($this->filterCauser) {
|
|
$query->where('causer_id', $this->filterCauser);
|
|
}
|
|
|
|
$events = Activity::select('description')->distinct()->pluck('description');
|
|
$users = \App\Models\User::orderBy('name')->get();
|
|
|
|
$activities = $query->paginate(30);
|
|
|
|
// Il log conserva solo l'id del proclamatore: il nome si legge adesso,
|
|
// così chi è stato anonimizzato compare come tale anche nello storico.
|
|
$idProclamatori = $activities->getCollection()
|
|
->map(fn ($a) => data_get($a->properties, 'proclamatore_id'))
|
|
->filter()
|
|
->unique();
|
|
$nomiProclamatori = \App\Models\Proclamatore::withTrashed()
|
|
->whereIn('id', $idProclamatori)
|
|
->get()
|
|
->mapWithKeys(fn ($p) => [$p->id => $p->nome_completo]);
|
|
|
|
return view('livewire.audit-log', [
|
|
'activities' => $activities,
|
|
'nomiProclamatori' => $nomiProclamatori,
|
|
'events' => $events,
|
|
'users' => $users,
|
|
]);
|
|
}
|
|
}
|