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:
@@ -109,19 +109,19 @@ class SubscriptionResource extends Resource
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('invoice_number')
|
||||
->label('Factură')
|
||||
->placeholder(fn ($r) => '—')
|
||||
->placeholder(fn ($record) => '—')
|
||||
->copyable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('company.name')
|
||||
->label('Companie')
|
||||
->searchable()
|
||||
->url(fn ($r) => \App\Filament\Central\Resources\CompanyResource::getUrl('view', ['record' => $r->company_id])),
|
||||
->url(fn ($record) => \App\Filament\Central\Resources\CompanyResource::getUrl('view', ['record' => $record->company_id])),
|
||||
Tables\Columns\TextColumn::make('plan.name')->label('Plan')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('period')
|
||||
->formatStateUsing(fn ($s) => Subscription::PERIODS[$s] ?? $s)
|
||||
->badge(),
|
||||
Tables\Columns\TextColumn::make('amount')
|
||||
->money(fn ($r) => $r->currency)
|
||||
->money(fn ($record) => $record->currency)
|
||||
->sortable()
|
||||
->weight('bold'),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
@@ -146,16 +146,16 @@ class SubscriptionResource extends Resource
|
||||
->label('Marchează plătit')
|
||||
->icon('heroicon-m-check-circle')
|
||||
->color('success')
|
||||
->visible(fn ($r) => $r->status !== 'paid')
|
||||
->visible(fn ($record) => $record->status !== 'paid')
|
||||
->requiresConfirmation()
|
||||
->action(function (Subscription $r) {
|
||||
$r->update(['status' => 'paid', 'paid_at' => now()]);
|
||||
->action(function (Subscription $record) {
|
||||
$record->update(['status' => 'paid', 'paid_at' => now()]);
|
||||
// Auto-extend company subscription
|
||||
$r->company->update([
|
||||
$record->company->update([
|
||||
'status' => 'active',
|
||||
'active_until' => $r->period_end,
|
||||
'active_until' => $record->period_end,
|
||||
]);
|
||||
Notification::make()->title('Plată confirmată. Abonament extins până la ' . $r->period_end->format('d.m.Y'))->success()->send();
|
||||
Notification::make()->title('Plată confirmată. Abonament extins până la ' . $record->period_end->format('d.m.Y'))->success()->send();
|
||||
}),
|
||||
Actions\EditAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
|
||||
Reference in New Issue
Block a user