This commit is contained in:
Lizandro Guarnizo
2026-01-18 12:21:02 -05:00
parent 78340138d4
commit 29c6567d27
2 changed files with 34 additions and 4 deletions
+18 -3
View File
@@ -52,14 +52,29 @@ class ConfeccionResource extends Resource
->relationship('ordenProduccion', 'numero_orden')
->searchable()
->preload()
->required(),
->reactive()
->required()
->afterStateUpdated(function ($state, $set) {
if ($state) {
$orden = \App\Models\OrdenProduccion::find($state);
if ($orden) {
$set('cantidad_enviada', $orden->cantidad_total);
$set('fecha_envio', now()->toDateString());
}
}
}),
DatePicker::make('fecha_envio')
->required(),
->required()
->default(now()),
TextInput::make('cantidad_enviada')
->numeric()
->required(),
->required()
->minValue(1)
->maxValue(fn ($get) => $get('orden_produccion_id') ? \App\Models\OrdenProduccion::find($get('orden_produccion_id'))->cantidad_total : null)
->helperText(fn ($get) => $get('orden_produccion_id') ? 'Máximo: ' . \App\Models\OrdenProduccion::find($get('orden_produccion_id'))->cantidad_total : 'Selecciona una Orden de Producción')
->reactive(),
DatePicker::make('fecha_recepcion'),