public function checkModal(): Action
{
return Action::make('transaction')
->action(function (array $arguments, array $data): void {
$item_id = $this->item->id;
//make something
})
->fillForm(fn ($record, $arguments): array => [
'option_id' => $arguments['option_id'],
'amount' => 0,
])
->form([
Select::make('option_id')
->prefix(__('item::article.select-option'))
->hiddenLabel()
->options($this->option_opts)
->required()
->reactive()
->afterStateUpdated(function () {
$this->dispatch('update-current-prices');
}),
TextInput::make('amount')
->hiddenLabel()
->numeric()
->rules('gt:0')
->reactive()
->afterStateUpdated(function () {
$this->dispatch('update-current-stock');
}),
Livewire::make(TransactionInformation::class, fn (Get $get) => [
'amount' => $get('amount'),
'item_uuid' => $this->item_uuid,
'option_id' => $get('option_id'),
'option_options' => array_keys($this->option_opts),
]),
])
}
public function checkModal(): Action
{
return Action::make('transaction')
->action(function (array $arguments, array $data): void {
$item_id = $this->item->id;
//make something
})
->fillForm(fn ($record, $arguments): array => [
'option_id' => $arguments['option_id'],
'amount' => 0,
])
->form([
Select::make('option_id')
->prefix(__('item::article.select-option'))
->hiddenLabel()
->options($this->option_opts)
->required()
->reactive()
->afterStateUpdated(function () {
$this->dispatch('update-current-prices');
}),
TextInput::make('amount')
->hiddenLabel()
->numeric()
->rules('gt:0')
->reactive()
->afterStateUpdated(function () {
$this->dispatch('update-current-stock');
}),
Livewire::make(TransactionInformation::class, fn (Get $get) => [
'amount' => $get('amount'),
'item_uuid' => $this->item_uuid,
'option_id' => $get('option_id'),
'option_options' => array_keys($this->option_opts),
]),
])
}