Skip to content

Commit

Permalink
Merge pull request #6 from lara-zeus/fix-min-value
Browse files Browse the repository at this point in the history
fix min value
  • Loading branch information
atmonshi authored Feb 18, 2024
2 parents 558957e + a507c5d commit 75d7308
Showing 1 changed file with 14 additions and 24 deletions.
38 changes: 14 additions & 24 deletions resources/views/quantity.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,37 +53,27 @@
isDecrementAllowed: true,
isIncrementAllowed: true,
increment() {
if(this.minValue !== 0 && this.maxValue !== 0) {
if(this.state < this.maxValue && this.state >= this.minValue){
this.state++
$wire.$refresh()
if(this.state == this.maxValue){
this.isIncrementAllowed = false
} else {
this.isIncrementAllowed = true
this.isDecrementAllowed = true
}
}
} else {
if(this.state < this.maxValue && this.state >= this.minValue){
this.state++
$wire.$refresh()
if(this.state == this.maxValue){
this.isIncrementAllowed = false
} else {
this.isIncrementAllowed = true
this.isDecrementAllowed = true
}
}
},
decrement() {
if(this.minValue !== 0 && this.maxValue !== 0) {
if(this.state > 0 && this.state <= this.maxValue && this.state > this.minValue) {
this.state--
$wire.$refresh()
if(this.state == this.minValue){
this.isDecrementAllowed = false
} else {
this.isIncrementAllowed = true
this.isDecrementAllowed = true
}
}
} else {
if(this.state > 0 && this.state <= this.maxValue && this.state > this.minValue) {
this.state--
$wire.$refresh()
if(this.state == this.minValue){
this.isDecrementAllowed = false
} else {
this.isIncrementAllowed = true
this.isDecrementAllowed = true
}
}
},
}"
Expand Down

0 comments on commit 75d7308

Please sign in to comment.