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
+1 -1
View File
@@ -118,7 +118,7 @@ class CalendarBoard extends Page
public function getDays(): array
{
$today = Carbon::today()->toDateString();
$names = ['Luni', __('Marți'), 'Miercuri', 'Joi', 'Vineri', __('Sâmbătă'), __('Duminică')];
$names = [__('Luni'), __('Marți'), __('Miercuri'), __('Joi'), __('Vineri'), __('Sâmbătă'), __('Duminică')];
$start = Carbon::parse($this->weekStart);
$count = match ($this->viewMode) {
@@ -66,7 +66,7 @@ class AppointmentResource extends Resource
->options(fn () => User::pluck('name', 'id'))
->searchable(),
Forms\Components\Select::make('status')
->options(Appointment::STATUSES)
->options(\App\Support\I18n::opts(Appointment::STATUSES))
->default('scheduled')
->required(),
]),
@@ -103,7 +103,7 @@ class AppointmentResource extends Resource
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)
->formatStateUsing(fn ($state) => __(Appointment::STATUSES[$state] ?? $state))
->badge()
->colors([
'gray' => ['scheduled'],
@@ -119,7 +119,7 @@ class AppointmentResource extends Resource
Tables\Filters\Filter::make('upcoming')
->label(__('Viitoare'))
->query(fn ($q) => $q->where('date', '>=', today())),
Tables\Filters\SelectFilter::make('status')->options(Appointment::STATUSES),
Tables\Filters\SelectFilter::make('status')->options(\App\Support\I18n::opts(Appointment::STATUSES)),
Tables\Filters\SelectFilter::make('post_id')
->label(__('Pod'))
->options(fn () => Post::pluck('name', 'id')),
@@ -48,8 +48,8 @@ class BodyshopJobResource extends Resource
->columns(3)
->schema([
Forms\Components\TextInput::make('number')->label(__('Nr.'))->disabled()->dehydrated(false)->placeholder(__('Generat automat')),
Forms\Components\Select::make('type')->label(__('Tip'))->options(BodyshopJob::TYPES)->default('body_repair')->required(),
Forms\Components\Select::make('status')->label(__('Status'))->options(BodyshopJob::STATUSES)->default('estimate')->required(),
Forms\Components\Select::make('type')->label(__('Tip'))->options(\App\Support\I18n::opts(BodyshopJob::TYPES))->default('body_repair')->required(),
Forms\Components\Select::make('status')->label(__('Status'))->options(\App\Support\I18n::opts(BodyshopJob::STATUSES))->default('estimate')->required(),
Forms\Components\Select::make('client_id')
->label(__('Client'))
->options(fn () => Client::pluck('name', 'id'))
@@ -76,7 +76,7 @@ class BodyshopJobResource extends Resource
Forms\Components\TextInput::make('claim_no')->label(__('Nr. dosar daună'))
->visible(fn (Get $get) => $get('is_insurance')),
Forms\Components\Select::make('insurance_status')->label(__('Status dosar'))
->options(BodyshopJob::INSURANCE_STATUSES)
->options(\App\Support\I18n::opts(BodyshopJob::INSURANCE_STATUSES))
->visible(fn (Get $get) => $get('is_insurance')),
]),
Schemas\Components\Section::make(__('Foto înainte / după'))
@@ -115,8 +115,8 @@ class BodyshopJobResource extends Resource
]),
])
->filters([
Tables\Filters\SelectFilter::make('type')->options(BodyshopJob::TYPES),
Tables\Filters\SelectFilter::make('status')->options(BodyshopJob::STATUSES),
Tables\Filters\SelectFilter::make('type')->options(\App\Support\I18n::opts(BodyshopJob::TYPES)),
Tables\Filters\SelectFilter::make('status')->options(\App\Support\I18n::opts(BodyshopJob::STATUSES)),
Tables\Filters\TernaryFilter::make('is_insurance')->label(__('Caz asigurare')),
])
->actions([
@@ -26,16 +26,16 @@ class DamagePointsRelationManager extends RelationManager
return $schema->components([
Forms\Components\Select::make('zone')
->label(__('Zonă'))
->options(array_combine(DamagePoint::ZONES, DamagePoint::ZONES))
->options(\App\Support\I18n::opts(array_combine(DamagePoint::ZONES, DamagePoint::ZONES)))
->searchable()
->required(),
Forms\Components\Select::make('kind')
->label(__('Tip daună'))
->options(array_combine(DamagePoint::KINDS, DamagePoint::KINDS))
->options(\App\Support\I18n::opts(array_combine(DamagePoint::KINDS, DamagePoint::KINDS)))
->required(),
Forms\Components\Select::make('severity')
->label(__('Gravitate'))
->options(DamagePoint::SEVERITIES)
->options(\App\Support\I18n::opts(DamagePoint::SEVERITIES))
->default('minor')
->required(),
Forms\Components\Textarea::make('notes')->label(__('Observații'))->rows(2)->columnSpanFull(),
@@ -53,12 +53,12 @@ class CallResource extends Resource
->schema([
Forms\Components\DateTimePicker::make('called_at')->label(__('Data & ora'))->default(now())->required(),
Forms\Components\Select::make('direction')
->options(Call::DIRECTIONS)
->options(\App\Support\I18n::opts(Call::DIRECTIONS))
->default('incoming')
->required(),
Forms\Components\TextInput::make('phone')->label(__('Telefon'))->tel()->required()->maxLength(40),
Forms\Components\Select::make('status')
->options(Call::STATUSES)
->options(\App\Support\I18n::opts(Call::STATUSES))
->default('answered')
->required(),
Forms\Components\TextInput::make('duration_sec')->label(__('Durată (sec)'))->numeric()->default(0),
@@ -92,7 +92,7 @@ class CallResource extends Resource
->badge(),
])
->filters([
Tables\Filters\SelectFilter::make('direction')->options(Call::DIRECTIONS),
Tables\Filters\SelectFilter::make('direction')->options(\App\Support\I18n::opts(Call::DIRECTIONS)),
Tables\Filters\Filter::make('today')
->label(__('Astăzi'))
->query(fn ($q) => $q->whereDate('called_at', today())),
@@ -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')),
@@ -63,13 +63,13 @@ class ExpenseResource extends Resource
->schema([
Forms\Components\DatePicker::make('paid_at')->label(__('Data'))->default(today())->required(),
Forms\Components\Select::make('category')
->options(Expense::CATEGORIES)
->options(\App\Support\I18n::opts(Expense::CATEGORIES))
->default('other')
->required(),
Forms\Components\TextInput::make('name')->label(__('Denumire'))->required()->maxLength(160)->columnSpanFull(),
Forms\Components\TextInput::make('amount')->label(__('Sumă'))->numeric()->required(),
Forms\Components\Select::make('method')
->options(Expense::METHODS)
->options(\App\Support\I18n::opts(Expense::METHODS))
->default('cash')
->required(),
Forms\Components\Select::make('supplier_id')
@@ -99,7 +99,7 @@ class ExpenseResource extends Resource
->summarize(Tables\Columns\Summarizers\Sum::make()->money('MDL')->label(__('Total'))),
])
->filters([
Tables\Filters\SelectFilter::make('category')->options(Expense::CATEGORIES),
Tables\Filters\SelectFilter::make('category')->options(\App\Support\I18n::opts(Expense::CATEGORIES)),
Tables\Filters\Filter::make('this_month')
->label(__('Luna curentă'))
->query(fn ($q) => $q->whereMonth('paid_at', now()->month)->whereYear('paid_at', now()->year)),
@@ -53,7 +53,7 @@ class LaborResource extends Resource
->schema([
Forms\Components\Select::make('category')
->label(__('Categorie'))
->options(array_combine(Labor::CATEGORIES, Labor::CATEGORIES))
->options(\App\Support\I18n::opts(array_combine(Labor::CATEGORIES, Labor::CATEGORIES)))
->required()
->searchable(),
Forms\Components\TextInput::make('code')->label(__('Cod'))->maxLength(32),
@@ -61,7 +61,7 @@ class LaborResource extends Resource
Forms\Components\TextInput::make('name_ru')->label(__('Nume (RU)'))->maxLength(160),
Forms\Components\Select::make('pricing_mode')
->label(__('Mod tarifare'))
->options(Labor::PRICING_MODES)
->options(\App\Support\I18n::opts(Labor::PRICING_MODES))
->default('hourly')
->live()
->required(),
@@ -95,7 +95,7 @@ class LaborResource extends Resource
])
->filters([
Tables\Filters\SelectFilter::make('category')
->options(array_combine(Labor::CATEGORIES, Labor::CATEGORIES)),
->options(\App\Support\I18n::opts(array_combine(Labor::CATEGORIES, Labor::CATEGORIES))),
Tables\Filters\TernaryFilter::make('is_active')->label(__('Doar active')),
])
->actions([
@@ -69,7 +69,7 @@ class LeadResource extends Resource
Forms\Components\TextInput::make('phone')->label(__('Telefon'))->tel()->required()->maxLength(40),
Forms\Components\TextInput::make('email')->email()->maxLength(120),
Forms\Components\Select::make('status')
->options(Lead::STATUSES)
->options(\App\Support\I18n::opts(Lead::STATUSES))
->default('new')
->required(),
]),
@@ -84,7 +84,7 @@ class LeadResource extends Resource
->columns(2)
->schema([
Forms\Components\Select::make('source')
->options(Lead::SOURCES)
->options(\App\Support\I18n::opts(Lead::SOURCES))
->searchable()
->default('manual'),
Forms\Components\Select::make('assigned_to')
@@ -115,9 +115,9 @@ class LeadResource extends Resource
Tables\Columns\TextColumn::make('name')->searchable()->sortable(),
Tables\Columns\TextColumn::make('phone')->copyable()->searchable(),
Tables\Columns\TextColumn::make('car')->label(__('Auto'))->formatStateUsing(fn ($state, $record) => trim($state . ' ' . ($record->model ?? ''))),
Tables\Columns\TextColumn::make('source')->label(__('Sursă'))->formatStateUsing(fn ($state) => Lead::SOURCES[$state] ?? $state)->badge(),
Tables\Columns\TextColumn::make('source')->label(__('Sursă'))->formatStateUsing(fn ($state) => __(Lead::SOURCES[$state] ?? $state))->badge(),
Tables\Columns\TextColumn::make('status')
->formatStateUsing(fn ($state) => Lead::STATUSES[$state] ?? $state)
->formatStateUsing(fn ($state) => __(Lead::STATUSES[$state] ?? $state))
->badge()
->colors([
'gray' => ['new'],
@@ -130,8 +130,8 @@ class LeadResource extends Resource
Tables\Columns\TextColumn::make('budget')->money('MDL')->placeholder('—'),
])
->filters([
Tables\Filters\SelectFilter::make('status')->options(Lead::STATUSES),
Tables\Filters\SelectFilter::make('source')->options(Lead::SOURCES),
Tables\Filters\SelectFilter::make('status')->options(\App\Support\I18n::opts(Lead::STATUSES)),
Tables\Filters\SelectFilter::make('source')->options(\App\Support\I18n::opts(Lead::SOURCES)),
])
->actions([
Actions\Action::make('convert')
@@ -55,7 +55,7 @@ class MarkupRuleResource extends Resource
->schema([
Forms\Components\Select::make('type')
->label(__('Tip'))
->options(MarkupRule::TYPES)
->options(\App\Support\I18n::opts(MarkupRule::TYPES))
->default('category')
->required()
->live(),
@@ -110,7 +110,7 @@ class MarkupRuleResource extends Resource
Tables\Columns\IconColumn::make('is_active')->boolean(),
])
->filters([
Tables\Filters\SelectFilter::make('type')->options(MarkupRule::TYPES),
Tables\Filters\SelectFilter::make('type')->options(\App\Support\I18n::opts(MarkupRule::TYPES)),
])
->headerActions([
Actions\Action::make('apply_all')
@@ -52,7 +52,7 @@ class MessageTemplateResource extends Resource
->schema([
Forms\Components\TextInput::make('name')->label(__('Nume template'))->required()->maxLength(120),
Forms\Components\Select::make('channel')
->options(MessageTemplate::CHANNELS)
->options(\App\Support\I18n::opts(MessageTemplate::CHANNELS))
->default('telegram')
->required(),
Forms\Components\TextInput::make('subject')->label(__('Subiect (email)'))->maxLength(160)->columnSpanFull(),
@@ -82,7 +82,7 @@ class MessageTemplateResource extends Resource
Tables\Columns\IconColumn::make('is_active')->boolean(),
])
->filters([
Tables\Filters\SelectFilter::make('channel')->options(MessageTemplate::CHANNELS),
Tables\Filters\SelectFilter::make('channel')->options(\App\Support\I18n::opts(MessageTemplate::CHANNELS)),
])
->actions([
Actions\EditAction::make(),
@@ -64,8 +64,8 @@ class OnlineOrderResource extends Resource
->columns(3)
->schema([
Forms\Components\TextInput::make('number')->label(__('Nr.'))->disabled()->dehydrated(false),
Forms\Components\Select::make('status')->options(OnlineOrder::STATUSES)->required(),
Forms\Components\Select::make('delivery_method')->label(__('Livrare'))->options(OnlineOrder::DELIVERY)->required(),
Forms\Components\Select::make('status')->options(\App\Support\I18n::opts(OnlineOrder::STATUSES))->required(),
Forms\Components\Select::make('delivery_method')->label(__('Livrare'))->options(\App\Support\I18n::opts(OnlineOrder::DELIVERY))->required(),
Forms\Components\TextInput::make('customer_name')->label(__('Client'))->required(),
Forms\Components\TextInput::make('customer_phone')->label(__('Telefon'))->required(),
Forms\Components\TextInput::make('customer_email')->label(__('Email')),
@@ -100,7 +100,7 @@ class OnlineOrderResource extends Resource
Tables\Columns\TextColumn::make('total')->money('MDL')->alignRight()->sortable(),
])
->filters([
Tables\Filters\SelectFilter::make('status')->options(OnlineOrder::STATUSES),
Tables\Filters\SelectFilter::make('status')->options(\App\Support\I18n::opts(OnlineOrder::STATUSES)),
])
->actions([
Actions\Action::make('fulfill')
@@ -84,7 +84,7 @@ class PartResource extends Resource
Forms\Components\TextInput::make('brand')->maxLength(64),
Forms\Components\Select::make('category')
->label(__('Categorie'))
->options(array_combine(Part::CATEGORIES, Part::CATEGORIES))
->options(\App\Support\I18n::opts(array_combine(Part::CATEGORIES, Part::CATEGORIES)))
->searchable(),
Forms\Components\TextInput::make('barcode')->label(__('Cod bare'))->maxLength(64),
Forms\Components\TextInput::make('location')->label(__('Locație rack/bin'))->maxLength(64),
@@ -167,7 +167,7 @@ class PartResource extends Resource
])
->filters([
Tables\Filters\SelectFilter::make('category')
->options(array_combine(Part::CATEGORIES, Part::CATEGORIES)),
->options(\App\Support\I18n::opts(array_combine(Part::CATEGORIES, Part::CATEGORIES))),
Tables\Filters\Filter::make('low_stock')
->label(__('Stoc minim'))
->query(fn ($q) => $q->whereColumn('qty', '<=', 'min_qty')),
@@ -69,7 +69,7 @@ class PaymentResource extends Resource
->schema([
Forms\Components\DatePicker::make('paid_at')->label(__('Data'))->default(today())->required(),
Forms\Components\Select::make('method')
->options(Payment::METHODS)
->options(\App\Support\I18n::opts(Payment::METHODS))
->default('cash')
->required(),
Forms\Components\TextInput::make('amount')->label(__('Sumă'))->numeric()->required(),
@@ -104,7 +104,7 @@ class PaymentResource extends Resource
Tables\Columns\TextColumn::make('reference')->label(__('Ref.'))->placeholder('—')->toggleable(),
])
->filters([
Tables\Filters\SelectFilter::make('method')->options(Payment::METHODS),
Tables\Filters\SelectFilter::make('method')->options(\App\Support\I18n::opts(Payment::METHODS)),
Tables\Filters\Filter::make('today')
->label(__('Astăzi'))
->query(fn ($q) => $q->whereDate('paid_at', today())),
@@ -67,7 +67,7 @@ class PayrollAdjustmentResource extends Resource
->searchable()
->required(),
Forms\Components\Select::make('type')
->options(PayrollAdjustment::TYPES)
->options(\App\Support\I18n::opts(PayrollAdjustment::TYPES))
->default('bonus')
->required(),
Forms\Components\TextInput::make('amount')->label(__('Sumă'))->numeric()->required(),
@@ -102,7 +102,7 @@ class PayrollAdjustmentResource extends Resource
Tables\Columns\IconColumn::make('applied')->boolean()->label(__('Aplicat')),
])
->filters([
Tables\Filters\SelectFilter::make('type')->options(PayrollAdjustment::TYPES),
Tables\Filters\SelectFilter::make('type')->options(\App\Support\I18n::opts(PayrollAdjustment::TYPES)),
Tables\Filters\SelectFilter::make('user_id')
->label(__('Utilizator'))
->options(fn () => User::pluck('name', 'id')),
@@ -57,7 +57,7 @@ class PricingCoefficientResource extends Resource
->schema([
Forms\Components\CheckboxList::make('conditions.classes')
->label(__('Clase auto'))
->options(PricingCoefficient::VEHICLE_CLASSES)
->options(\App\Support\I18n::opts(PricingCoefficient::VEHICLE_CLASSES))
->columns(2)
->columnSpanFull(),
Forms\Components\CheckboxList::make('conditions.body_types')
@@ -75,7 +75,7 @@ class PricingCoefficientResource extends Resource
Forms\Components\Toggle::make('conditions.client_vip')->label(__('Doar clienți VIP')),
Forms\Components\CheckboxList::make('conditions.urgency')
->label(__('Urgență'))
->options(PricingCoefficient::URGENCY)
->options(\App\Support\I18n::opts(PricingCoefficient::URGENCY))
->columns(3)
->columnSpanFull(),
]),
@@ -66,7 +66,7 @@ class PurchaseResource extends Resource
->default(fn () => Warehouse::where('is_default', true)->value('id'))
->required(),
Forms\Components\Select::make('status')
->options(Purchase::STATUSES)
->options(\App\Support\I18n::opts(Purchase::STATUSES))
->default('draft')
->required(),
Forms\Components\DatePicker::make('order_date')->label(__('Data comandă'))->default(today())->required(),
@@ -109,7 +109,7 @@ class PurchaseResource extends Resource
Tables\Columns\TextColumn::make('total')->money('MDL')->alignRight(),
])
->filters([
Tables\Filters\SelectFilter::make('status')->options(Purchase::STATUSES),
Tables\Filters\SelectFilter::make('status')->options(\App\Support\I18n::opts(Purchase::STATUSES)),
Tables\Filters\SelectFilter::make('supplier_id')
->label(__('Furnizor'))
->options(fn () => Supplier::pluck('name', 'id')),
@@ -56,7 +56,7 @@ class ServiceTemplateResource extends Resource
->placeholder(__('ex: Revizie completă 15.000 km'))->columnSpanFull(),
Forms\Components\Select::make('category')
->label(__('Categorie'))
->options(array_combine(Labor::CATEGORIES, Labor::CATEGORIES))
->options(\App\Support\I18n::opts(array_combine(Labor::CATEGORIES, Labor::CATEGORIES)))
->searchable(),
Forms\Components\Toggle::make('is_active')->label(__('Activ'))->default(true),
Forms\Components\Textarea::make('notes')->label(__('Observații'))->columnSpanFull()->rows(2),
@@ -30,7 +30,7 @@ class ItemsRelationManager extends RelationManager
return $schema->components([
Forms\Components\Select::make('kind')
->label(__('Tip'))
->options(ServiceTemplateItem::KINDS)
->options(\App\Support\I18n::opts(ServiceTemplateItem::KINDS))
->default('labor')
->live()
->required(),
@@ -45,7 +45,7 @@ class SubcontractJobResource extends Resource
->columns(2)
->schema([
Forms\Components\TextInput::make('number')->label(__('Nr.'))->disabled()->dehydrated(false)->placeholder(__('Generat automat')),
Forms\Components\Select::make('status')->options(SubcontractJob::STATUSES)->default('sent')->required(),
Forms\Components\Select::make('status')->options(\App\Support\I18n::opts(SubcontractJob::STATUSES))->default('sent')->required(),
Forms\Components\Select::make('subcontractor_id')
->label(__('Subcontractor'))
->options(fn () => Subcontractor::where('is_active', true)->pluck('name', 'id'))
@@ -57,7 +57,7 @@ class SubcontractJobResource extends Resource
->searchable(),
Forms\Components\Select::make('category')
->label(__('Categorie'))
->options(array_combine(Subcontractor::SPECIALTIES, Subcontractor::SPECIALTIES))
->options(\App\Support\I18n::opts(array_combine(Subcontractor::SPECIALTIES, Subcontractor::SPECIALTIES)))
->searchable(),
Forms\Components\Textarea::make('description')->label(__('Descriere'))->rows(2)->columnSpanFull(),
]),
@@ -109,7 +109,7 @@ class SubcontractJobResource extends Resource
Tables\Columns\IconColumn::make('paid_to_sub')->label(__('Plătit terț'))->boolean()->toggleable(),
])
->filters([
Tables\Filters\SelectFilter::make('status')->options(SubcontractJob::STATUSES),
Tables\Filters\SelectFilter::make('status')->options(\App\Support\I18n::opts(SubcontractJob::STATUSES)),
Tables\Filters\SelectFilter::make('subcontractor_id')
->label(__('Subcontractor'))
->options(fn () => Subcontractor::pluck('name', 'id')),
@@ -41,7 +41,7 @@ class SubcontractorResource extends Resource
Forms\Components\TextInput::make('name')->label(__('Nume'))->required()->maxLength(160),
Forms\Components\Select::make('specialty')
->label(__('Specialitate'))
->options(array_combine(Subcontractor::SPECIALTIES, Subcontractor::SPECIALTIES))
->options(\App\Support\I18n::opts(array_combine(Subcontractor::SPECIALTIES, Subcontractor::SPECIALTIES)))
->searchable(),
Forms\Components\TextInput::make('phone')->label(__('Telefon'))->tel()->maxLength(40),
Forms\Components\TextInput::make('email')->email()->maxLength(120),
@@ -65,7 +65,7 @@ class TireSetResource extends Resource
: [])
->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\Select::make('season')->label(__('Sezon'))->options(\App\Support\I18n::opts(TireSet::SEASONS))->default('winter')->required(),
]),
Schemas\Components\Section::make(__('Specificații'))
->columns(3)
@@ -78,7 +78,7 @@ class TireSetResource extends Resource
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\Select::make('condition')->label(__('Stare'))->options(\App\Support\I18n::opts(TireSet::CONDITIONS)),
]),
Schemas\Components\Section::make(__('Uzură (mm) per poziție'))
->columns(4)
@@ -130,7 +130,7 @@ class TireSetResource extends Resource
->color(fn ($state) => $state === '—' ? 'gray' : 'success'),
])
->filters([
Tables\Filters\SelectFilter::make('season')->options(TireSet::SEASONS),
Tables\Filters\SelectFilter::make('season')->options(\App\Support\I18n::opts(TireSet::SEASONS)),
Tables\Filters\Filter::make('stored')
->label(__('În depozit'))
->query(fn ($q) => $q->whereHas('storage', fn ($s) => $s->where('status', 'stored'))),
@@ -80,7 +80,7 @@ class WorkOrderResource extends Resource
->schema([
Forms\Components\TextInput::make('number')->label(__('Nr.'))->disabled()->dehydrated(false)->placeholder('auto'),
Forms\Components\DatePicker::make('opened_at')->label(__('Deschis'))->default(today())->required(),
Forms\Components\Select::make('status')->options(WorkOrder::STATUSES)->default('new')->required(),
Forms\Components\Select::make('status')->options(\App\Support\I18n::opts(WorkOrder::STATUSES))->default('new')->required(),
Forms\Components\Select::make('urgency')->label(__('Urgență'))
->options(\App\Models\Tenant\PricingCoefficient::URGENCY)->default('normal')->required(),
Forms\Components\Select::make('client_id')->label(__('Client'))
@@ -128,7 +128,7 @@ class WorkOrderResource extends Resource
Schemas\Components\Section::make(__('Plată & total'))
->columns(3)->collapsible()->collapsed()->compact()
->schema([
Forms\Components\Select::make('pay_status')->options(WorkOrder::PAY_STATUSES)->default('unpaid')->required(),
Forms\Components\Select::make('pay_status')->options(\App\Support\I18n::opts(WorkOrder::PAY_STATUSES))->default('unpaid')->required(),
Forms\Components\TextInput::make('discount_pct')->label(__('Discount %'))->numeric()->default(0),
Forms\Components\Toggle::make('apply_margin')
->label(__('Aplică marjă internă'))
@@ -157,7 +157,7 @@ class WorkOrderResource extends Resource
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) => WorkOrder::STATUSES[$state] ?? $state)
->formatStateUsing(fn ($state) => __(WorkOrder::STATUSES[$state] ?? $state))
->badge()
->colors([
'gray' => ['new'],
@@ -167,7 +167,7 @@ class WorkOrderResource extends Resource
'danger' => ['cancelled'],
]),
Tables\Columns\TextColumn::make('pay_status')
->formatStateUsing(fn ($state) => WorkOrder::PAY_STATUSES[$state] ?? $state)
->formatStateUsing(fn ($state) => __(WorkOrder::PAY_STATUSES[$state] ?? $state))
->badge()
->colors([
'danger' => ['unpaid'],
@@ -177,8 +177,8 @@ class WorkOrderResource extends Resource
Tables\Columns\TextColumn::make('total')->money('MDL')->alignRight()->sortable(),
])
->filters([
Tables\Filters\SelectFilter::make('status')->options(WorkOrder::STATUSES),
Tables\Filters\SelectFilter::make('pay_status')->options(WorkOrder::PAY_STATUSES),
Tables\Filters\SelectFilter::make('status')->options(\App\Support\I18n::opts(WorkOrder::STATUSES)),
Tables\Filters\SelectFilter::make('pay_status')->options(\App\Support\I18n::opts(WorkOrder::PAY_STATUSES)),
Tables\Filters\SelectFilter::make('master_id')
->label(__('Maistru'))
->options(fn () => User::pluck('name', 'id')),
@@ -57,7 +57,7 @@ class PartsRelationManager extends RelationManager
Forms\Components\TextInput::make('sell_price')->label(__('Preț vânzare'))->numeric()->required(),
Forms\Components\TextInput::make('discount_pct')->label(__('Discount %'))->numeric()->default(0),
Forms\Components\Select::make('status')
->options(WorkOrderPart::STATUSES)
->options(\App\Support\I18n::opts(WorkOrderPart::STATUSES))
->default('needed')
->required()
->helperText(__('La trecere pe „Montată" se scade automat din stoc.')),
@@ -27,7 +27,7 @@ class PaymentsRelationManager extends RelationManager
Forms\Components\DatePicker::make('paid_at')->label(__('Data'))->default(today())->required(),
Forms\Components\TextInput::make('amount')->label(__('Sumă'))->numeric()->required(),
Forms\Components\Select::make('method')
->options(Payment::METHODS)
->options(\App\Support\I18n::opts(Payment::METHODS))
->default('cash')
->required(),
Forms\Components\TextInput::make('reference')->label(__('Referință'))->maxLength(64),
@@ -32,9 +32,9 @@ class SubcontractJobsRelationManager extends RelationManager
->columnSpanFull(),
Forms\Components\Select::make('category')
->label(__('Categorie'))
->options(array_combine(Subcontractor::SPECIALTIES, Subcontractor::SPECIALTIES))
->options(\App\Support\I18n::opts(array_combine(Subcontractor::SPECIALTIES, Subcontractor::SPECIALTIES)))
->searchable(),
Forms\Components\Select::make('status')->options(SubcontractJob::STATUSES)->default('sent')->required(),
Forms\Components\Select::make('status')->options(\App\Support\I18n::opts(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),
@@ -51,7 +51,7 @@ class WorksRelationManager extends RelationManager
->options(fn () => User::pluck('name', 'id'))
->searchable(),
Forms\Components\Select::make('status')
->options(WorkOrderWork::STATUSES)
->options(\App\Support\I18n::opts(WorkOrderWork::STATUSES))
->default('todo')
->required(),
Forms\Components\Textarea::make('notes')->label(__('Notițe'))->columnSpanFull()->rows(2),
@@ -15,7 +15,7 @@ class LowStockTable extends BaseWidget
protected static ?string $heading = null;
public function getHeading(): string
protected function getTableHeading(): string
{
return '⚠️ ' . __('Stoc minim atins');
}