Forms\Components\TextInput::make('remaining_stock')
->disabled()
->suffixAction(
Action::make('addingNewStock')
->label('Add New Stock')
->icon('heroicon-m-plus')
->requiresConfirmation()
->form([
Forms\Components\TextInput::make('adding_stock')
->numeric()
->rules(['integer', 'min:0'])
])
->modalIcon('heroicon-m-plus')
->action(function (
Forms\Set $set, Get $get, array $data
): void {
$set(
'remaining_stock',
$get('remaining_stock') + $data['adding_stock']);
})
)
Forms\Components\TextInput::make('remaining_stock')
->disabled()
->suffixAction(
Action::make('addingNewStock')
->label('Add New Stock')
->icon('heroicon-m-plus')
->requiresConfirmation()
->form([
Forms\Components\TextInput::make('adding_stock')
->numeric()
->rules(['integer', 'min:0'])
])
->modalIcon('heroicon-m-plus')
->action(function (
Forms\Set $set, Get $get, array $data
): void {
$set(
'remaining_stock',
$get('remaining_stock') + $data['adding_stock']);
})
)