Files
autocrm/app/Filament/Central/Widgets/PendingPayments.php
T
Vasyka f7fc69077b feat(i18n): wrap 1103 hardcoded UI strings across Filament with __()
- Convert static $modelLabel/$pluralModelLabel/$title to getter methods
- Wrap ->label()/->placeholder()/->helperText()/->description()/->title()/->body() args
- Wrap Section::make()/Fieldset::make()/Notification::make()->title() args
- Fix RelationManagers::getTitle() signature to match parent (Model, string)
- Fix Pages::getTitle() to instance method (BasePage::getTitle is non-static)
- Extend lang/ru.json + lang/en.json with 700+ common terms; identity fallback for the rest
- Remove duplicate getters in 5 resources that had manual getModelLabel already

All 306 tests pass. Missing translations fall back to the RO key so the UI never breaks.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-15 05:04:24 +00:00

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);
}
}