From 18c43fe06f75b003e093ca897f6ca3e90e4c06b4 Mon Sep 17 00:00:00 2001 From: Juan Felipe Duarte Date: Sat, 17 Jan 2026 08:22:54 -0500 Subject: [PATCH] =?UTF-8?q?Add=20Gesti=C3=B3n=20dashboard=20and=20update?= =?UTF-8?q?=20Tela=20stats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- app/Filament/Pages/GestionDashboard.php | 31 +++++++++++++++ app/Filament/Resources/ConfeccionResource.php | 2 +- .../Resources/InventarioPrendaResource.php | 2 +- .../Resources/OrdenProduccionResource.php | 2 +- .../Resources/ProcesoAcabadoResource.php | 2 +- app/Filament/Resources/TelaResource.php | 2 +- app/Filament/Resources/TintoreriaResource.php | 2 +- app/Filament/Widgets/TelasStatsOverview.php | 38 +++++++++++++++++++ app/Models/Tela.php | 5 +++ .../2026_01_08_213226_create_telas_table.php | 8 ++-- .../pages/gestion-dashboard.blade.php | 3 ++ 11 files changed, 87 insertions(+), 10 deletions(-) create mode 100644 app/Filament/Pages/GestionDashboard.php create mode 100644 app/Filament/Widgets/TelasStatsOverview.php create mode 100644 resources/views/filament/pages/gestion-dashboard.blade.php diff --git a/app/Filament/Pages/GestionDashboard.php b/app/Filament/Pages/GestionDashboard.php new file mode 100644 index 0000000..c51e9e9 --- /dev/null +++ b/app/Filament/Pages/GestionDashboard.php @@ -0,0 +1,31 @@ +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'), + ]; + } +} diff --git a/app/Models/Tela.php b/app/Models/Tela.php index 55dfd28..b009cae 100644 --- a/app/Models/Tela.php +++ b/app/Models/Tela.php @@ -28,4 +28,9 @@ class Tela extends Model { return $this->belongsTo(Proveedor::class); } + + public function ordenesProduccion() + { + return $this->hasMany(OrdenProduccion::class); + } } diff --git a/database/migrations/2026_01_08_213226_create_telas_table.php b/database/migrations/2026_01_08_213226_create_telas_table.php index 1952a85..d4d3e46 100644 --- a/database/migrations/2026_01_08_213226_create_telas_table.php +++ b/database/migrations/2026_01_08_213226_create_telas_table.php @@ -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(); diff --git a/resources/views/filament/pages/gestion-dashboard.blade.php b/resources/views/filament/pages/gestion-dashboard.blade.php new file mode 100644 index 0000000..cc61477 --- /dev/null +++ b/resources/views/filament/pages/gestion-dashboard.blade.php @@ -0,0 +1,3 @@ + + +