diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 0aeff385..3fcd5848 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -36,7 +36,8 @@ const errorMessages = { DAMAGE_OPTION_REQUIRED: "Please select an option", POLICYHOLDER_FIRST_NAME_REQUIRED: "Please enter the policyholder first name", - POLICYHOLDER_LAST_NAME_REQUIRED: "Please enter the policyholder last name" + POLICYHOLDER_LAST_NAME_REQUIRED: "Please enter the policyholder last name", + ACKNOWLEDGEMENT_REQUIRED: "You must agree to the terms to continue" }; diff --git a/src/iss-components/site-footer/site-footer.vue b/src/iss-components/site-footer/site-footer.vue index 2ce2c41c..6d11a345 100644 --- a/src/iss-components/site-footer/site-footer.vue +++ b/src/iss-components/site-footer/site-footer.vue @@ -1,10 +1,8 @@ diff --git a/src/layouts/service-packages/service-package-question/service-package-question.vue b/src/layouts/service-packages/service-package-question/service-package-question.vue index c9011df2..53a6cd7b 100644 --- a/src/layouts/service-packages/service-package-question/service-package-question.vue +++ b/src/layouts/service-packages/service-package-question/service-package-question.vue @@ -22,6 +22,9 @@ TIER_TWO: 'TierTwo', TIER_THREE: 'TierThree', }; + + const store = useMainStore(); + export default { name: 'servicePackageQuestion', emits: ['vapsItemsSelected'], @@ -39,6 +42,11 @@ }; }, watch: { + availableLineItems() { + if (this.allGlassPartsAndItemsHavePrices(store.order.lineItems)) { + this.selectDefaultPackage(); + } + }, selectedPackageName(newValue) { const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue); this.$emit('vapsItemsSelected', VapsProductsInSelectedPackage); @@ -54,7 +62,7 @@ }, servicePackageAnswers() { if (!this.cmsWidgetName) return []; - let cmsAnswersContent = [ + const cmsAnswersContent = [ { Name: 'TierOne', cmsWidgetName: 'EconomyServicePackage' @@ -72,10 +80,6 @@ if (this.getCmsContent(cmsAnswersContent[0].cmsWidgetName, 'HeaderText') == '') { return {}; } - - if (!this.shouldDisplayTierTwoPackage) { - cmsAnswersContent = cmsAnswersContent.filter((answer) => answer.Name != packageNames.TIER_TWO); - } const modifiedAnswers = cmsAnswersContent.map((answer) => ({ value: answer.Name, buttonLabel: this.getHeaderTextFromCms(answer.cmsWidgetName), @@ -92,9 +96,13 @@ }, frontWipersApplicableForTierTwo() { const store = useMainStore(); - const frontWipersAreAvailable = this.lineItemsContainsPartType(partTypeStrings.FRONT_WIPER); + const frontWipersAreAvailable = this.lineItemsContainsPartType( + partTypeStrings.FRONT_WIPER + ); const isRepair = store.order.damage.isRepair; - const glassToReplaceContainsWindshield = this.glassToReplaceContainsGlassLocation(glassLocations.WINDSHIELD); + const glassToReplaceContainsWindshield = this.glassToReplaceContainsGlassLocation( + glassLocations.WINDSHIELD + ); if (frontWipersAreAvailable) { if (isRepair) { return true; @@ -162,7 +170,7 @@ }, getPackagePriceString(packageName) { const formattedPriceFloat = parseFloat(this.getPackagePrice(packageName)).toFixed(2); - return '+$' + formattedPriceFloat; + return '$' + formattedPriceFloat; }, getPackagePrice(packageName) { let priceFloat = 0; @@ -178,9 +186,11 @@ const priceFrontWipers = this.frontWipersApplicableForTierTwo; const priceRearWipers = this.rearWiperApplicableForTierTwo; this.nullSafeAvailableLineItems.forEach((item) => { - if ((priceFrontWipers && - item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) || - (priceRearWipers && item.partType.toUpperCase() === partTypeStrings.REAR_WIPER)) { + if ( + (priceFrontWipers && + item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) || + (priceRearWipers && item.partType.toUpperCase() === partTypeStrings.REAR_WIPER) + ) { vapsPrice += this.getTotalLineItemPrice(item); } }); @@ -205,6 +215,26 @@ }); return vapsPrice; }, + selectDefaultPackage() { + const vapsFromStore = store.order.lineItems.vaps; + let lowestTierForPackage = packageNames.TIER_ONE; + if (vapsFromStore?.length > 0) { + vapsFromStore.every((vapsItem) => { + let lowestTierForThisItem = this.getLowestTierForThisItem(vapsItem); + if (lowestTierForThisItem === packageNames.TIER_THREE) { + lowestTierForPackage = packageNames.TIER_THREE; + return false; + } else if (lowestTierForThisItem === packageNames.TIER_TWO) { + lowestTierForPackage = packageNames.TIER_TWO; + return true; + } else { + return true; + } + }); + } + this.selectedPackageName = lowestTierForPackage; + }, + getLowestTierForThisItem(vapsItem) { let lowestTierForThisItem = null; switch (vapsItem.partType) { @@ -282,6 +312,37 @@ return null; } }, + allGlassPartsAndItemsHavePrices() { + if (this.pricedGlassParts) { + for (let i = 0; i < this.pricedGlassParts.length; i++) { + if (this.priceIsNullOrZero(this.pricedGlassParts[i])) { + return false; + } + } + } + if (this.supportingItems) { + for (let i = 0; i < this.supportingItems.length; i++) { + if (this.priceIsNullOrZero(this.supportingItems[i])) { + return false; + } + } + } + if (this.selectedVaps) { + for (let i = 0; i < this.selectedVaps.length; i++) { + if (this.priceIsNullOrZero(this.selectedVaps[i])) { + return false; + } + } + } + return true; + }, + priceIsNullOrZero(lineItem) { + return ( + (lineItem.kitPrice == null || lineItem.kitPrice == 0) && + (lineItem.laborAmount == null || lineItem.laborAmount == 0) && + (lineItem.sellingPrice == null || lineItem.sellingPrice == 0) + ); + }, getLineItemsContainingPartType(partType) { const partTypeMatches = this.nullSafeAvailableLineItems.filter( (lineItem) => lineItem.partType.toUpperCase() === partType diff --git a/src/layouts/service-packages/service-packages.vue b/src/layouts/service-packages/service-packages.vue index 1c427ec4..b990f2d0 100644 --- a/src/layouts/service-packages/service-packages.vue +++ b/src/layouts/service-packages/service-packages.vue @@ -134,7 +134,7 @@ this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); }, forwardButtonAction() { - if (!this.allGlassPartsAndItemsHavePrices()) { + if (!this.$ref.servicePackage.allGlassPartsAndItemsHavePrices()) { console.error('One or more items have no price assigned!'); } if (this.pricedGlassParts.length > 0) { @@ -145,37 +145,6 @@ store.saveVaps(this.selectedVaps); this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route); - }, - allGlassPartsAndItemsHavePrices() { - if (this.pricedGlassParts) { - for (let i = 0; i < this.pricedGlassParts.length; i++) { - if (this.priceIsNullOrZero(this.pricedGlassParts[i])) { - return false; - } - } - } - if (this.supportingItems) { - for (let i = 0; i < this.supportingItems.length; i++) { - if (this.priceIsNullOrZero(this.supportingItems[i])) { - return false; - } - } - } - if (this.selectedVaps) { - for (let i = 0; i < this.selectedVaps.length; i++) { - if (this.priceIsNullOrZero(this.selectedVaps[i])) { - return false; - } - } - } - return true; - }, - priceIsNullOrZero(lineItem) { - return ( - (lineItem.kitPrice == null || lineItem.kitPrice == 0) && - (lineItem.laborAmount == null || lineItem.laborAmount == 0) && - (lineItem.sellingPrice == null || lineItem.sellingPrice == 0) - ); } }, components: { diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index fb3fc0bb..f01ff4a4 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -28,7 +28,8 @@ v-model="selectedWindshieldOptions" :hasRepairReplaceConflict="hasRepairReplaceConflict" :hasSplitSingleConflict="hasSplitSingleConflict" - :selectedDamageLocations="selectedDamageLocations" /> + :selectedDamageLocations="selectedDamageLocations" + class="mb-3" /> + :selectedDamageLocations="selectedDamageLocations" class="mb-1"/>
-
+
- +
diff --git a/src/layouts/vehicle-model/vehicle-model.vue b/src/layouts/vehicle-model/vehicle-model.vue index 4fba014f..ca9f8c8c 100644 --- a/src/layouts/vehicle-model/vehicle-model.vue +++ b/src/layouts/vehicle-model/vehicle-model.vue @@ -3,13 +3,13 @@
-
+
- +
diff --git a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.spec.js b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.spec.js index 43f69c74..a95f0c89 100644 --- a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.spec.js +++ b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.spec.js @@ -83,7 +83,7 @@ describe("glass-part-question.vue", () => { }, ], }; - + const { wrapper } = setupMocks(featureListData); //Act @@ -94,7 +94,7 @@ describe("glass-part-question.vue", () => { await wrapper.setData({ selectedTint: "Green Tint" }); // to trigger the computed setter wrapper.vm.selectedPartNumber = "DB12209GTYN"; - + //Assert expect(wrapper.emitted()["update:modelValue"][0]).toEqual([ { partNumber: "DB12209GTYN", color: "Green Tint" }, diff --git a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue index 75609fee..9b1beaec 100644 --- a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue +++ b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue @@ -50,6 +50,7 @@ import { errorMessages } from "@/constants/error-messages"; export default { name: "glass-part-question", + emits: ["update:modelValue"], inheritAttrs: false, data() { return { @@ -117,10 +118,8 @@ export default { return this.modelValue?.partNumber; }, set(newValue) { - this.$emit( - "update:modelValue", - this.partsForSelectedTint.filter((part) => part.partNumber == newValue.value)[0] - ); + const part = this.partsForSelectedTint.filter((part) => part.partNumber == newValue?.value)[0]; + this.$emit("update:modelValue", part); }, }, @@ -181,13 +180,6 @@ export default { return tintSourceObject.src; }, - // Reset selections when tint changes for the same glass to ensure proper selection. - // Also checks if only a single part is present for the tint. - ResetTintAndPartSelections() { - this.selectedPartNumber = null; - this.AutoSelectIfSinglePart(); - }, - AutoSelectIfSinglePart() { if (this.partsForSelectedTint?.length > 0) { @@ -202,6 +194,9 @@ export default { radioInput?.click(); }); } + else { + this.selectedPartNumber = null; + } } }, diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 24413af3..08caf800 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -108,9 +108,7 @@ data() { }, computed: { isForwardActionDisabled() { - return ( - this.selectedGlassPartNumbers.length !== this.PartsFromApi.partsOrQuestions.length - ); + return this.selectedGlassPartNumbers.length !== this.PartsFromApi.partsOrQuestions.length }, selectedGlassPartNumbers() { // Compile all selected parts from the page. diff --git a/src/layouts/vehicle-style/vehicle-style.vue b/src/layouts/vehicle-style/vehicle-style.vue index fa10e553..3a85adea 100644 --- a/src/layouts/vehicle-style/vehicle-style.vue +++ b/src/layouts/vehicle-style/vehicle-style.vue @@ -3,13 +3,13 @@
-
+
- +
diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index fe9b41fa..4fd9c626 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -3,13 +3,13 @@
-
+
- +
diff --git a/src/layouts/vin-lookup/vin-location-information/vin-location-information.vue b/src/layouts/vin-lookup/vin-location-information/vin-location-information.vue index 93d78c50..bec9bcdc 100644 --- a/src/layouts/vin-lookup/vin-location-information/vin-location-information.vue +++ b/src/layouts/vin-lookup/vin-location-information/vin-location-information.vue @@ -1,5 +1,5 @@