Files
Vasyka e969bb9c7d i18n: wrap all formatStateUsing(fn(\$s)=>X::CONST[\$s]??\$s) with __() (21 files)
Previous sed pass only matched \$state; missed \$s and other arg-name
variants. This time the regex is arg-name-agnostic and touches 21
files across Filament resources & relation managers.

Also wraps two special cases: UserResource role-labels lookup and
LaborResource pricing_mode ternary ('Fix' | 'Pe oră').

+27 human translations for the enum values that were still identity
fallback: WorkOrderWork.STATUSES (De făcut), Purchase.STATUSES,
OnlineOrder.STATUSES, Call.DIRECTIONS/STATUSES, BodyshopJob.TYPES/
STATUSES, TireSet.SEASONS, MessageTemplate.CHANNELS,
DamagePoint.SEVERITIES, ServiceTemplateItem.KINDS.

All 306 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-16 07:41:35 +00:00

44 lines
1.5 KiB
PHP

<?php
namespace App\Filament\Tenant\Resources\ShopCustomerResource\RelationManagers;
use App\Models\Tenant\OnlineOrder;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
class OrdersRelationManager extends RelationManager
{
protected static string $relationship = 'orders';
protected static ?string $title = null;
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
{
return __('Comenzi');
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('number')
->columns([
Tables\Columns\TextColumn::make('number')->label(__('Nr.')),
Tables\Columns\TextColumn::make('created_at')->label(__('Data'))->dateTime('d.m.Y H:i'),
Tables\Columns\TextColumn::make('status')
->formatStateUsing(fn ($s) => __(OnlineOrder::STATUSES[$s] ?? $s))
->badge()
->colors([
'warning' => ['new'],
'info' => ['confirmed', 'packed'],
'primary' => ['shipped'],
'success' => ['delivered'],
'danger' => ['cancelled'],
]),
Tables\Columns\TextColumn::make('total')->money('MDL')->alignRight(),
])
->defaultSort('created_at', 'desc')
->emptyStateHeading(__('Nicio comandă încă'));
}
}