Skip to content

Commit a12096d

Browse files
authored
Merge pull request #13 from masterix21/patch-1
Disable increments and decrements if the field is disabled
2 parents 50b145c + 92770d8 commit a12096d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

resources/views/quantity.blade.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@
5252
minValue: {{ $getMinValue ?? 0 }},
5353
isDecrementAllowed: true,
5454
isIncrementAllowed: true,
55+
isDisabled: {{ $isDisabled ? 'true' : 'false' }}
5556
increment() {
56-
if(this.state < this.maxValue && this.state >= this.minValue){
57+
if(! this.isDisabled && this.state < this.maxValue && this.state >= this.minValue){
5758
this.state++
5859
$wire.$refresh()
5960
if(this.state == this.maxValue){
@@ -65,7 +66,7 @@
6566
}
6667
},
6768
decrement() {
68-
if(this.state > 0 && this.state <= this.maxValue && this.state > this.minValue) {
69+
if(! this.isDisabled && this.state > 0 && this.state <= this.maxValue && this.state > this.minValue) {
6970
this.state--
7071
$wire.$refresh()
7172
if(this.state == this.minValue){

0 commit comments

Comments
 (0)