e969bb9c7d
Previous sed pass only matched \$state; missed \$s and other arg-name
variants. This time the regex is arg-name-agnostic and touches 21
files across Filament resources & relation managers.
Also wraps two special cases: UserResource role-labels lookup and
LaborResource pricing_mode ternary ('Fix' | 'Pe oră').
+27 human translations for the enum values that were still identity
fallback: WorkOrderWork.STATUSES (De făcut), Purchase.STATUSES,
OnlineOrder.STATUSES, Call.DIRECTIONS/STATUSES, BodyshopJob.TYPES/
STATUSES, TireSet.SEASONS, MessageTemplate.CHANNELS,
DamagePoint.SEVERITIES, ServiceTemplateItem.KINDS.
All 306 tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
49 lines
1.9 KiB
PHP
49 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Central\Widgets;
|
|
|
|
use App\Filament\Central\Resources\SubscriptionResource;
|
|
use App\Models\Central\Subscription;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use Filament\Widgets\TableWidget as BaseWidget;
|
|
|
|
class PendingPayments extends BaseWidget
|
|
{
|
|
protected static ?int $sort = 4;
|
|
|
|
protected int|string|array $columnSpan = 'full';
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->heading(__('Facturi pending / overdue'))
|
|
->query(
|
|
Subscription::query()
|
|
->whereIn('status', ['pending', 'overdue'])
|
|
->with(['company', 'plan'])
|
|
->latest('due_at')
|
|
->limit(10)
|
|
)
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('invoice_number')
|
|
->label(__('Factură'))
|
|
->copyable()
|
|
->url(fn ($record) => SubscriptionResource::getUrl('edit', ['record' => $record])),
|
|
Tables\Columns\TextColumn::make('company.name')->label(__('Companie')),
|
|
Tables\Columns\TextColumn::make('plan.name')->placeholder('—'),
|
|
Tables\Columns\TextColumn::make('amount')->money(fn ($record) => $record->currency)->weight('bold'),
|
|
Tables\Columns\TextColumn::make('status')
|
|
->badge()
|
|
->color(fn ($s) => $s === 'overdue' ? 'danger' : 'warning')
|
|
->formatStateUsing(fn ($s) => __(Subscription::STATUSES[$s] ?? $s)),
|
|
Tables\Columns\TextColumn::make('due_at')
|
|
->label(__('Scadent'))
|
|
->dateTime()
|
|
->color(fn ($record) => $record->due_at && $record->due_at->isPast() ? 'danger' : null),
|
|
])
|
|
->emptyStateHeading(__('🎉 Toate facturile sunt plătite'))
|
|
->paginated(false);
|
|
}
|
|
}
|