Skip to content

Commit 75d7308

Browse files
authored
Merge pull request #6 from lara-zeus/fix-min-value
fix min value
2 parents 558957e + a507c5d commit 75d7308

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

resources/views/quantity.blade.php

+14-24
Original file line numberDiff line numberDiff line change
@@ -53,37 +53,27 @@
5353
isDecrementAllowed: true,
5454
isIncrementAllowed: true,
5555
increment() {
56-
if(this.minValue !== 0 && this.maxValue !== 0) {
57-
if(this.state < this.maxValue && this.state >= this.minValue){
58-
this.state++
59-
$wire.$refresh()
60-
if(this.state == this.maxValue){
61-
this.isIncrementAllowed = false
62-
} else {
63-
this.isIncrementAllowed = true
64-
this.isDecrementAllowed = true
65-
}
66-
}
67-
} else {
56+
if(this.state < this.maxValue && this.state >= this.minValue){
6857
this.state++
6958
$wire.$refresh()
59+
if(this.state == this.maxValue){
60+
this.isIncrementAllowed = false
61+
} else {
62+
this.isIncrementAllowed = true
63+
this.isDecrementAllowed = true
64+
}
7065
}
7166
},
7267
decrement() {
73-
if(this.minValue !== 0 && this.maxValue !== 0) {
74-
if(this.state > 0 && this.state <= this.maxValue && this.state > this.minValue) {
75-
this.state--
76-
$wire.$refresh()
77-
if(this.state == this.minValue){
78-
this.isDecrementAllowed = false
79-
} else {
80-
this.isIncrementAllowed = true
81-
this.isDecrementAllowed = true
82-
}
83-
}
84-
} else {
68+
if(this.state > 0 && this.state <= this.maxValue && this.state > this.minValue) {
8569
this.state--
8670
$wire.$refresh()
71+
if(this.state == this.minValue){
72+
this.isDecrementAllowed = false
73+
} else {
74+
this.isIncrementAllowed = true
75+
this.isDecrementAllowed = true
76+
}
8777
}
8878
},
8979
}"

0 commit comments

Comments
 (0)