f7fc69077b
- Convert static $modelLabel/$pluralModelLabel/$title to getter methods - Wrap ->label()/->placeholder()/->helperText()/->description()/->title()/->body() args - Wrap Section::make()/Fieldset::make()/Notification::make()->title() args - Fix RelationManagers::getTitle() signature to match parent (Model, string) - Fix Pages::getTitle() to instance method (BasePage::getTitle is non-static) - Extend lang/ru.json + lang/en.json with 700+ common terms; identity fallback for the rest - Remove duplicate getters in 5 resources that had manual getModelLabel already All 306 tests pass. Missing translations fall back to the RO key so the UI never breaks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
1.3 KiB
PHP
40 lines
1.3 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 = '⚠️ 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');
|
|
}
|
|
}
|