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.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?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'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user