Closed ahmetkocabiyik closed 10 months ago
@ahmetkocabiyik can you provide the code that regenerates this bug?
Sure @ariaieboy. When i select product from the list, unit_price must be updated. If i use currencyMask it is not updated.
Forms\Components\Select::make('product_id')
->relationship("product","name", function(\Illuminate\Contracts\Database\Eloquent\Builder $query){
return $query->where("type",ProductTypeEnum::MAMUL);
})
->required()
->label("Product Name")
->columnSpan("full")
->live()
->afterStateUpdated(function (Set $set, Get $get,int $state) {
$set("unit_price",intval(Product::find($state)->sale_price));
}),
Forms\Components\TextInput::make('unit_price')
->label("Unit Price")
->currencyMask()
->dehydrated()
->required()
->columnSpan("full")
->prefix('₺'),
What happened?
If you use currencyMask and have to update price field against other field state, this doesn't work. If you remove currencyMask method there is no problem.
For example like below picture, i have a product list that has price previously defined. When i select a product in select box, unit price must be updated with selected product price but no change. If i remove currencyMask method on unit price field, it works
How to reproduce the bug
Use the ->currencyMask method on input field and set a dynamic price value using other field state
Package Version
1.1.3
PHP Version
8.2
Laravel Version
10.10
Which operating systems does with happen with?
macOS
Notes
No response