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:
@@ -30,10 +30,6 @@ class SubcontractJobResource extends Resource
|
||||
return __('nav.group.Subcontractare');
|
||||
}
|
||||
|
||||
protected static ?string $modelLabel = 'lucrare terți';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'lucrări terți';
|
||||
|
||||
protected static ?int $navigationSort = 71;
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
@@ -45,43 +41,43 @@ class SubcontractJobResource extends Resource
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Schemas\Components\Section::make('Lucrare')
|
||||
Schemas\Components\Section::make(__('Lucrare'))
|
||||
->columns(2)
|
||||
->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('status')->options(SubcontractJob::STATUSES)->default('sent')->required(),
|
||||
Forms\Components\Select::make('subcontractor_id')
|
||||
->label('Subcontractor')
|
||||
->label(__('Subcontractor'))
|
||||
->options(fn () => Subcontractor::where('is_active', true)->pluck('name', 'id'))
|
||||
->searchable(),
|
||||
Forms\Components\Select::make('work_order_id')
|
||||
->label('Fișă asociată')
|
||||
->label(__('Fișă asociată'))
|
||||
->options(fn () => WorkOrder::whereNotIn('status', ['done', 'cancelled'])
|
||||
->get()->mapWithKeys(fn ($w) => [$w->id => "#{$w->number} · " . ($w->vehicle?->plate ?? '')])->toArray())
|
||||
->searchable(),
|
||||
Forms\Components\Select::make('category')
|
||||
->label('Categorie')
|
||||
->label(__('Categorie'))
|
||||
->options(array_combine(Subcontractor::SPECIALTIES, Subcontractor::SPECIALTIES))
|
||||
->searchable(),
|
||||
Forms\Components\Textarea::make('description')->label('Descriere')->rows(2)->columnSpanFull(),
|
||||
Forms\Components\Textarea::make('description')->label(__('Descriere'))->rows(2)->columnSpanFull(),
|
||||
]),
|
||||
Schemas\Components\Section::make('Cost & marjă')
|
||||
Schemas\Components\Section::make(__('Cost & marjă'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('cost')->label('Cost (de la terț)')->numeric()->default(0)->required(),
|
||||
Forms\Components\TextInput::make('markup_pct')->label('Markup %')->numeric()->default(0)
|
||||
->helperText('> 0 calculează automat prețul client.'),
|
||||
Forms\Components\TextInput::make('client_price')->label('Preț client')->numeric()->default(0)
|
||||
->helperText('Setat manual dacă markup = 0.'),
|
||||
Forms\Components\Toggle::make('paid_to_sub')->label('Plătit către terț'),
|
||||
Forms\Components\TextInput::make('cost')->label(__('Cost (de la terț)'))->numeric()->default(0)->required(),
|
||||
Forms\Components\TextInput::make('markup_pct')->label(__('Markup %'))->numeric()->default(0)
|
||||
->helperText(__('> 0 calculează automat prețul client.')),
|
||||
Forms\Components\TextInput::make('client_price')->label(__('Preț client'))->numeric()->default(0)
|
||||
->helperText(__('Setat manual dacă markup = 0.')),
|
||||
Forms\Components\Toggle::make('paid_to_sub')->label(__('Plătit către terț')),
|
||||
]),
|
||||
Schemas\Components\Section::make('Termene')
|
||||
Schemas\Components\Section::make(__('Termene'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\DatePicker::make('sent_at')->label('Trimis')->default(today()),
|
||||
Forms\Components\DatePicker::make('eta')->label('ETA'),
|
||||
Forms\Components\DatePicker::make('returned_at')->label('Returnat'),
|
||||
Forms\Components\Textarea::make('notes')->label('Observații')->columnSpanFull()->rows(2),
|
||||
Forms\Components\DatePicker::make('sent_at')->label(__('Trimis'))->default(today()),
|
||||
Forms\Components\DatePicker::make('eta')->label(__('ETA')),
|
||||
Forms\Components\DatePicker::make('returned_at')->label(__('Returnat')),
|
||||
Forms\Components\Textarea::make('notes')->label(__('Observații'))->columnSpanFull()->rows(2),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -90,14 +86,14 @@ class SubcontractJobResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('number')->label('Nr.')->searchable()->sortable(),
|
||||
Tables\Columns\TextColumn::make('subcontractor.name')->label('Terț')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('number')->label(__('Nr.'))->searchable()->sortable(),
|
||||
Tables\Columns\TextColumn::make('subcontractor.name')->label(__('Terț'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('category')->badge()->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('workOrder.number')->label('Fișă')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('cost')->label('Cost')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('client_price')->label('Preț client')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('workOrder.number')->label(__('Fișă'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('cost')->label(__('Cost'))->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('client_price')->label(__('Preț client'))->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('margin')
|
||||
->label('Marjă')
|
||||
->label(__('Marjă'))
|
||||
->state(fn (SubcontractJob $r) => $r->margin())
|
||||
->money('MDL')
|
||||
->alignRight()
|
||||
@@ -110,20 +106,20 @@ class SubcontractJobResource extends Resource
|
||||
'success' => ['done', 'returned'],
|
||||
'danger' => ['cancelled'],
|
||||
]),
|
||||
Tables\Columns\IconColumn::make('paid_to_sub')->label('Plătit terț')->boolean()->toggleable(),
|
||||
Tables\Columns\IconColumn::make('paid_to_sub')->label(__('Plătit terț'))->boolean()->toggleable(),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('status')->options(SubcontractJob::STATUSES),
|
||||
Tables\Filters\SelectFilter::make('subcontractor_id')
|
||||
->label('Subcontractor')
|
||||
->label(__('Subcontractor'))
|
||||
->options(fn () => Subcontractor::pluck('name', 'id')),
|
||||
])
|
||||
->actions([
|
||||
Actions\EditAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
])
|
||||
->emptyStateHeading('Nicio lucrare la terți')
|
||||
->emptyStateDescription('Înregistrează lucrările trimise la ateliere externe (turbo, cutii, vopsitorie). Costul terțului + markup intră automat în totalul fișei asociate.')
|
||||
->emptyStateHeading(__('Nicio lucrare la terți'))
|
||||
->emptyStateDescription(__('Înregistrează lucrările trimise la ateliere externe (turbo, cutii, vopsitorie). Costul terțului + markup intră automat în totalul fișei asociate.'))
|
||||
->emptyStateIcon('heroicon-o-arrow-top-right-on-square')
|
||||
->defaultSort('created_at', 'desc');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user