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,10 +32,6 @@ class BodyshopJobResource extends Resource
return __('nav.group.Tinichigerie');
}
protected static ?string $modelLabel = 'lucrare caroserie';
protected static ?string $pluralModelLabel = 'lucrări caroserie';
protected static ?int $navigationSort = 80;
public static function getNavigationBadge(): ?string
@@ -48,50 +44,50 @@ class BodyshopJobResource extends Resource
public static function form(Schema $schema): Schema
{
return $schema->components([
Schemas\Components\Section::make('Lucrare')
Schemas\Components\Section::make(__('Lucrare'))
->columns(3)
->schema([
Forms\Components\TextInput::make('number')->label('Nr.')->disabled()->dehydrated(false)->placeholder('Generat automat'),
Forms\Components\Select::make('type')->label('Tip')->options(BodyshopJob::TYPES)->default('body_repair')->required(),
Forms\Components\Select::make('status')->label('Status')->options(BodyshopJob::STATUSES)->default('estimate')->required(),
Forms\Components\TextInput::make('number')->label(__('Nr.'))->disabled()->dehydrated(false)->placeholder(__('Generat automat')),
Forms\Components\Select::make('type')->label(__('Tip'))->options(BodyshopJob::TYPES)->default('body_repair')->required(),
Forms\Components\Select::make('status')->label(__('Status'))->options(BodyshopJob::STATUSES)->default('estimate')->required(),
Forms\Components\Select::make('client_id')
->label('Client')
->label(__('Client'))
->options(fn () => Client::pluck('name', 'id'))
->searchable()->live(),
Forms\Components\Select::make('vehicle_id')
->label('Auto')
->label(__('Auto'))
->options(fn (Get $get) => $get('client_id')
? Vehicle::where('client_id', $get('client_id'))->get()
->mapWithKeys(fn ($v) => [$v->id => "{$v->make} {$v->model} {$v->plate}"])->toArray()
: [])
->searchable(),
Forms\Components\TextInput::make('estimate_amount')->label('Deviz')->numeric()->default(0),
Forms\Components\TextInput::make('approved_amount')->label('Aprobat')->numeric()->default(0),
Forms\Components\TextInput::make('estimate_amount')->label(__('Deviz'))->numeric()->default(0),
Forms\Components\TextInput::make('approved_amount')->label(__('Aprobat'))->numeric()->default(0),
]),
Schemas\Components\Section::make('Asigurare')
Schemas\Components\Section::make(__('Asigurare'))
->collapsible()
->columns(3)
->schema([
Forms\Components\Toggle::make('is_insurance')->label('Caz de asigurare')->live()->columnSpanFull(),
Forms\Components\TextInput::make('insurer')->label('Asigurător')
Forms\Components\Toggle::make('is_insurance')->label(__('Caz de asigurare'))->live()->columnSpanFull(),
Forms\Components\TextInput::make('insurer')->label(__('Asigurător'))
->visible(fn (Get $get) => $get('is_insurance')),
Forms\Components\TextInput::make('policy_no')->label('Nr. poliță')
Forms\Components\TextInput::make('policy_no')->label(__('Nr. poliță'))
->visible(fn (Get $get) => $get('is_insurance')),
Forms\Components\TextInput::make('claim_no')->label('Nr. dosar daună')
Forms\Components\TextInput::make('claim_no')->label(__('Nr. dosar daună'))
->visible(fn (Get $get) => $get('is_insurance')),
Forms\Components\Select::make('insurance_status')->label('Status dosar')
Forms\Components\Select::make('insurance_status')->label(__('Status dosar'))
->options(BodyshopJob::INSURANCE_STATUSES)
->visible(fn (Get $get) => $get('is_insurance')),
]),
Schemas\Components\Section::make('Foto înainte / după')
Schemas\Components\Section::make(__('Foto înainte / după'))
->columns(2)
->schema([
\Filament\Forms\Components\SpatieMediaLibraryFileUpload::make('photos_before')
->label('Înainte')->collection('photos_before')->multiple()->image()->reorderable()->maxFiles(20),
->label(__('Înainte'))->collection('photos_before')->multiple()->image()->reorderable()->maxFiles(20),
\Filament\Forms\Components\SpatieMediaLibraryFileUpload::make('photos_after')
->label('După')->collection('photos_after')->multiple()->image()->reorderable()->maxFiles(20),
->label(__('După'))->collection('photos_after')->multiple()->image()->reorderable()->maxFiles(20),
]),
Forms\Components\Textarea::make('notes')->label('Observații')->columnSpanFull()->rows(2),
Forms\Components\Textarea::make('notes')->label(__('Observații'))->columnSpanFull()->rows(2),
]);
}
@@ -99,15 +95,15 @@ class BodyshopJobResource extends Resource
{
return $table
->columns([
Tables\Columns\TextColumn::make('number')->label('Nr.')->searchable()->sortable(),
Tables\Columns\TextColumn::make('client.name')->label('Client')->searchable()->placeholder('—'),
Tables\Columns\TextColumn::make('vehicle.plate')->label('Auto')->placeholder('—'),
Tables\Columns\TextColumn::make('number')->label(__('Nr.'))->searchable()->sortable(),
Tables\Columns\TextColumn::make('client.name')->label(__('Client'))->searchable()->placeholder('—'),
Tables\Columns\TextColumn::make('vehicle.plate')->label(__('Auto'))->placeholder('—'),
Tables\Columns\TextColumn::make('type')
->formatStateUsing(fn ($s) => BodyshopJob::TYPES[$s] ?? $s)
->badge()->color('info'),
Tables\Columns\IconColumn::make('is_insurance')->label('Asig.')->boolean()->toggleable(),
Tables\Columns\TextColumn::make('damage_points_count')->counts('damagePoints')->label('Daune')->alignRight(),
Tables\Columns\TextColumn::make('approved_amount')->label('Aprobat')->money('MDL')->alignRight(),
Tables\Columns\IconColumn::make('is_insurance')->label(__('Asig.'))->boolean()->toggleable(),
Tables\Columns\TextColumn::make('damage_points_count')->counts('damagePoints')->label(__('Daune'))->alignRight(),
Tables\Columns\TextColumn::make('approved_amount')->label(__('Aprobat'))->money('MDL')->alignRight(),
Tables\Columns\TextColumn::make('status')
->formatStateUsing(fn ($s) => BodyshopJob::STATUSES[$s] ?? $s)
->badge()
@@ -121,14 +117,14 @@ class BodyshopJobResource extends Resource
->filters([
Tables\Filters\SelectFilter::make('type')->options(BodyshopJob::TYPES),
Tables\Filters\SelectFilter::make('status')->options(BodyshopJob::STATUSES),
Tables\Filters\TernaryFilter::make('is_insurance')->label('Caz asigurare'),
Tables\Filters\TernaryFilter::make('is_insurance')->label(__('Caz asigurare')),
])
->actions([
Actions\EditAction::make(),
Actions\DeleteAction::make(),
])
->emptyStateHeading('Nicio lucrare de caroserie')
->emptyStateDescription('Înregistrează lucrări de tinichigerie, vopsitorie, PDR, detailing, ceramică, PPF sau polish. Hartă daune, dosar asigurare și arhivă foto înainte/după.')
->emptyStateHeading(__('Nicio lucrare de caroserie'))
->emptyStateDescription(__('Înregistrează lucrări de tinichigerie, vopsitorie, PDR, detailing, ceramică, PPF sau polish. Hartă daune, dosar asigurare și arhivă foto înainte/după.'))
->emptyStateIcon('heroicon-o-paint-brush')
->defaultSort('created_at', 'desc');
}