i18n: fix widget heading, translate Select options from model consts, +40 keys

- LowStockTable: rename getHeading → getTableHeading (correct Filament API)
- Global I18n::opts() helper wraps Model::CONST values in __() so
  Select dropdowns show translated status/type/season/etc. labels
- Sed-transform ->options(X::CONST), ->options(array_combine(X::A,X::A)),
  and formatStateUsing(fn($s)=>X::CONST[$s]??$s) → wrap with __()
  (58 options + 10 combines + 7 formatStateUsing across 28 files)
- CalendarBoard: all 7 day names now via __() (was missing 4)
- calendar-board.blade: fix untranslated 'săptămâna curentă', 'capacitate',
  'rata confirmare', 'mediu', 'plin', 'Pod / Zi' / 'Mecanic / Zi'
- +40 RU/EN translations (Client & Auto, Maistru / Mecanic, Programat,
  Sosit, Finalizat, Anulat, Neprezentat, days of week, calendar KPIs)

All 306 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-16 06:42:16 +00:00
parent 272080b274
commit 95aeecb932
33 changed files with 159 additions and 123 deletions
@@ -73,11 +73,11 @@ class DealResource extends Resource
Forms\Components\TextInput::make('name')->label(__('Subiect'))->required()->maxLength(160),
Forms\Components\TextInput::make('price')->label(__('Valoare'))->numeric()->default(0),
Forms\Components\Select::make('stage')
->options(Deal::STAGES)
->options(\App\Support\I18n::opts(Deal::STAGES))
->default('new')
->required(),
Forms\Components\Select::make('source')
->options(Lead::SOURCES)
->options(\App\Support\I18n::opts(Lead::SOURCES))
->searchable(),
Forms\Components\Select::make('assigned_to')
->label(__('Responsabil'))
@@ -97,7 +97,7 @@ class DealResource extends Resource
Tables\Columns\TextColumn::make('client.name')->label(__('Client'))->searchable(),
Tables\Columns\TextColumn::make('vehicle.plate')->label(__('Auto'))->placeholder('—'),
Tables\Columns\TextColumn::make('stage')
->formatStateUsing(fn ($state) => Deal::STAGES[$state] ?? $state)
->formatStateUsing(fn ($state) => __(Deal::STAGES[$state] ?? $state))
->badge()
->colors([
'gray' => ['new'],
@@ -107,12 +107,12 @@ class DealResource extends Resource
'danger' => ['lost'],
]),
Tables\Columns\TextColumn::make('price')->money('MDL')->sortable(),
Tables\Columns\TextColumn::make('source')->label(__('Sursă'))->formatStateUsing(fn ($state) => Lead::SOURCES[$state] ?? $state)->placeholder('—'),
Tables\Columns\TextColumn::make('source')->label(__('Sursă'))->formatStateUsing(fn ($state) => __(Lead::SOURCES[$state] ?? $state))->placeholder('—'),
Tables\Columns\TextColumn::make('assignedTo.name')->label(__('Responsabil'))->placeholder('—'),
Tables\Columns\TextColumn::make('created_at')->date()->sortable(),
])
->filters([
Tables\Filters\SelectFilter::make('stage')->options(Deal::STAGES),
Tables\Filters\SelectFilter::make('stage')->options(\App\Support\I18n::opts(Deal::STAGES)),
Tables\Filters\SelectFilter::make('assigned_to')
->label(__('Responsabil'))
->options(fn () => User::pluck('name', 'id')),