Merge pull request #601 from Safelite/feature/richardson/SSR-1141.1
create a method to build the formatted line item
This commit is contained in:
commit
70abdfb516
1 changed files with 10 additions and 5 deletions
|
|
@ -664,21 +664,26 @@ export default {
|
||||||
},
|
},
|
||||||
getPayInAdvanceLineItems(cartItems) {
|
getPayInAdvanceLineItems(cartItems) {
|
||||||
const { glassParts } = useMainStore().order.lineItems;
|
const { glassParts } = useMainStore().order.lineItems;
|
||||||
const lineItems = (glassParts === null) ? ['Labor|0|1', 'Repair supplies|0|1'] : ['Parts and labor|0|1'];
|
const lineItems = (glassParts === null)
|
||||||
|
? [this.getPayInAdvanceFormattedLineItem('Labor', 0, 1), this.getPayInAdvanceFormattedLineItem('Repair supplies', 0, 1)]
|
||||||
|
: [this.getPayInAdvanceFormattedLineItem('Parts and labor', 0, 1)];
|
||||||
|
|
||||||
cartItems.forEach((item) => {
|
cartItems.forEach((item) => {
|
||||||
if (item.name !== null && item.category !== 'promos') {
|
if (item.name !== null && item.category !== 'promos') {
|
||||||
lineItems.push(`${item.name}|${(item.salesTax + item.subTotal).toFixed(2)}|1`);
|
lineItems.push(this.getPayInAdvanceFormattedLineItem(item.name, (item.salesTax + item.subTotal).toFixed(2), 1));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.payInAdvanceLineItems = lineItems.join('||');
|
this.payInAdvanceLineItems = lineItems.join('||');
|
||||||
},
|
},
|
||||||
|
getPayInAdvanceFormattedLineItem(itemName, price, quantity) {
|
||||||
|
return `${itemName}|${price}|${quantity}`;
|
||||||
|
},
|
||||||
getMockPiaLineItems() {
|
getMockPiaLineItems() {
|
||||||
let lineItems = [];
|
let lineItems = [];
|
||||||
lineItems = ['Parts and labor|0|1'];
|
lineItems = [this.getPayInAdvanceFormattedLineItem('Parts and labor', 0, 1)];
|
||||||
lineItems.push('New wiper blades|75.22|1');
|
lineItems.push(this.getPayInAdvanceFormattedLineItem('New wiper blades', 75.22, 1));
|
||||||
lineItems.push('Recycling|37.60|1');
|
lineItems.push(this.getPayInAdvanceFormattedLineItem('Recycling', 37.60, 1));
|
||||||
|
|
||||||
this.payInAdvanceLineItems = lineItems.join('||');
|
this.payInAdvanceLineItems = lineItems.join('||');
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue