Fix assemblee hub fallback and mobile sidebar CSS

This commit is contained in:
michele 2026-04-28 21:56:47 +00:00
parent 38cf73a9ab
commit df441bcc43
4 changed files with 49 additions and 45 deletions

View File

@ -1,5 +1,4 @@
<?php <?php
namespace App\Filament\Pages\Condomini; namespace App\Filament\Pages\Condomini;
use App\Filament\Pages\Strumenti\DocumentiArchivio; use App\Filament\Pages\Strumenti\DocumentiArchivio;
@ -12,6 +11,8 @@
use Filament\Pages\Page; use Filament\Pages\Page;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\QueryException;
use UnitEnum; use UnitEnum;
class AssembleeHub extends Page class AssembleeHub extends Page
@ -68,10 +69,11 @@ protected function getHeaderActions(): array
public function getStatsProperty(): array public function getStatsProperty(): array
{ {
$stabileId = (int) ($this->stabileAttivo?->id ?? 0); $stabileId = (int) ($this->stabileAttivo?->id ?? 0);
if ($stabileId <= 0) { if ($stabileId <= 0 || ! $this->canQueryAssemblee()) {
return ['totale' => 0, 'convocate' => 0, 'in_calendario' => 0, 'con_verbale' => 0]; return ['totale' => 0, 'convocate' => 0, 'in_calendario' => 0, 'con_verbale' => 0];
} }
try {
$query = Assemblea::query()->where('stabile_id', $stabileId); $query = Assemblea::query()->where('stabile_id', $stabileId);
return [ return [
@ -87,15 +89,19 @@ public function getStatsProperty(): array
->count(), ->count(),
'con_verbale' => (clone $query)->whereHas('verbale')->count(), 'con_verbale' => (clone $query)->whereHas('verbale')->count(),
]; ];
} catch (QueryException) {
return ['totale' => 0, 'convocate' => 0, 'in_calendario' => 0, 'con_verbale' => 0];
}
} }
public function getAssembleeRowsProperty(): Collection public function getAssembleeRowsProperty(): Collection
{ {
$stabileId = (int) ($this->stabileAttivo?->id ?? 0); $stabileId = (int) ($this->stabileAttivo?->id ?? 0);
if ($stabileId <= 0) { if ($stabileId <= 0 || ! $this->canQueryAssemblee()) {
return collect(); return collect();
} }
try {
return Assemblea::query() return Assemblea::query()
->with(['verbale:id,assemblea_id']) ->with(['verbale:id,assemblea_id'])
->withCount(['ordineGiorno', 'convocazioni', 'presenze', 'documenti']) ->withCount(['ordineGiorno', 'convocazioni', 'presenze', 'documenti'])
@ -105,5 +111,17 @@ public function getAssembleeRowsProperty(): Collection
->orderByDesc('id') ->orderByDesc('id')
->limit(16) ->limit(16)
->get(); ->get();
} catch (QueryException) {
return collect();
}
}
private function canQueryAssemblee(): bool
{
try {
return Schema::hasTable((new Assemblea())->getTable());
} catch (QueryException) {
return false;
}
} }
} }

View File

@ -5,7 +5,7 @@
"isEntry": true "isEntry": true
}, },
"resources/css/filament/admin/theme.css": { "resources/css/filament/admin/theme.css": {
"file": "assets/theme-CDFysGCE.css", "file": "assets/theme-Cs5qngWh.css",
"src": "resources/css/filament/admin/theme.css", "src": "resources/css/filament/admin/theme.css",
"isEntry": true "isEntry": true
}, },

View File

@ -23,20 +23,6 @@ .fi-main-ctn>main {
overflow: visible !important; overflow: visible !important;
} }
.fi-sidebar {
position: static !important;
top: auto !important;
align-self: stretch !important;
height: auto !important;
overflow: visible !important;
}
.fi-sidebar-header {
position: static !important;
top: auto !important;
z-index: 20 !important;
}
.fi-main { .fi-main {
flex: 1 1 auto; flex: 1 1 auto;
min-height: 0; min-height: 0;