up
This commit is contained in:
@@ -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'),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user