From 4d7f01d87e129f023ba2f73c7003b4c5fea3eb83 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 3 Nov 2023 09:38:40 -0400 Subject: [PATCH 01/16] WIP - Cart Styling --- src/fmg-components/cart/cart.vue | 70 +++++++++++++++++-- src/layouts/payment-method/payment-method.vue | 5 +- 2 files changed, 66 insertions(+), 9 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index ce43971d8..b5fdb4e97 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -46,13 +46,30 @@
- {{ recycleFeeCartItem.name }}{{ currencyFormatter.format(recycleFeeCartItem.subTotal) }} + + {{ currencyFormatter.format(recycleFeeCartItem.subTotal) }}
{{ mobileFeeCartItem.name }}{{ currencyFormatter.format(mobileFeeCartItem.subTotal) }}
+ +
+ {{ premiumAppointmentDiscountCartItem.name }} + + {{ currencyFormatter.format(premiumAppointmentDiscountCartItem.subTotal) }} + +
+
@@ -86,6 +103,7 @@ import { getHighestFullySatisfiedTier, getPackageContents } from "@/helpers/serv // Constants import { partTypeStrings } from "@/constants/part-type-strings"; +import { PREMIUM_FEE_PART_TYPE } from "@/constants/schedule-constants"; import { cartItemCategories } from "@/constants/cart-item-categories"; import { cartItemTypes } from "@/constants/cart-item-types"; @@ -216,6 +234,10 @@ export default { cartItems.push(cartItem); }); + if (this.premiumAppointmentDiscountCartItem) { + cartItems.push(this.premiumAppointmentDiscountCartItem); + } + return cartItems; }, }, @@ -294,7 +316,7 @@ export default { const nonpackageCartItems = []; this.cartItems.forEach((cartItem) => { - if (cartItem == this.recycleFeeCartItem || cartItem == this.mobileFeeCartItem) { + if (cartItem == this.recycleFeeCartItem || cartItem == this.mobileFeeCartItem || cartItem == this.premiumAppointmentDiscountCartItem) { return; } @@ -470,8 +492,8 @@ export default { lineItems: [], }; - //recycleFeeLineItem.cartItemType = cartItem.cartItemType; - //cartItem.lineItems.push(recycleFeeLineItem); + recycleFeeLineItem.cartItemType = cartItem.cartItemType; + cartItem.lineItems.push(recycleFeeLineItem); cartItem.subTotal += (recycleFeeLineItem.kitPrice ?? 0) + @@ -552,6 +574,40 @@ export default { return cartItem; }, + premiumAppointmentDiscountCartItemName() { + return "Early bird appointment"; // TODO: get from CMS + }, + premiumAppointmentDiscountCartItem() { + let cartItem = null; + + const premiumAppointmentDiscountLineItem = this.supportingItems.find( + (lineItem) => lineItem.partNumber == PREMIUM_FEE_PART_TYPE + ); + + if (premiumAppointmentDiscountLineItem) { + cartItem = { + name: this.premiumAppointmentDiscountCartItemName, + category: cartItemCategories.SUPPORTING_ITEMS, + cartItemType: PREMIUM_FEE_PART_TYPE, + isDisplayed: true, + subTotal: 0, + salesTax: 0, + lineItems: [], + }; + + premiumAppointmentDiscountLineItem.cartItemType = cartItem.cartItemType; + cartItem.lineItems.push(premiumAppointmentDiscountLineItem); + + cartItem.subTotal += + (premiumAppointmentDiscountLineItem.kitPrice ?? 0) + + (premiumAppointmentDiscountLineItem.laborAmount ?? 0) + + (premiumAppointmentDiscountLineItem.sellingPrice ?? 0); + + cartItem.salesTax += premiumAppointmentDiscountLineItem.salesTax ?? 0; + } + + return cartItem; + }, removeLinkText() { return this.getCmsContent("RemoveCartItemTextWidget", "Text"); }, @@ -625,7 +681,7 @@ export default { div { display: flex; justify-content: space-between; - padding: 0.5rem 1.5rem; + padding: 0.5rem 1.5rem; &:nth-child(odd) { background-color: #f5f5f5; } @@ -643,7 +699,7 @@ export default { align-items: center; span { display: flex; - width: 33.33333%; + font-size: 0.875rem; &:nth-child(2) { justify-content: flex-end; } diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index ef0a17a19..eda5fa529 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -15,8 +15,7 @@ + cmsWidgetName="FunnelSubHeaderWidget" />

{{ noPiaDisclaimer }} @@ -31,6 +30,8 @@ servicePackageOptionsCmsName="ServicePackageTitle" @cart-remove="cartRemove" /> +


+
Date: Fri, 3 Nov 2023 10:21:21 -0400 Subject: [PATCH 02/16] WIP Update Nonpackaged Cart Items for Leah --- src/fmg-components/cart/cart.vue | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index b5fdb4e97..1e19bd561 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -33,7 +33,7 @@
-
+
{{ cartItem.name }} {{ mobileFeeCartItem.name }}{{ currencyFormatter.format(mobileFeeCartItem.subTotal) }}
- +
{{ premiumAppointmentDiscountCartItem.name }} {{ currencyFormatter.format(premiumAppointmentDiscountCartItem.subTotal) }} - +
@@ -681,7 +681,7 @@ export default { div { display: flex; justify-content: space-between; - padding: 0.5rem 1.5rem; + padding: 0.5rem 1.5rem; &:nth-child(odd) { background-color: #f5f5f5; } @@ -729,6 +729,17 @@ export default { padding: 0; } } + // Custom order/wrap for nonpackaged Cart Items + .premium-appt-cart-item { + flex-wrap: wrap; + span { + display: flex; + justify-content: space-between; + } + a { + order: 3; + } + } } .vin-toggle { &:after { From ec431ecd59cc9290bc8d3bb4eabadc9ce5d27b3b Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 3 Nov 2023 14:01:08 -0400 Subject: [PATCH 03/16] Prettified --- src/fmg-components/cart/cart.vue | 16 ++++++++++++---- src/layouts/payment-method/payment-method.vue | 4 +--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 1e19bd561..064a2c2b1 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -33,7 +33,10 @@
-
+
{{ cartItem.name }} - {{ currencyFormatter.format(premiumAppointmentDiscountCartItem.subTotal) }} - + {{ + currencyFormatter.format(premiumAppointmentDiscountCartItem.subTotal) + }}
@@ -316,7 +320,11 @@ export default { const nonpackageCartItems = []; this.cartItems.forEach((cartItem) => { - if (cartItem == this.recycleFeeCartItem || cartItem == this.mobileFeeCartItem || cartItem == this.premiumAppointmentDiscountCartItem) { + if ( + cartItem == this.recycleFeeCartItem || + cartItem == this.mobileFeeCartItem || + cartItem == this.premiumAppointmentDiscountCartItem + ) { return; } diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index eda5fa529..dd6f0afc3 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -13,9 +13,7 @@ cmsWidgetName="VehicleBannerWidget" :displayGenericVehicleImage="false" /> - +

{{ noPiaDisclaimer }} From 738ffbe8433a679c0ebe4b7c2fd3abf33be01ee8 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 6 Nov 2023 08:21:28 -0500 Subject: [PATCH 04/16] Fixed some calculation issues --- src/constants/cart-item-types.js | 1 + src/constants/part-type-strings.js | 2 ++ src/fmg-components/cart/cart.vue | 18 ++++++++---------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/constants/cart-item-types.js b/src/constants/cart-item-types.js index 858aa1e8e..7db2ac312 100644 --- a/src/constants/cart-item-types.js +++ b/src/constants/cart-item-types.js @@ -7,6 +7,7 @@ const cartItemTypes = { RECYCLE_FEE: "RECYCLE FEE", MOBILE_FEE: "MOBILE FEE", PROMOS: "PROMOS", + EARLY_BIRD: "EARLY BIRD", }; export { cartItemTypes }; diff --git a/src/constants/part-type-strings.js b/src/constants/part-type-strings.js index 50d92832c..d7cc11414 100644 --- a/src/constants/part-type-strings.js +++ b/src/constants/part-type-strings.js @@ -5,6 +5,8 @@ const partTypeStrings = { RECALIBRATION: "RECALIBRATION", RECYCLE_FEE: "RECYCLE FEE", MOBILE_FEE: "MOBILE FEE", + REPAIR_FEE: "REPAIR FEE", + EARLY_BIRD: "EARLY BIRD" }; export { partTypeStrings }; diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 064a2c2b1..195e7090e 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -68,7 +68,7 @@ linkType="text" :text="removeLinkText" href="#!" - @click-event="removeItem(PREMIUM_FEE_PART_TYPE, 'supportingItems')" /> + @click-event="removeItem(premiumAppointmentDiscountCartItem.cartItemType, 'supportingItems')" /> {{ currencyFormatter.format(premiumAppointmentDiscountCartItem.subTotal) }} @@ -107,7 +107,6 @@ import { getHighestFullySatisfiedTier, getPackageContents } from "@/helpers/serv // Constants import { partTypeStrings } from "@/constants/part-type-strings"; -import { PREMIUM_FEE_PART_TYPE } from "@/constants/schedule-constants"; import { cartItemCategories } from "@/constants/cart-item-categories"; import { cartItemTypes } from "@/constants/cart-item-types"; @@ -177,6 +176,8 @@ export default { return vapsTypeName.Text; }, removeItem(cartItemType, category) { + console.log("removeItem") + console.log(`cartItemType: ${cartItemType}, category: ${category}`) this.lineItems[category] = this.lineItems[category].filter( (lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType ); @@ -520,7 +521,7 @@ export default { let cartItem = null; const mobileFeeLineItem = this.supportingItems.find( - (lineItem) => lineItem.partNumber == partTypeStrings.MOBILE_FEE + (lineItem) => lineItem.partType == partTypeStrings.MOBILE_FEE ); if (mobileFeeLineItem) { @@ -550,11 +551,8 @@ export default { otherSupportingItemsCartItem() { let cartItem = null; - const otherSupportingItemsLineItems = this.supportingItems.filter( - (lineItem) => - lineItem.partNumber != partTypeStrings.MOBILE_FEE && - lineItem.partNumber != partTypeStrings.RECYCLE_FEE - ); + let otherSupportingItemsLineItems = baseMixin.methods.filterOutFees(this.supportingItems); + otherSupportingItemsLineItems = otherSupportingItemsLineItems.filter(lineItem => lineItem.partType != partTypeStrings.EARLY_BIRD); if (otherSupportingItemsLineItems.length > 0) { cartItem = { @@ -589,14 +587,14 @@ export default { let cartItem = null; const premiumAppointmentDiscountLineItem = this.supportingItems.find( - (lineItem) => lineItem.partNumber == PREMIUM_FEE_PART_TYPE + (lineItem) => lineItem.partType == partTypeStrings.EARLY_BIRD ); if (premiumAppointmentDiscountLineItem) { cartItem = { name: this.premiumAppointmentDiscountCartItemName, category: cartItemCategories.SUPPORTING_ITEMS, - cartItemType: PREMIUM_FEE_PART_TYPE, + cartItemType: cartItemTypes.EARLY_BIRD, isDisplayed: true, subTotal: 0, salesTax: 0, From 3471b6e51413087ed50952460fcfe6d70fede35b Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 6 Nov 2023 08:21:35 -0500 Subject: [PATCH 05/16] Fixed some calculation issues 2 --- src/fmg-components/cart/cart.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 195e7090e..169a3e0a9 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -176,8 +176,6 @@ export default { return vapsTypeName.Text; }, removeItem(cartItemType, category) { - console.log("removeItem") - console.log(`cartItemType: ${cartItemType}, category: ${category}`) this.lineItems[category] = this.lineItems[category].filter( (lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType ); From d3d334f666fca47a01ca4521456345a7747175c6 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 6 Nov 2023 08:39:46 -0500 Subject: [PATCH 06/16] Fixed unit test and Prettified --- src/constants/part-type-strings.js | 2 +- src/fmg-components/cart/cart.spec.js | 2 +- src/fmg-components/cart/cart.vue | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/constants/part-type-strings.js b/src/constants/part-type-strings.js index d7cc11414..fd1f4e781 100644 --- a/src/constants/part-type-strings.js +++ b/src/constants/part-type-strings.js @@ -6,7 +6,7 @@ const partTypeStrings = { RECYCLE_FEE: "RECYCLE FEE", MOBILE_FEE: "MOBILE FEE", REPAIR_FEE: "REPAIR FEE", - EARLY_BIRD: "EARLY BIRD" + EARLY_BIRD: "EARLY BIRD", }; export { partTypeStrings }; diff --git a/src/fmg-components/cart/cart.spec.js b/src/fmg-components/cart/cart.spec.js index bfe1dbb55..ae84083e6 100644 --- a/src/fmg-components/cart/cart.spec.js +++ b/src/fmg-components/cart/cart.spec.js @@ -268,7 +268,7 @@ describe("cart.vue", () => { kitPrice: 0, laborAmount: 34.98, partNumber: "MOBILE FEE", - partType: "REPLACE FEE", + partType: "MOBILE FEE", salesTax: 2.62, sellingPrice: 0, }, diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 169a3e0a9..55516010f 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -68,7 +68,12 @@ linkType="text" :text="removeLinkText" href="#!" - @click-event="removeItem(premiumAppointmentDiscountCartItem.cartItemType, 'supportingItems')" /> + @click-event=" + removeItem( + premiumAppointmentDiscountCartItem.cartItemType, + 'supportingItems' + ) + " /> {{ currencyFormatter.format(premiumAppointmentDiscountCartItem.subTotal) }} @@ -549,8 +554,12 @@ export default { otherSupportingItemsCartItem() { let cartItem = null; - let otherSupportingItemsLineItems = baseMixin.methods.filterOutFees(this.supportingItems); - otherSupportingItemsLineItems = otherSupportingItemsLineItems.filter(lineItem => lineItem.partType != partTypeStrings.EARLY_BIRD); + let otherSupportingItemsLineItems = baseMixin.methods.filterOutFees( + this.supportingItems + ); + otherSupportingItemsLineItems = otherSupportingItemsLineItems.filter( + (lineItem) => lineItem.partType != partTypeStrings.EARLY_BIRD + ); if (otherSupportingItemsLineItems.length > 0) { cartItem = { From a6a4a302b280d06a4345a9d2a6cce60b1630649c Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 6 Nov 2023 13:37:41 -0500 Subject: [PATCH 07/16] CSR-1384: add some space under cart component --- src/fmg-components/cart/cart.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 440823f67..1efd1e8a5 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -1,5 +1,5 @@