Skip to content

Commit

Permalink
Lint & refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
benguozakinci@gmail.com authored and benguozakinci@gmail.com committed Aug 25, 2021
1 parent e1d73a2 commit b43b726
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions resources/assets/js/components/AkauntingItemButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default {
data() {
return {
item_list: [],
invoiceItems: [],
selected_items: [],
search: '', // search column model
show: {
item_selected: false,
Expand Down Expand Up @@ -321,26 +321,25 @@ export default {
async fetchMatchedItems() {
await window.axios.get(url + '/common/items?search="' + this.search + '" limit:10')
.then(response => {
this.item_list = [];
let items = response.data.data;
items.forEach(function (item, index) {
this.item_list.push({
index: index,
key: item.id,
value: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
type: this.type,
id: item.id,
name: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
description: (item.description) ? item.description : '',
price: (item.price) ? item.price : (this.price == 'purchase_price') ? item.purchase_price : item.sale_price,
tax_ids: (item.tax_ids) ? item.tax_ids : [],
});
}, this);
})
.catch(error => {});
.then(response => {
this.item_list = [];
let items = response.data.data;
items.forEach(function (item, index) {
this.item_list.push({
index: index,
key: item.id,
value: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
type: this.type,
id: item.id,
name: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
description: (item.description) ? item.description : '',
price: (item.price) ? item.price : (this.price == 'purchase_price') ? item.purchase_price : item.sale_price,
tax_ids: (item.tax_ids) ? item.tax_ids : [],
});
}, this);
})
.catch(error => {});
},
onItemSelected(item) {
Expand All @@ -350,10 +349,10 @@ export default {
},
addItem(item) {
this.invoiceItems.push(item);
this.selected_items.push(item);
this.$emit('item', item);
this.$emit('items', this.invoiceItems);
this.$emit('items', this.selected_items);
this.show.item_selected = false;
this.show.item_list = false;
Expand Down Expand Up @@ -513,7 +512,7 @@ export default {
return this.sortItems();
},
currentIndex() {
return this.invoiceItems.length;
return this.selected_items.length;
},
},
Expand Down

0 comments on commit b43b726

Please sign in to comment.