Lint & refactor
This commit is contained in:
parent
e1d73a2fd4
commit
b43b726587
@ -202,7 +202,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
item_list: [],
|
item_list: [],
|
||||||
invoiceItems: [],
|
selected_items: [],
|
||||||
search: '', // search column model
|
search: '', // search column model
|
||||||
show: {
|
show: {
|
||||||
item_selected: false,
|
item_selected: false,
|
||||||
@ -321,26 +321,25 @@ export default {
|
|||||||
|
|
||||||
async fetchMatchedItems() {
|
async fetchMatchedItems() {
|
||||||
await window.axios.get(url + '/common/items?search="' + this.search + '" limit:10')
|
await window.axios.get(url + '/common/items?search="' + this.search + '" limit:10')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.item_list = [];
|
this.item_list = [];
|
||||||
|
let items = response.data.data;
|
||||||
|
|
||||||
let items = response.data.data;
|
items.forEach(function (item, index) {
|
||||||
|
this.item_list.push({
|
||||||
items.forEach(function (item, index) {
|
index: index,
|
||||||
this.item_list.push({
|
key: item.id,
|
||||||
index: index,
|
value: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
|
||||||
key: item.id,
|
type: this.type,
|
||||||
value: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
|
id: item.id,
|
||||||
type: this.type,
|
name: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
|
||||||
id: item.id,
|
description: (item.description) ? item.description : '',
|
||||||
name: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
|
price: (item.price) ? item.price : (this.price == 'purchase_price') ? item.purchase_price : item.sale_price,
|
||||||
description: (item.description) ? item.description : '',
|
tax_ids: (item.tax_ids) ? item.tax_ids : [],
|
||||||
price: (item.price) ? item.price : (this.price == 'purchase_price') ? item.purchase_price : item.sale_price,
|
});
|
||||||
tax_ids: (item.tax_ids) ? item.tax_ids : [],
|
}, this);
|
||||||
});
|
})
|
||||||
}, this);
|
.catch(error => {});
|
||||||
})
|
|
||||||
.catch(error => {});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemSelected(item) {
|
onItemSelected(item) {
|
||||||
@ -350,10 +349,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addItem(item) {
|
addItem(item) {
|
||||||
this.invoiceItems.push(item);
|
this.selected_items.push(item);
|
||||||
|
|
||||||
this.$emit('item', item);
|
this.$emit('item', item);
|
||||||
this.$emit('items', this.invoiceItems);
|
this.$emit('items', this.selected_items);
|
||||||
|
|
||||||
this.show.item_selected = false;
|
this.show.item_selected = false;
|
||||||
this.show.item_list = false;
|
this.show.item_list = false;
|
||||||
@ -513,7 +512,7 @@ export default {
|
|||||||
return this.sortItems();
|
return this.sortItems();
|
||||||
},
|
},
|
||||||
currentIndex() {
|
currentIndex() {
|
||||||
return this.invoiceItems.length;
|
return this.selected_items.length;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user