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:
+15
-10
@@ -18,19 +18,24 @@ class ItemsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'items';
|
||||
|
||||
protected static ?string $title = 'Conținut șablon';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
|
||||
{
|
||||
return __('Conținut șablon');
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Forms\Components\Select::make('kind')
|
||||
->label('Tip')
|
||||
->label(__('Tip'))
|
||||
->options(ServiceTemplateItem::KINDS)
|
||||
->default('labor')
|
||||
->live()
|
||||
->required(),
|
||||
Forms\Components\Select::make('labor_id')
|
||||
->label('Manoperă')
|
||||
->label(__('Manoperă'))
|
||||
->options(fn () => Labor::where('is_active', true)->pluck('name_ro', 'id'))
|
||||
->searchable()
|
||||
->visible(fn (Get $get) => $get('kind') === 'labor')
|
||||
@@ -42,7 +47,7 @@ class ItemsRelationManager extends RelationManager
|
||||
}
|
||||
}),
|
||||
Forms\Components\Select::make('part_id')
|
||||
->label('Piesă')
|
||||
->label(__('Piesă'))
|
||||
->options(fn () => Part::where('is_active', true)
|
||||
->get()->mapWithKeys(fn ($p) => [$p->id => "{$p->name} " . ($p->article ? "[{$p->article}]" : '')])->toArray())
|
||||
->searchable()
|
||||
@@ -51,10 +56,10 @@ class ItemsRelationManager extends RelationManager
|
||||
->afterStateUpdated(function ($state, Set $set) {
|
||||
if ($state && $p = Part::find($state)) $set('name', $p->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('name')->label('Denumire')->required()->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('hours')->label('Ore')->numeric()
|
||||
Forms\Components\TextInput::make('name')->label(__('Denumire'))->required()->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('hours')->label(__('Ore'))->numeric()
|
||||
->visible(fn (Get $get) => $get('kind') === 'labor'),
|
||||
Forms\Components\TextInput::make('qty')->label('Cantitate')->numeric()->default(1)
|
||||
Forms\Components\TextInput::make('qty')->label(__('Cantitate'))->numeric()->default(1)
|
||||
->visible(fn (Get $get) => $get('kind') === 'part'),
|
||||
]);
|
||||
}
|
||||
@@ -65,13 +70,13 @@ class ItemsRelationManager extends RelationManager
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('kind')
|
||||
->label('Tip')
|
||||
->label(__('Tip'))
|
||||
->formatStateUsing(fn ($s) => ServiceTemplateItem::KINDS[$s] ?? $s)
|
||||
->badge()
|
||||
->color(fn ($s) => $s === 'labor' ? 'info' : 'gray'),
|
||||
Tables\Columns\TextColumn::make('name')->wrap(),
|
||||
Tables\Columns\TextColumn::make('hours')->label('Ore')->placeholder('—')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('qty')->label('Cant.')->placeholder('—')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('hours')->label(__('Ore'))->placeholder('—')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('qty')->label(__('Cant.'))->placeholder('—')->alignRight(),
|
||||
])
|
||||
->headerActions([Actions\CreateAction::make()])
|
||||
->actions([Actions\EditAction::make(), Actions\DeleteAction::make()]);
|
||||
|
||||
Reference in New Issue
Block a user