Fix assemblee hub fallback and mobile sidebar CSS
This commit is contained in:
parent
38cf73a9ab
commit
df441bcc43
|
|
@ -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
|
||||||
|
|
@ -37,7 +38,7 @@ public static function canAccess(): bool
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
return $user instanceof User
|
return $user instanceof User
|
||||||
&& $user->hasAnyRole(['super-admin', 'admin', 'amministratore', 'collaboratore']);
|
&& $user->hasAnyRole(['super-admin', 'admin', 'amministratore', 'collaboratore']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mount(): void
|
public function mount(): void
|
||||||
|
|
@ -68,42 +69,59 @@ 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];
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = Assemblea::query()->where('stabile_id', $stabileId);
|
try {
|
||||||
|
$query = Assemblea::query()->where('stabile_id', $stabileId);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'totale' => (clone $query)->count(),
|
'totale' => (clone $query)->count(),
|
||||||
'convocate' => (clone $query)->where('stato', 'convocata')->count(),
|
'convocate' => (clone $query)->where('stato', 'convocata')->count(),
|
||||||
'in_calendario'=> (clone $query)
|
'in_calendario' => (clone $query)
|
||||||
->where(function ($builder): void {
|
->where(function ($builder): void {
|
||||||
$today = now();
|
$today = now();
|
||||||
|
|
||||||
$builder->whereDate('data_prima_convocazione', '>=', $today->toDateString())
|
$builder->whereDate('data_prima_convocazione', '>=', $today->toDateString())
|
||||||
->orWhereDate('data_seconda_convocazione', '>=', $today->toDateString());
|
->orWhereDate('data_seconda_convocazione', '>=', $today->toDateString());
|
||||||
})
|
})
|
||||||
->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();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Assemblea::query()
|
try {
|
||||||
->with(['verbale:id,assemblea_id'])
|
return Assemblea::query()
|
||||||
->withCount(['ordineGiorno', 'convocazioni', 'presenze', 'documenti'])
|
->with(['verbale:id,assemblea_id'])
|
||||||
->where('stabile_id', $stabileId)
|
->withCount(['ordineGiorno', 'convocazioni', 'presenze', 'documenti'])
|
||||||
->orderByDesc('data_seconda_convocazione')
|
->where('stabile_id', $stabileId)
|
||||||
->orderByDesc('data_prima_convocazione')
|
->orderByDesc('data_seconda_convocazione')
|
||||||
->orderByDesc('id')
|
->orderByDesc('data_prima_convocazione')
|
||||||
->limit(16)
|
->orderByDesc('id')
|
||||||
->get();
|
->limit(16)
|
||||||
|
->get();
|
||||||
|
} catch (QueryException) {
|
||||||
|
return collect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private function canQueryAssemblee(): bool
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return Schema::hasTable((new Assemblea())->getTable());
|
||||||
|
} catch (QueryException) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,8 @@ public function panel(Panel $panel): Panel
|
||||||
return $user instanceof User && $user->hasRole('fornitore');
|
return $user instanceof User && $user->hasRole('fornitore');
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
->discoverResources(in: app_path('Filament/Resources'), for : 'App\\Filament\\Resources')
|
||||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
->discoverPages(in: app_path('Filament/Pages'), for : 'App\\Filament\\Pages')
|
||||||
->pages([
|
->pages([
|
||||||
Dashboard::class,
|
Dashboard::class,
|
||||||
SupportoDashboard::class,
|
SupportoDashboard::class,
|
||||||
|
|
@ -111,7 +111,7 @@ public function panel(Panel $panel): Panel
|
||||||
PrimaNotaModifica::class,
|
PrimaNotaModifica::class,
|
||||||
ContoMastrino::class,
|
ContoMastrino::class,
|
||||||
])
|
])
|
||||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
->discoverWidgets(in: app_path('Filament/Widgets'), for : 'App\\Filament\\Widgets')
|
||||||
->widgets([
|
->widgets([
|
||||||
AccountWidget::class,
|
AccountWidget::class,
|
||||||
TicketMobileOverview::class,
|
TicketMobileOverview::class,
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user