mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
fix item selection issue
This commit is contained in:
@ -28,6 +28,7 @@
|
|||||||
@select="onSelectItem"
|
@select="onSelectItem"
|
||||||
@deselect="deselectItem"
|
@deselect="deselectItem"
|
||||||
@onDesriptionInput="$v.item.description.$touch()"
|
@onDesriptionInput="$v.item.description.$touch()"
|
||||||
|
@onSelectItem="isSelected = true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -193,13 +194,17 @@ export default {
|
|||||||
prefix: '$ ',
|
prefix: '$ ',
|
||||||
precision: 2,
|
precision: 2,
|
||||||
masked: false
|
masked: false
|
||||||
}
|
},
|
||||||
|
isSelected: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('item', [
|
...mapGetters('item', [
|
||||||
'items'
|
'items'
|
||||||
]),
|
]),
|
||||||
|
...mapGetters('modal', [
|
||||||
|
'modalActive'
|
||||||
|
]),
|
||||||
...mapGetters('currency', [
|
...mapGetters('currency', [
|
||||||
'defaultCurrencyForInput'
|
'defaultCurrencyForInput'
|
||||||
]),
|
]),
|
||||||
@ -284,6 +289,11 @@ export default {
|
|||||||
if (this.item.discount_type === 'percentage') {
|
if (this.item.discount_type === 'percentage') {
|
||||||
this.item.discount_val = (this.item.discount * newValue) / 100
|
this.item.discount_val = (this.item.discount * newValue) / 100
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
modalActive (val) {
|
||||||
|
if (!val) {
|
||||||
|
this.isSelected = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
validations () {
|
validations () {
|
||||||
@ -314,7 +324,7 @@ export default {
|
|||||||
created () {
|
created () {
|
||||||
window.hub.$on('checkItems', this.validateItem)
|
window.hub.$on('checkItems', this.validateItem)
|
||||||
window.hub.$on('newItem', (val) => {
|
window.hub.$on('newItem', (val) => {
|
||||||
if (this.item.item_id) {
|
if (!this.item.item_id && this.modalActive && this.isSelected) {
|
||||||
this.onSelectItem(val)
|
this.onSelectItem(val)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -126,6 +126,7 @@ export default {
|
|||||||
this.$emit('search', val)
|
this.$emit('search', val)
|
||||||
},
|
},
|
||||||
openItemModal () {
|
openItemModal () {
|
||||||
|
this.$emit('onSelectItem')
|
||||||
this.openModal({
|
this.openModal({
|
||||||
'title': 'Add Item',
|
'title': 'Add Item',
|
||||||
'componentName': 'ItemModal'
|
'componentName': 'ItemModal'
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
@select="onSelectItem"
|
@select="onSelectItem"
|
||||||
@deselect="deselectItem"
|
@deselect="deselectItem"
|
||||||
@onDesriptionInput="$v.item.description.$touch()"
|
@onDesriptionInput="$v.item.description.$touch()"
|
||||||
|
@onSelectItem="isSelected = true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -194,13 +195,17 @@ export default {
|
|||||||
prefix: '$ ',
|
prefix: '$ ',
|
||||||
precision: 2,
|
precision: 2,
|
||||||
masked: false
|
masked: false
|
||||||
}
|
},
|
||||||
|
isSelected: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('item', [
|
...mapGetters('item', [
|
||||||
'items'
|
'items'
|
||||||
]),
|
]),
|
||||||
|
...mapGetters('modal', [
|
||||||
|
'modalActive'
|
||||||
|
]),
|
||||||
...mapGetters('currency', [
|
...mapGetters('currency', [
|
||||||
'defaultCurrencyForInput'
|
'defaultCurrencyForInput'
|
||||||
]),
|
]),
|
||||||
@ -285,6 +290,11 @@ export default {
|
|||||||
if (this.item.discount_type === 'percentage') {
|
if (this.item.discount_type === 'percentage') {
|
||||||
this.item.discount_val = (this.item.discount * newValue) / 100
|
this.item.discount_val = (this.item.discount * newValue) / 100
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
modalActive (val) {
|
||||||
|
if (!val) {
|
||||||
|
this.isSelected = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
validations () {
|
validations () {
|
||||||
@ -315,7 +325,7 @@ export default {
|
|||||||
created () {
|
created () {
|
||||||
window.hub.$on('checkItems', this.validateItem)
|
window.hub.$on('checkItems', this.validateItem)
|
||||||
window.hub.$on('newItem', (val) => {
|
window.hub.$on('newItem', (val) => {
|
||||||
if (this.item.item_id) {
|
if (!this.item.item_id && this.modalActive && this.isSelected) {
|
||||||
this.onSelectItem(val)
|
this.onSelectItem(val)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -115,6 +115,7 @@ export default {
|
|||||||
this.$emit('search', val)
|
this.$emit('search', val)
|
||||||
},
|
},
|
||||||
openItemModal () {
|
openItemModal () {
|
||||||
|
this.$emit('onSelectItem')
|
||||||
this.openModal({
|
this.openModal({
|
||||||
'title': 'Add Item',
|
'title': 'Add Item',
|
||||||
'componentName': 'ItemModal'
|
'componentName': 'ItemModal'
|
||||||
|
|||||||
Reference in New Issue
Block a user