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 @@ + + +