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:
@@ -32,10 +32,6 @@ class TireSetResource extends Resource
|
||||
return __('nav.group.Anvelope');
|
||||
}
|
||||
|
||||
protected static ?string $modelLabel = 'set anvelope';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'seturi anvelope';
|
||||
|
||||
protected static ?int $navigationSort = 60;
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
@@ -52,53 +48,53 @@ class TireSetResource extends Resource
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Schemas\Components\Section::make('Proprietar')
|
||||
Schemas\Components\Section::make(__('Proprietar'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Select::make('client_id')
|
||||
->label('Client')
|
||||
->label(__('Client'))
|
||||
->options(fn () => Client::pluck('name', 'id'))
|
||||
->searchable()
|
||||
->live()
|
||||
->required(),
|
||||
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('label')->label('Etichetă')->placeholder('ex: Iarnă Michelin'),
|
||||
Forms\Components\Select::make('season')->label('Sezon')->options(TireSet::SEASONS)->default('winter')->required(),
|
||||
Forms\Components\TextInput::make('label')->label(__('Etichetă'))->placeholder(__('ex: Iarnă Michelin')),
|
||||
Forms\Components\Select::make('season')->label(__('Sezon'))->options(TireSet::SEASONS)->default('winter')->required(),
|
||||
]),
|
||||
Schemas\Components\Section::make('Specificații')
|
||||
Schemas\Components\Section::make(__('Specificații'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('width')->label('Lățime')->numeric()->placeholder('205'),
|
||||
Forms\Components\TextInput::make('profile')->label('Profil')->numeric()->placeholder('55'),
|
||||
Forms\Components\TextInput::make('diameter')->label('Diametru R')->numeric()->placeholder('16'),
|
||||
Forms\Components\TextInput::make('width')->label(__('Lățime'))->numeric()->placeholder('205'),
|
||||
Forms\Components\TextInput::make('profile')->label(__('Profil'))->numeric()->placeholder('55'),
|
||||
Forms\Components\TextInput::make('diameter')->label(__('Diametru R'))->numeric()->placeholder('16'),
|
||||
Forms\Components\TextInput::make('brand')->maxLength(64),
|
||||
Forms\Components\TextInput::make('model')->maxLength(64),
|
||||
Forms\Components\TextInput::make('dot_year')->label('DOT')->maxLength(8)->placeholder('3621'),
|
||||
Forms\Components\Toggle::make('has_rims')->label('Cu jante'),
|
||||
Forms\Components\Select::make('rim_type')->label('Tip jante')->options(['steel' => 'Tablă', 'alloy' => 'Aliaj']),
|
||||
Forms\Components\Select::make('condition')->label('Stare')->options(TireSet::CONDITIONS),
|
||||
Forms\Components\TextInput::make('dot_year')->label(__('DOT'))->maxLength(8)->placeholder('3621'),
|
||||
Forms\Components\Toggle::make('has_rims')->label(__('Cu jante')),
|
||||
Forms\Components\Select::make('rim_type')->label(__('Tip jante'))->options(['steel' => 'Tablă', 'alloy' => 'Aliaj']),
|
||||
Forms\Components\Select::make('condition')->label(__('Stare'))->options(TireSet::CONDITIONS),
|
||||
]),
|
||||
Schemas\Components\Section::make('Uzură (mm) per poziție')
|
||||
Schemas\Components\Section::make(__('Uzură (mm) per poziție'))
|
||||
->columns(4)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('tread.fl')->label('Față-Stânga')->numeric(),
|
||||
Forms\Components\TextInput::make('tread.fr')->label('Față-Dreapta')->numeric(),
|
||||
Forms\Components\TextInput::make('tread.rl')->label('Spate-Stânga')->numeric(),
|
||||
Forms\Components\TextInput::make('tread.rr')->label('Spate-Dreapta')->numeric(),
|
||||
Forms\Components\TextInput::make('tread.fl')->label(__('Față-Stânga'))->numeric(),
|
||||
Forms\Components\TextInput::make('tread.fr')->label(__('Față-Dreapta'))->numeric(),
|
||||
Forms\Components\TextInput::make('tread.rl')->label(__('Spate-Stânga'))->numeric(),
|
||||
Forms\Components\TextInput::make('tread.rr')->label(__('Spate-Dreapta'))->numeric(),
|
||||
]),
|
||||
Schemas\Components\Section::make('TPMS & foto')
|
||||
Schemas\Components\Section::make(__('TPMS & foto'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Toggle::make('tpms')->label('Senzori TPMS'),
|
||||
Forms\Components\TextInput::make('notes')->label('Observații'),
|
||||
Forms\Components\Toggle::make('tpms')->label(__('Senzori TPMS')),
|
||||
Forms\Components\TextInput::make('notes')->label(__('Observații')),
|
||||
\Filament\Forms\Components\SpatieMediaLibraryFileUpload::make('photos')
|
||||
->label('Fotografii')
|
||||
->label(__('Fotografii'))
|
||||
->collection('photos')
|
||||
->multiple()
|
||||
->image()
|
||||
@@ -112,23 +108,23 @@ class TireSetResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('client.name')->label('Client')->searchable()->sortable(),
|
||||
Tables\Columns\TextColumn::make('label')->label('Etichetă')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('client.name')->label(__('Client'))->searchable()->sortable(),
|
||||
Tables\Columns\TextColumn::make('label')->label(__('Etichetă'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('size')
|
||||
->label('Dimensiune')
|
||||
->label(__('Dimensiune'))
|
||||
->state(fn (TireSet $r) => $r->sizeLabel()),
|
||||
Tables\Columns\TextColumn::make('season')
|
||||
->label('Sezon')
|
||||
->label(__('Sezon'))
|
||||
->formatStateUsing(fn ($s) => TireSet::SEASONS[$s] ?? $s)
|
||||
->badge()
|
||||
->colors(['warning' => ['summer'], 'info' => ['winter'], 'gray' => ['allseason']]),
|
||||
Tables\Columns\TextColumn::make('tread_min')->label('Uzură min')
|
||||
Tables\Columns\TextColumn::make('tread_min')->label(__('Uzură min'))
|
||||
->formatStateUsing(fn ($s) => $s ? $s . ' mm' : '—')
|
||||
->color(fn ($s) => $s !== null && (float) $s < 3 ? 'danger' : null)
|
||||
->alignRight(),
|
||||
Tables\Columns\IconColumn::make('tpms')->label('TPMS')->boolean()->toggleable(),
|
||||
Tables\Columns\IconColumn::make('tpms')->label(__('TPMS'))->boolean()->toggleable(),
|
||||
Tables\Columns\TextColumn::make('storage_status')
|
||||
->label('Depozit')
|
||||
->label(__('Depozit'))
|
||||
->state(fn (TireSet $r) => $r->isStored() ? ($r->currentStorage()?->location ?? 'da') : '—')
|
||||
->badge()
|
||||
->color(fn ($state) => $state === '—' ? 'gray' : 'success'),
|
||||
@@ -136,19 +132,19 @@ class TireSetResource extends Resource
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('season')->options(TireSet::SEASONS),
|
||||
Tables\Filters\Filter::make('stored')
|
||||
->label('În depozit')
|
||||
->label(__('În depozit'))
|
||||
->query(fn ($q) => $q->whereHas('storage', fn ($s) => $s->where('status', 'stored'))),
|
||||
])
|
||||
->actions([
|
||||
Actions\Action::make('check_in')
|
||||
->label('Check-in depozit')
|
||||
->label(__('Check-in depozit'))
|
||||
->icon('heroicon-m-arrow-down-on-square')
|
||||
->color('success')
|
||||
->visible(fn (TireSet $r) => ! $r->isStored())
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('location')->label('Locație (raft)')->required()->placeholder('A1-03'),
|
||||
Forms\Components\TextInput::make('season_label')->label('Perioadă')->placeholder('Iarnă 2025-2026'),
|
||||
Forms\Components\TextInput::make('fee')->label('Taxă depozitare')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('location')->label(__('Locație (raft)'))->required()->placeholder(__('A1-03')),
|
||||
Forms\Components\TextInput::make('season_label')->label(__('Perioadă'))->placeholder(__('Iarnă 2025-2026')),
|
||||
Forms\Components\TextInput::make('fee')->label(__('Taxă depozitare'))->numeric()->default(0),
|
||||
])
|
||||
->action(function (TireSet $r, array $data) {
|
||||
\App\Models\Tenant\TireStorage::create([
|
||||
@@ -159,27 +155,27 @@ class TireSetResource extends Resource
|
||||
'status' => 'stored',
|
||||
'checked_in_at' => now(),
|
||||
]);
|
||||
\Filament\Notifications\Notification::make()->title('Set primit în depozit')->success()->send();
|
||||
\Filament\Notifications\Notification::make()->title(__('Set primit în depozit'))->success()->send();
|
||||
}),
|
||||
Actions\Action::make('check_out')
|
||||
->label('Eliberează')
|
||||
->label(__('Eliberează'))
|
||||
->icon('heroicon-m-arrow-up-on-square')
|
||||
->color('warning')
|
||||
->visible(fn (TireSet $r) => $r->isStored())
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Marchează setul ca ridicat de client.')
|
||||
->modalDescription(__('Marchează setul ca ridicat de client.'))
|
||||
->action(function (TireSet $r) {
|
||||
$storage = $r->currentStorage();
|
||||
if ($storage) {
|
||||
$storage->update(['status' => 'retrieved', 'checked_out_at' => now()]);
|
||||
}
|
||||
\Filament\Notifications\Notification::make()->title('Set eliberat din depozit')->success()->send();
|
||||
\Filament\Notifications\Notification::make()->title(__('Set eliberat din depozit'))->success()->send();
|
||||
}),
|
||||
Actions\EditAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
])
|
||||
->emptyStateHeading('Niciun set de anvelope')
|
||||
->emptyStateDescription('Înregistrează seturile de anvelope ale clienților și gestionează depozitarea sezonieră (tire hotel). Urmărește uzura, TPMS și locația în depozit.')
|
||||
->emptyStateHeading(__('Niciun set de anvelope'))
|
||||
->emptyStateDescription(__('Înregistrează seturile de anvelope ale clienților și gestionează depozitarea sezonieră (tire hotel). Urmărește uzura, TPMS și locația în depozit.'))
|
||||
->emptyStateIcon('heroicon-o-lifebuoy')
|
||||
->defaultSort('created_at', 'desc');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user