Merge branch 'master' of https://gitlab.com/mohit.panjvani/crater-web into sweetalert-on-action

This commit is contained in:
bansarishukla
2019-11-12 18:07:13 +05:30
39 changed files with 823 additions and 198238 deletions

View File

@@ -519,14 +519,6 @@ export default {
...mapActions('item', [
'fetchItems'
]),
isEmpty (obj) {
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
return false
}
}
return true
},
selectFixed () {
if (this.newInvoice.discount_type === 'fixed') {
return

View File

@@ -28,6 +28,7 @@
@select="onSelectItem"
@deselect="deselectItem"
@onDesriptionInput="$v.item.description.$touch()"
@onSelectItem="isSelected = true"
/>
</div>
</td>
@@ -194,13 +195,17 @@ export default {
prefix: '$ ',
precision: 2,
masked: false
}
},
isSelected: false
}
},
computed: {
...mapGetters('item', [
'items'
]),
...mapGetters('modal', [
'modalActive'
]),
...mapGetters('currency', [
'defaultCurrencyForInput'
]),
@@ -285,6 +290,11 @@ export default {
if (this.item.discount_type === 'percentage') {
this.item.discount_val = (this.item.discount * newValue) / 100
}
},
modalActive (val) {
if (!val) {
this.isSelected = false
}
}
},
validations () {
@@ -314,7 +324,11 @@ export default {
},
created () {
window.hub.$on('checkItems', this.validateItem)
window.hub.$on('newItem', this.onSelectItem)
window.hub.$on('newItem', (val) => {
if (!this.item.item_id && this.modalActive && this.isSelected) {
this.onSelectItem(val)
}
})
},
methods: {
updateTax (data) {

View File

@@ -115,6 +115,7 @@ export default {
this.$emit('search', val)
},
openItemModal () {
this.$emit('onSelectItem')
this.openModal({
'title': 'Add Item',
'componentName': 'ItemModal'