Skip to content

Commit

Permalink
Merge pull request #13 from masterix21/patch-1
Browse files Browse the repository at this point in the history
Disable increments and decrements if the field is disabled
  • Loading branch information
atmonshi authored May 16, 2024
2 parents 50b145c + 92770d8 commit a12096d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resources/views/quantity.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@
minValue: {{ $getMinValue ?? 0 }},
isDecrementAllowed: true,
isIncrementAllowed: true,
isDisabled: {{ $isDisabled ? 'true' : 'false' }}
increment() {
if(this.state < this.maxValue && this.state >= this.minValue){
if(! this.isDisabled && this.state < this.maxValue && this.state >= this.minValue){
this.state++
$wire.$refresh()
if(this.state == this.maxValue){
Expand All @@ -65,7 +66,7 @@
}
},
decrement() {
if(this.state > 0 && this.state <= this.maxValue && this.state > this.minValue) {
if(! this.isDisabled && this.state > 0 && this.state <= this.maxValue && this.state > this.minValue) {
this.state--
$wire.$refresh()
if(this.state == this.minValue){
Expand Down

0 comments on commit a12096d

Please sign in to comment.