95aeecb932
- 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>
45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tenant\Widgets;
|
|
|
|
use App\Models\Tenant\Part;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use Filament\Widgets\TableWidget as BaseWidget;
|
|
|
|
class LowStockTable extends BaseWidget
|
|
{
|
|
protected static ?int $sort = 5;
|
|
|
|
protected int|string|array $columnSpan = 'full';
|
|
|
|
protected static ?string $heading = null;
|
|
|
|
protected function getTableHeading(): string
|
|
{
|
|
return '⚠️ ' . __('Stoc minim atins');
|
|
}
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->query(
|
|
Part::query()
|
|
->where('is_active', true)
|
|
->whereColumn('qty', '<=', 'min_qty')
|
|
->orderBy('qty')
|
|
)
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('name')->label(__('Piesă'))->wrap()->searchable(),
|
|
Tables\Columns\TextColumn::make('article')->label(__('Cod'))->placeholder('—'),
|
|
Tables\Columns\TextColumn::make('qty')->label(__('Stoc'))->alignRight()
|
|
->color(fn ($state) => $state <= 0 ? 'danger' : 'warning')
|
|
->weight('bold'),
|
|
Tables\Columns\TextColumn::make('min_qty')->label(__('Min.'))->alignRight(),
|
|
Tables\Columns\TextColumn::make('preferredSupplier.name')->label(__('Furnizor'))->placeholder('—'),
|
|
])
|
|
->paginated(false)
|
|
->defaultSort('qty');
|
|
}
|
|
}
|