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:
@@ -34,25 +34,30 @@ class AppointmentResource extends Resource
|
||||
|
||||
protected static ?string $modelLabel = 'programare';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'programări';
|
||||
protected static ?string $pluralModelLabel = null;
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('programări');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 7;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Schemas\Components\Section::make('Când & unde')
|
||||
Schemas\Components\Section::make(__('Când & unde'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\DatePicker::make('date')->label('Data')->default(today())->required(),
|
||||
Forms\Components\TimePicker::make('time_start')->label('De la')->required()->seconds(false),
|
||||
Forms\Components\TimePicker::make('time_end')->label('Până la')->required()->seconds(false),
|
||||
Forms\Components\DatePicker::make('date')->label(__('Data'))->default(today())->required(),
|
||||
Forms\Components\TimePicker::make('time_start')->label(__('De la'))->required()->seconds(false),
|
||||
Forms\Components\TimePicker::make('time_end')->label(__('Până la'))->required()->seconds(false),
|
||||
Forms\Components\Select::make('post_id')
|
||||
->label('Pod')
|
||||
->label(__('Pod'))
|
||||
->options(fn () => Post::where('is_active', true)->orderBy('sort_order')->pluck('name', 'id'))
|
||||
->searchable(),
|
||||
Forms\Components\Select::make('master_id')
|
||||
->label('Maistru / Mecanic')
|
||||
->label(__('Maistru / Mecanic'))
|
||||
->options(fn () => User::pluck('name', 'id'))
|
||||
->searchable(),
|
||||
Forms\Components\Select::make('status')
|
||||
@@ -60,23 +65,23 @@ class AppointmentResource extends Resource
|
||||
->default('scheduled')
|
||||
->required(),
|
||||
]),
|
||||
Schemas\Components\Section::make('Client & Auto')
|
||||
Schemas\Components\Section::make(__('Client & Auto'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
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 (Schemas\Components\Utilities\Get $get) => $get('client_id')
|
||||
? Vehicle::where('client_id', $get('client_id'))->pluck('plate', 'id')
|
||||
: [])
|
||||
->searchable(),
|
||||
]),
|
||||
Forms\Components\TextInput::make('title')->label('Subiect')->required()->maxLength(160),
|
||||
Forms\Components\Textarea::make('notes')->label('Notițe')->columnSpanFull()->rows(2),
|
||||
Forms\Components\TextInput::make('title')->label(__('Subiect'))->required()->maxLength(160),
|
||||
Forms\Components\Textarea::make('notes')->label(__('Notițe'))->columnSpanFull()->rows(2),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -84,14 +89,14 @@ class AppointmentResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('date')->label('Data')->date('d.m.Y')->sortable(),
|
||||
Tables\Columns\TextColumn::make('time_start')->label('De la')->time('H:i'),
|
||||
Tables\Columns\TextColumn::make('time_end')->label('Până la')->time('H:i'),
|
||||
Tables\Columns\TextColumn::make('post.name')->label('Pod')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('title')->label('Subiect')->searchable()->limit(40),
|
||||
Tables\Columns\TextColumn::make('client.name')->label('Client')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('vehicle.plate')->label('Auto')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('master.name')->label('Maistru')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('date')->label(__('Data'))->date('d.m.Y')->sortable(),
|
||||
Tables\Columns\TextColumn::make('time_start')->label(__('De la'))->time('H:i'),
|
||||
Tables\Columns\TextColumn::make('time_end')->label(__('Până la'))->time('H:i'),
|
||||
Tables\Columns\TextColumn::make('post.name')->label(__('Pod'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('title')->label(__('Subiect'))->searchable()->limit(40),
|
||||
Tables\Columns\TextColumn::make('client.name')->label(__('Client'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('vehicle.plate')->label(__('Auto'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('master.name')->label(__('Maistru'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->formatStateUsing(fn ($state) => Appointment::STATUSES[$state] ?? $state)
|
||||
->badge()
|
||||
@@ -104,14 +109,14 @@ class AppointmentResource extends Resource
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\Filter::make('today')
|
||||
->label('Astăzi')
|
||||
->label(__('Astăzi'))
|
||||
->query(fn ($q) => $q->whereDate('date', today())),
|
||||
Tables\Filters\Filter::make('upcoming')
|
||||
->label('Viitoare')
|
||||
->label(__('Viitoare'))
|
||||
->query(fn ($q) => $q->where('date', '>=', today())),
|
||||
Tables\Filters\SelectFilter::make('status')->options(Appointment::STATUSES),
|
||||
Tables\Filters\SelectFilter::make('post_id')
|
||||
->label('Pod')
|
||||
->label(__('Pod'))
|
||||
->options(fn () => Post::pluck('name', 'id')),
|
||||
])
|
||||
->actions([
|
||||
|
||||
Reference in New Issue
Block a user