diff --git a/app/Filament/Resources/InventarioPrendaResource.php b/app/Filament/Resources/InventarioPrendaResource.php index cc5b163..44f3e08 100644 --- a/app/Filament/Resources/InventarioPrendaResource.php +++ b/app/Filament/Resources/InventarioPrendaResource.php @@ -90,7 +90,8 @@ class InventarioPrendaResource extends Resource ->dehydrated(false), DatePicker::make('fecha_ingreso') - ->required(), + ->required() + ->default(now()), Select::make('estado') ->options([ diff --git a/app/Models/InventarioPrenda.php b/app/Models/InventarioPrenda.php index a0779ed..5c06c69 100644 --- a/app/Models/InventarioPrenda.php +++ b/app/Models/InventarioPrenda.php @@ -50,6 +50,11 @@ class InventarioPrenda extends Model } } + // Fecha de ingreso por defecto a hoy si no se proporcionó + if (! isset($inventario->fecha_ingreso) || ! $inventario->fecha_ingreso) { + $inventario->fecha_ingreso = now()->toDateString(); + } + // Al ingresar al inventario, todo está disponible $inventario->cantidad_disponible = $inventario->cantidad_terminada;