schema([ DateTimePicker::make('fecha_recepcion')->required(), TextInput::make('cantidad') ->numeric() ->required() ->minValue(1) ->maxValue(fn () => $this->getOwnerRecord()?->faltantes ?? 0) ->helperText(fn () => 'Máximo: ' . ($this->getOwnerRecord()?->faltantes ?? 0)), TextInput::make('prendas_defectuosas') ->numeric() ->minValue(0) ->maxValue(fn ($get) => (int) ($get('cantidad') ?? 0)) ->helperText('Opcional. Se restará del total recibido.'), Textarea::make('notas'), ]); } public function table(Tables\Table $table): Tables\Table { return $table ->columns([ TextColumn::make('id')->label('#'), TextColumn::make('fecha_recepcion')->dateTime()->label('Fecha'), TextColumn::make('cantidad')->label('Cantidad'), TextColumn::make('prendas_defectuosas')->label('Defectos'), TextColumn::make('usuario.name')->label('Usuario'), TextColumn::make('notas')->limit(50)->wrap(), TextColumn::make('created_at')->dateTime()->label('Creado'), ]) ->headerActions([]) ->actions([ EditAction::make(), DeleteAction::make(), ]) ->bulkActions([]); } }