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,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Filament\Widgets\AlertasStockBodegasWidget;
|
||||
use Filament\Pages\Page;
|
||||
|
||||
class GestionDashboard extends Page
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-chart-bar';
|
||||
|
||||
protected static ?string $title = 'Dashboard de Gestión';
|
||||
|
||||
protected static string $view = 'filament.pages.gestion-dashboard';
|
||||
|
||||
protected function getHeaderWidgets(): array
|
||||
{
|
||||
return [
|
||||
\App\Filament\Widgets\TelasStatsOverview::class,
|
||||
// \App\Filament\Widgets\TelasStatsOverview::class,
|
||||
// \App\Filament\Widgets\TelasEstadoOverview::class,
|
||||
// \App\Filament\Widgets\TelasChart::class,
|
||||
];
|
||||
}
|
||||
|
||||
// ESTO CONTROLA EL ANCHO DE LOS WIDGETS
|
||||
// protected function getHeaderWidgetsColumns(): int | array
|
||||
// {
|
||||
// return 12;
|
||||
// }
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class ConfeccionResource extends Resource
|
||||
protected static ?string $model = Confeccion::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Gestión';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-cog';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ class InventarioPrendaResource extends Resource
|
||||
protected static ?string $model = InventarioPrenda::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Gestión';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-circle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ class OrdenProduccionResource extends Resource
|
||||
protected static ?string $model = OrdenProduccion::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Gestión';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-clipboard-document-list';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ class ProcesoAcabadoResource extends Resource
|
||||
protected static ?string $model = ProcesoAcabado::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Gestión';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-check-badge';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ class TelaResource extends Resource
|
||||
protected static ?string $model = Tela::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Gestión';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-map';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ class TintoreriaResource extends Resource
|
||||
protected static ?string $model = Tintoreria::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Gestión';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-eye-dropper';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@@ -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'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,9 @@ class Tela extends Model
|
||||
{
|
||||
return $this->belongsTo(Proveedor::class);
|
||||
}
|
||||
|
||||
public function ordenesProduccion()
|
||||
{
|
||||
return $this->hasMany(OrdenProduccion::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ return new class extends Migration
|
||||
|
||||
$table->foreignId('proveedor_id')->constrained('proveedors')->cascadeOnDelete();
|
||||
|
||||
$table->string('metros_comprados');
|
||||
$table->string('metros_disponibles');
|
||||
$table->integer('metros_comprados');
|
||||
$table->integer('metros_disponibles');
|
||||
|
||||
$table->date('fecha_compra');
|
||||
|
||||
$table->string('valor_total');
|
||||
$table->string('costo_por_metro');
|
||||
$table->integer('valor_total');
|
||||
$table->integer('costo_por_metro');
|
||||
|
||||
$table->text('observaciones')->nullable();
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<x-filament-panels::page>
|
||||
|
||||
</x-filament-panels::page>
|
||||
Reference in New Issue
Block a user