diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index ff5cb0e35..a7a8ed89a 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -2,10 +2,57 @@
+ - -
+ + + + + + +
+ +
+ + +
+ + + +
+ + + +
+ + +
+ { vm.setCmsContent(resultMap.cmsContent); + vm.pricedGlassParts = clonedGlassParts; + vm.supportingItems = resultMap.supportingItems; + vm.availableLineItems = pricingResults; + vm.isInsuranceSelected = vm.getDefaultIsInsuranceSelectedValue(vm.availableLineItems); }); }, data() { - return {}; + return { + isInsuranceSelected: null, + selectedVaps: null, + availableLineItems: null, + supportingItems: null, + pricedGlassParts: null, + }; }, methods: { arePagePrerequisitesValid() { - // TODO - return true; + return ( + store.getters.order.serviceLocation.zipCode && + store.getters.order.serviceLocation.zipCodeCtu && + (store.getters.order.damage.isRepair || + (store.getters.order.lineItems?.glassParts != null && + store.getters.order.lineItems.glassParts.length > 0)) && + store.getters.order.referralNumber?.length !== 6 + ); + }, + getDefaultIsInsuranceSelectedValue(availableLineItems) { + // Override if coming back from QuoteDetails. Remove override after Quote release + const isInsuranceOverrideValue = this.$route.query?.isInsurance; + + const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance; + if (isInsuranceOverrideValue != null) { + return isInsuranceOverrideValue == "true"; + } else if (defaultIsInsuranceSelectedValue != null) { + return defaultIsInsuranceSelectedValue; + } else { + return availableLineItems + ? baseMixin.methods.getTierOnePackagePrice( + baseMixin.methods.filterOutFees(availableLineItems) + ) > 300 + : null; + } + }, + vapsItemsSelectedAction(vapsItemsSelected) { + this.selectedVaps = vapsItemsSelected; + }, + backButtonAction() { + vehicleQuestionsMixin.methods.navigateBack(this); + }, + forwardButtonAction() { + this.dispatchStoreAction( + this.storeActions.SAVE_PAYMENT_TYPE, + this.isInsuranceSelected, + false + ); + + if (!this.isInsuranceSelected) { + this.dispatchStoreAction( + this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER, + applicationConfig.CASH_PARENT_ACCOUNT_NUMBER, + false + ); + } + + if ( + this.$store.getters.order.payment.parentAccountNumber != + applicationConfig.CASH_PARENT_ACCOUNT_NUMBER + ) { + this.supportingItems = this.filterOutFees(this.supportingItems); + } + + if (this.pricedGlassParts.length > 0) { + this.dispatchStoreAction( + this.storeActions.SAVE_GLASS_PART_PRICES, + this.pricedGlassParts, + false + ); + } + + this.dispatchStoreAction( + this.storeActions.SAVE_SUPPORTING_ITEMS, + this.supportingItems, + false + ); + + this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.selectedVaps, false); + + const payment = this.$store.getters.payment; + if (payment.isInsurance) { + navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal }); + } else { + this.$router.navigateWithSaving( + this.navigationScenarios.CLICKED_FORWARD_WITH_CASH, + this.$route + ); + } }, - backButtonAction() {}, - forwardButtonAction() {}, }, components: { funnelHeader, funnelFooter, + vehicleBanner, funnelSubHeader, Form, + loadingModal, }, }; - - +