Localize category column and filter label in LaborResource table
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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')),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user