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:
+18
-13
@@ -15,27 +15,32 @@ class SubcontractJobsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'subcontractJobs';
|
||||
|
||||
protected static ?string $title = 'Lucrări la terți';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
|
||||
{
|
||||
return __('Lucrări la terți');
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Forms\Components\Select::make('subcontractor_id')
|
||||
->label('Subcontractor')
|
||||
->label(__('Subcontractor'))
|
||||
->options(fn () => Subcontractor::where('is_active', true)->pluck('name', 'id'))
|
||||
->searchable()
|
||||
->columnSpanFull(),
|
||||
Forms\Components\Select::make('category')
|
||||
->label('Categorie')
|
||||
->label(__('Categorie'))
|
||||
->options(array_combine(Subcontractor::SPECIALTIES, Subcontractor::SPECIALTIES))
|
||||
->searchable(),
|
||||
Forms\Components\Select::make('status')->options(SubcontractJob::STATUSES)->default('sent')->required(),
|
||||
Forms\Components\Textarea::make('description')->label('Descriere')->rows(2)->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('cost')->label('Cost (terț)')->numeric()->default(0)->required(),
|
||||
Forms\Components\TextInput::make('markup_pct')->label('Markup %')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('client_price')->label('Preț client')->numeric()->default(0)
|
||||
->helperText('Folosit dacă markup = 0.'),
|
||||
Forms\Components\DatePicker::make('eta')->label('ETA'),
|
||||
Forms\Components\Textarea::make('description')->label(__('Descriere'))->rows(2)->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('cost')->label(__('Cost (terț)'))->numeric()->default(0)->required(),
|
||||
Forms\Components\TextInput::make('markup_pct')->label(__('Markup %'))->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('client_price')->label(__('Preț client'))->numeric()->default(0)
|
||||
->helperText(__('Folosit dacă markup = 0.')),
|
||||
Forms\Components\DatePicker::make('eta')->label(__('ETA')),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -44,13 +49,13 @@ class SubcontractJobsRelationManager extends RelationManager
|
||||
return $table
|
||||
->recordTitleAttribute('number')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('number')->label('Nr.'),
|
||||
Tables\Columns\TextColumn::make('subcontractor.name')->label('Terț')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('number')->label(__('Nr.')),
|
||||
Tables\Columns\TextColumn::make('subcontractor.name')->label(__('Terț'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('category')->badge()->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('cost')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('client_price')->label('Preț client')->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()
|
||||
->color(fn ($s) => (float) $s > 0 ? 'success' : ((float) $s < 0 ? 'danger' : 'gray')),
|
||||
|
||||
Reference in New Issue
Block a user