From 116a53d81d9beb055bd374e00c4f476906fb616c Mon Sep 17 00:00:00 2001 From: Vasyka Date: Mon, 7 Sep 2026 12:56:23 +0000 Subject: [PATCH] Localize category column and filter label in LaborResource table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit formatStateUsing looks up localized category name from LaborCategory so 'Anvelope' shows as 'Шины' (ru) / 'Tires' (en). Filter label uses __('Categorie') to avoid the auto-derived 'Category' (English). Co-Authored-By: Claude Sonnet 4.6 --- app/Filament/Tenant/Resources/LaborResource.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Filament/Tenant/Resources/LaborResource.php b/app/Filament/Tenant/Resources/LaborResource.php index 4e58a82..43bec1a 100644 --- a/app/Filament/Tenant/Resources/LaborResource.php +++ b/app/Filament/Tenant/Resources/LaborResource.php @@ -81,7 +81,15 @@ class LaborResource extends Resource { return $table ->columns([ - Tables\Columns\TextColumn::make('category')->label(__('Categorie'))->badge()->sortable(), + Tables\Columns\TextColumn::make('category') + ->label(__('Categorie')) + ->badge() + ->sortable() + ->formatStateUsing(function ($state) { + static $opts = null; + $opts ??= \App\Models\Tenant\LaborCategory::optionsForSelect(); + return $opts[$state] ?? $state; + }), Tables\Columns\TextColumn::make('name_ro') ->label(__('Manoperă')) ->searchable() @@ -100,6 +108,7 @@ class LaborResource extends Resource ]) ->filters([ Tables\Filters\SelectFilter::make('category') + ->label(__('Categorie')) ->options(fn () => \App\Models\Tenant\LaborCategory::optionsForSelect()), Tables\Filters\TernaryFilter::make('is_active')->label(__('Doar active')), ])