From ffd829cee9b94994996e8e0ded78dd93e8466b6a Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 13 Oct 2023 13:16:51 -0400 Subject: [PATCH] WIP --- src/fmg-components/cart/cart.vue | 74 ++++++++++++++++++- src/layouts/payment-method/payment-method.vue | 22 +++--- 2 files changed, 83 insertions(+), 13 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 7107e64e8..cb31df843 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -22,7 +22,7 @@ @@ -35,7 +35,7 @@ {{ lineItem.price }} @@ -45,7 +45,10 @@ >{{ recycleFee }} -
Subtotal$320
+
+ Subtotal + {{ subTotal }} +
Sales tax$1
Amount due$321
@@ -63,10 +66,12 @@ import { } from "@/helpers/service-package-helper"; import textLink from "@/ux-components/text-link/text-link"; import textBlock from "@/digital-components/text-block/text-block"; +import { deepClone } from "@/helpers/object-helper"; export default { name: "modal", props: { + modelValue: Object, damage: Object, servicePackageOptionsCmsName: String, availableLineItems: Object, @@ -76,7 +81,6 @@ export default { return { isActive: false, packageWithVAPS: false, - amountDue: this.getAmountDue(), }; }, methods: { @@ -130,6 +134,7 @@ export default { ...findLineItemsWithPartType(vapType, this.availableLineItems) ); }); + return vapsLineItemsForSelectedPackage; }, }, @@ -167,9 +172,18 @@ export default { return packagePriceString; // return (packagePriceString.length > 0) ? packagePriceString : "Test String"; }, + // cartItems: { + // get: function () { + // return this.answersToDisplay; + // }, + // set: function (newValue) { + + // }, + // }, displayedPackageLineItems() { const displayedPackageLineItems = []; const packageLineItems = this.getVapsLineItemsForSelectedPackage(this.packageLevel); + // TODO Determine if we could get the same list from this.lineItems? packageLineItems?.forEach((item) => { let price = item.sellingPrice + item.kitPrice + item.laborAmount; @@ -181,6 +195,7 @@ export default { }; displayedPackageLineItems.push(packageLineItem); }); + return displayedPackageLineItems; }, displayedNonPackageLineItems() { @@ -244,12 +259,63 @@ export default { // } return true; }, + removeLinkText() { + // TODO: retrieve from CMS + return "Remove"; + }, + cartLineItems() { + const cartLineItems = []; + + + + const glassParts = this.lineItems.glassParts?.flat(); + if (glassParts) { + glassParts.forEach((glassPart) => { + cartLineItems.push(glassPart); + }); + } + + const supportingItems = this.lineItems.supportingItems; + if (supportingItems) { + supportingItems.forEach((supportingItem) => { + cartLineItems.push(supportingItem); + }); + } + + const vaps = this.lineItems.vaps; + if (vaps) { + vaps.forEach((vap) => { + cartLineItems.push(vap); + }); + } + + return cartLineItems; + }, + subTotal() { + let subTotal = 0; + const pricedLineItems = this.cartLineItems.filter(i => Object.hasOwn(i, "sellingPrice")); + + pricedLineItems.forEach((lineItem) => { + + subTotal += (lineItem.sellingPrice ?? 0) + + (lineItem.kitPrice ?? 0) + + (lineItem.laborAmount ?? 0); + }); + return subTotal + this.getVapsPrice(this.packageLevel); + }, + salesTax() { + return "$2.50"; + }, + amountDue() { + return this.getAmountDue(); + }, }, components: { textBlock, textLink, }, }; +