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>
This commit is contained in:
2026-07-15 05:04:24 +00:00
parent 78ff8d4b43
commit f7fc69077b
83 changed files with 4212 additions and 1251 deletions
@@ -32,26 +32,36 @@ class PurchaseResource extends Resource
return __('nav.group.Depozit');
}
protected static ?string $modelLabel = 'achiziție';
protected static ?string $modelLabel = null;
protected static ?string $pluralModelLabel = 'achiziții';
public static function getModelLabel(): string
{
return __('achiziție');
}
protected static ?string $pluralModelLabel = null;
public static function getPluralModelLabel(): string
{
return __('achiziții');
}
protected static ?int $navigationSort = 43;
public static function form(Schema $schema): Schema
{
return $schema->components([
Schemas\Components\Section::make('Antet')
Schemas\Components\Section::make(__('Antet'))
->columns(3)
->schema([
Forms\Components\TextInput::make('number')->label('Nr.')->disabled()->dehydrated(false)->placeholder('Generat automat'),
Forms\Components\TextInput::make('number')->label(__('Nr.'))->disabled()->dehydrated(false)->placeholder(__('Generat automat')),
Forms\Components\Select::make('supplier_id')
->label('Furnizor')
->label(__('Furnizor'))
->options(fn () => Supplier::where('is_active', true)->pluck('name', 'id'))
->searchable()
->required(),
Forms\Components\Select::make('warehouse_id')
->label('Depozit țintă')
->label(__('Depozit țintă'))
->options(fn () => Warehouse::where('is_active', true)->pluck('name', 'id'))
->default(fn () => Warehouse::where('is_default', true)->value('id'))
->required(),
@@ -59,12 +69,12 @@ class PurchaseResource extends Resource
->options(Purchase::STATUSES)
->default('draft')
->required(),
Forms\Components\DatePicker::make('order_date')->label('Data comandă')->default(today())->required(),
Forms\Components\DatePicker::make('expected_at')->label('Așteptată'),
Forms\Components\DatePicker::make('received_at')->label('Recepționată'),
Forms\Components\DatePicker::make('paid_at')->label('Plătită')->columnSpanFull(),
Forms\Components\DatePicker::make('order_date')->label(__('Data comandă'))->default(today())->required(),
Forms\Components\DatePicker::make('expected_at')->label(__('Așteptată')),
Forms\Components\DatePicker::make('received_at')->label(__('Recepționată')),
Forms\Components\DatePicker::make('paid_at')->label(__('Plătită'))->columnSpanFull(),
]),
Forms\Components\Textarea::make('notes')->label('Observații')->columnSpanFull()->rows(2),
Forms\Components\Textarea::make('notes')->label(__('Observații'))->columnSpanFull()->rows(2),
]);
}
@@ -72,11 +82,11 @@ class PurchaseResource extends Resource
{
return $table
->columns([
Tables\Columns\TextColumn::make('number')->label('Nr.')->searchable()->sortable(),
Tables\Columns\TextColumn::make('supplier.name')->label('Furnizor')->searchable(),
Tables\Columns\TextColumn::make('order_date')->label('Comandată')->date('d.m.Y'),
Tables\Columns\TextColumn::make('expected_at')->label('Așteptată')->date('d.m.Y')->placeholder('—'),
Tables\Columns\TextColumn::make('received_at')->label('Recepționată')->date('d.m.Y')->placeholder('—'),
Tables\Columns\TextColumn::make('number')->label(__('Nr.'))->searchable()->sortable(),
Tables\Columns\TextColumn::make('supplier.name')->label(__('Furnizor'))->searchable(),
Tables\Columns\TextColumn::make('order_date')->label(__('Comandată'))->date('d.m.Y'),
Tables\Columns\TextColumn::make('expected_at')->label(__('Așteptată'))->date('d.m.Y')->placeholder('—'),
Tables\Columns\TextColumn::make('received_at')->label(__('Recepționată'))->date('d.m.Y')->placeholder('—'),
Tables\Columns\TextColumn::make('status')
->formatStateUsing(fn ($s) => Purchase::STATUSES[$s] ?? $s)
->badge()
@@ -88,7 +98,7 @@ class PurchaseResource extends Resource
'danger' => ['cancelled'],
]),
Tables\Columns\TextColumn::make('received_progress')
->label('Progres')
->label(__('Progres'))
->state(function (Purchase $r) {
$items = $r->items;
$ord = (float) $items->sum('qty');
@@ -101,27 +111,27 @@ class PurchaseResource extends Resource
->filters([
Tables\Filters\SelectFilter::make('status')->options(Purchase::STATUSES),
Tables\Filters\SelectFilter::make('supplier_id')
->label('Furnizor')
->label(__('Furnizor'))
->options(fn () => Supplier::pluck('name', 'id')),
])
->actions([
Actions\Action::make('receive_all')
->label('Recepție totală')
->label(__('Recepție totală'))
->icon('heroicon-m-check-circle')
->color('success')
->visible(fn (Purchase $r) => ! in_array($r->status, ['received', 'cancelled', 'draft'], true))
->requiresConfirmation()
->modalDescription('Se vor crea batch-uri pentru toate restanțele rămase în depozitul țintă.')
->modalDescription(__('Se vor crea batch-uri pentru toate restanțele rămase în depozitul țintă.'))
->action(function (Purchase $r) {
try {
$r->receiveAllRemaining();
Notification::make()
->title('Recepție completă — batch-uri create')
->title(__('Recepție completă — batch-uri create'))
->success()
->send();
} catch (\Throwable $e) {
Notification::make()
->title('Eroare')
->title(__('Eroare'))
->body($e->getMessage())
->danger()
->send();