Fixed some calculation issues

This commit is contained in:
Leah Schumann 2023-11-06 08:21:28 -05:00
parent ec431ecd59
commit 738ffbe843
3 changed files with 11 additions and 10 deletions

View file

@ -7,6 +7,7 @@ const cartItemTypes = {
RECYCLE_FEE: "RECYCLE FEE",
MOBILE_FEE: "MOBILE FEE",
PROMOS: "PROMOS",
EARLY_BIRD: "EARLY BIRD",
};
export { cartItemTypes };

View file

@ -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 };

View file

@ -68,7 +68,7 @@
linkType="text"
:text="removeLinkText"
href="#!"
@click-event="removeItem(PREMIUM_FEE_PART_TYPE, 'supportingItems')" />
@click-event="removeItem(premiumAppointmentDiscountCartItem.cartItemType, 'supportingItems')" />
<span>{{
currencyFormatter.format(premiumAppointmentDiscountCartItem.subTotal)
}}</span>
@ -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,