fix: Filament v5 callbacks $r → $record (Plans/Subs/SuperAdmins/Companies)
+ central PWA: real PNG icons, SW registration, scope=/
- All `fn ($r) =>` and `fn (Type $r) =>` replaced with $record (Filament v5
injects callback params by name; $r resolved to nothing)
- /pwa/admin-{192,512}.png — generated on-the-fly with GD + DejaVuSans-Bold
- /pwa/admin-icon.svg — vector favicon
- /admin-sw.js — service worker (cache shell, network-first elsewhere)
with Service-Worker-Allowed: / header
- Manifest scope=/ + start_url=/admin → install prompt fires on Chrome/Edge/Safari
- BODY_END render hook registers SW on central panel
This commit is contained in:
@@ -110,7 +110,7 @@ class CompanyResource extends Resource
|
||||
Tables\Columns\TextColumn::make('slug')
|
||||
->searchable()
|
||||
->copyable()
|
||||
->url(fn (Company $r) => $r->url('/app'))
|
||||
->url(fn (Company $record) => $record->url('/app'))
|
||||
->openUrlInNewTab(),
|
||||
Tables\Columns\TextColumn::make('name')->searchable()->sortable(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
@@ -132,30 +132,30 @@ class CompanyResource extends Resource
|
||||
'suspended' => 'Suspendat', 'archived' => 'Arhivat',
|
||||
]),
|
||||
])
|
||||
->recordUrl(fn (Company $r) => CompanyResource::getUrl('view', ['record' => $r]))
|
||||
->recordUrl(fn (Company $record) => CompanyResource::getUrl('view', ['record' => $record]))
|
||||
->actions([
|
||||
Actions\ViewAction::make()
|
||||
->url(fn (Company $r) => CompanyResource::getUrl('view', ['record' => $r])),
|
||||
->url(fn (Company $record) => CompanyResource::getUrl('view', ['record' => $record])),
|
||||
Actions\Action::make('open_tenant')
|
||||
->label('Deschide')
|
||||
->icon('heroicon-m-arrow-top-right-on-square')
|
||||
->color('primary')
|
||||
->url(fn (Company $r) => $r->url('/app'))
|
||||
->url(fn (Company $record) => $record->url('/app'))
|
||||
->openUrlInNewTab(),
|
||||
Actions\Action::make('suspend')
|
||||
->label('Suspendă')
|
||||
->icon('heroicon-m-no-symbol')
|
||||
->color('danger')
|
||||
->visible(fn (Company $r) => in_array($r->status, ['active', 'trial']))
|
||||
->visible(fn (Company $record) => in_array($record->status, ['active', 'trial']))
|
||||
->requiresConfirmation()
|
||||
->action(fn (Company $r) => app(\App\Services\CompanyProvisioner::class)->suspend($r)),
|
||||
->action(fn (Company $record) => app(\App\Services\CompanyProvisioner::class)->suspend($record)),
|
||||
Actions\Action::make('activate')
|
||||
->label('Activează')
|
||||
->icon('heroicon-m-check-circle')
|
||||
->color('success')
|
||||
->visible(fn (Company $r) => in_array($r->status, ['suspended', 'expired']))
|
||||
->visible(fn (Company $record) => in_array($record->status, ['suspended', 'expired']))
|
||||
->requiresConfirmation()
|
||||
->action(fn (Company $r) => app(\App\Services\CompanyProvisioner::class)->reactivate($r)),
|
||||
->action(fn (Company $record) => app(\App\Services\CompanyProvisioner::class)->reactivate($record)),
|
||||
Actions\EditAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user