Files
pos_heidiver/app/Filament/Widgets/TelasStatsOverview.php
T
Juan Felipe Duarte 18c43fe06f Add Gestión dashboard and update Tela stats
Introduces a new Gestión dashboard page with a stats overview widget for Tela and OrdenProduccion. Updates navigation icons for several Filament resources for better distinction. Adds a relationship between Tela and OrdenProduccion models. Refactors the telas table migration to use integer types for numeric fields instead of strings.
2026-01-17 08:22:54 -05:00

39 lines
1.3 KiB
PHP

<?php
namespace App\Filament\Widgets;
use App\Models\OrdenProduccion;
use App\Models\Tela;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;
class TelasStatsOverview extends BaseWidget
{
protected static ?int $sort = 1;
protected function getStats(): array
{
return [
Stat::make('Total de Telas', Tela::count())
->description('Telas registradas')
->descriptionIcon('heroicon-m-archive-box')
->color('success'),
Stat::make('Metros Disponibles', number_format(Tela::sum('metros_disponibles'), 2) . ' m')
->description('Total en stock')
->descriptionIcon('heroicon-m-bolt')
->color('warning'),
Stat::make('Valor Total Inventario', '$' . number_format(Tela::sum('valor_total'), 2))
->description('Inversión total')
->descriptionIcon('heroicon-m-currency-dollar')
->color('primary'),
Stat::make('Órdenes Activas', OrdenProduccion::whereNotIn('estado', ['finalizada'])->count())
->description('En proceso')
->descriptionIcon('heroicon-m-clipboard-document-list')
->color('info'),
];
}
}