WIP again

This commit is contained in:
Leah Schumann 2023-10-24 15:47:21 -04:00
parent 4bfeebcec3
commit c94e3e3740
2 changed files with 18 additions and 16 deletions

View file

@ -97,7 +97,6 @@ export default {
style: "currency", style: "currency",
currency: "USD", currency: "USD",
}), }),
lineItems: deepClone(this.modelValue),
lineItemUtilities: new LineItemUtilities(), lineItemUtilities: new LineItemUtilities(),
}; };
}, },
@ -159,6 +158,9 @@ export default {
}, },
}, },
computed: { computed: {
lineItems() {
return this.modelValue;
},
cartItems: { cartItems: {
get: function () { get: function () {
let cartItems = []; let cartItems = [];
@ -307,11 +309,11 @@ export default {
cartItemType: "REAR WIPER", cartItemType: "REAR WIPER",
subTotal: 0, subTotal: 0,
salesTax: 0, salesTax: 0,
lineItems: [], lineItemIds: [],
}; };
rearWiperLineItems.forEach((lineItem) => { rearWiperLineItems.forEach((lineItem) => {
cartItem.lineItems.push(lineItem); cartItem.lineItemIds.push(lineItem.id);
cartItem.subTotal += cartItem.subTotal +=
(lineItem.kitPrice ?? 0) + (lineItem.kitPrice ?? 0) +
@ -338,10 +340,10 @@ export default {
cartItemType: "RAIN DEFENSE", cartItemType: "RAIN DEFENSE",
subTotal: 0, subTotal: 0,
salesTax: 0, salesTax: 0,
lineItems: [], lineItemIds: [],
}; };
cartItem.lineItems.push(rainDefenseLineItem); cartItem.lineItemIds.push(rainDefenseLineItem.id);
cartItem.subTotal += cartItem.subTotal +=
(rainDefenseLineItem.kitPrice ?? 0) + (rainDefenseLineItem.kitPrice ?? 0) +
@ -368,11 +370,11 @@ export default {
cartItemType: "GLASS PARTS", cartItemType: "GLASS PARTS",
subTotal: 0, subTotal: 0,
salesTax: 0, salesTax: 0,
lineItems: [], lineItemIds: [],
}; };
flattenedGlassPartsLineItems.forEach((lineItem) => { flattenedGlassPartsLineItems.forEach((lineItem) => {
cartItem.lineItems.push(lineItem); cartItem.lineItemIds.push(lineItem.id);
cartItem.subTotal += cartItem.subTotal +=
(lineItem.kitPrice ?? 0) + (lineItem.kitPrice ?? 0) +
@ -395,11 +397,11 @@ export default {
cartItemType: "SUPPORTING ITEMS", cartItemType: "SUPPORTING ITEMS",
subTotal: 0, subTotal: 0,
salesTax: 0, salesTax: 0,
lineItems: [], lineItemIds: [],
}; };
this.supportingItems.forEach((lineItem) => { this.supportingItems.forEach((lineItem) => {
cartItem.lineItems.push(lineItem); cartItem.lineItemIds.push(lineItem.id);
cartItem.subTotal += cartItem.subTotal +=
(lineItem.kitPrice ?? 0) + (lineItem.kitPrice ?? 0) +
@ -426,10 +428,10 @@ export default {
cartItemType: "SUPPORTING ITEMS", cartItemType: "SUPPORTING ITEMS",
subTotal: 0, subTotal: 0,
salesTax: 0, salesTax: 0,
lineItems: [], lineItemIds: [],
}; };
cartItem.lineItems.push(recycleFeeLineItem); cartItem.lineItemIds.push(recycleFeeLineItem.id);
cartItem.subTotal += cartItem.subTotal +=
(recycleFeeLineItem.kitPrice ?? 0) + (recycleFeeLineItem.kitPrice ?? 0) +
@ -455,10 +457,10 @@ export default {
cartItemType: "SUPPORTING ITEMS", cartItemType: "SUPPORTING ITEMS",
subTotal: 0, subTotal: 0,
salesTax: 0, salesTax: 0,
lineItems: [], lineItemIds: [],
}; };
cartItem.lineItems.push(mobileFeeLineItem); cartItem.lineItemIds.push(mobileFeeLineItem.id);
cartItem.subTotal += cartItem.subTotal +=
(mobileFeeLineItem.kitPrice ?? 0) + (mobileFeeLineItem.kitPrice ?? 0) +

View file

@ -159,9 +159,9 @@ export default {
watch: { watch: {
modelValue: { modelValue: {
handler(newValue) { handler(newValue) {
console.log(newValue) console.log(newValue);
} },
} },
}, },
components: { components: {
buttonQuestion, buttonQuestion,