CSR-1144
Save premium early bird appointment into supporting items
This commit is contained in:
parent
5dd68049a2
commit
af8db1c343
1 changed files with 33 additions and 2 deletions
|
|
@ -73,7 +73,7 @@ import {
|
||||||
getRouterLinkRouteFromCopy,
|
getRouterLinkRouteFromCopy,
|
||||||
getRouterLinkDisplayTextFromCopy,
|
getRouterLinkDisplayTextFromCopy,
|
||||||
} from "@/helpers/cms-content-helper";
|
} from "@/helpers/cms-content-helper";
|
||||||
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
import { AppointmentTypeStrings, PREMIUM_FEE_PART_TYPE } from "@/constants/schedule-constants";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import { required } from "@/helpers/validation-rules";
|
import { required } from "@/helpers/validation-rules";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
|
@ -341,7 +341,8 @@ export default {
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
forwardButtonAction() {
|
||||||
|
this.updateSupportingItems();
|
||||||
this.dispatchStoreAction(
|
this.dispatchStoreAction(
|
||||||
this.storeActions.SAVE_SCHEDULE,
|
this.storeActions.SAVE_SCHEDULE,
|
||||||
this.appointmentDateAndTime,
|
this.appointmentDateAndTime,
|
||||||
|
|
@ -349,6 +350,36 @@ export default {
|
||||||
);
|
);
|
||||||
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
|
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateSupportingItems() {
|
||||||
|
// if we have a premium fee(early bird), then save/update supporting items
|
||||||
|
if (
|
||||||
|
this.appointmentType === AppointmentTypeStrings.MOBILE &&
|
||||||
|
this.selectedTimeSlotData?.isPremiumAppointment > 0
|
||||||
|
) {
|
||||||
|
const supportingItems = store.getters.lineItems.supportingItems;
|
||||||
|
const earlyBirdIndex = supportingItems.findIndex(
|
||||||
|
(item) => item.partNumber == PREMIUM_FEE_PART_TYPE
|
||||||
|
);
|
||||||
|
|
||||||
|
if (earlyBirdIndex >= 0) {
|
||||||
|
supportingItems[earlyBirdIndex].laborAmount =
|
||||||
|
this.mobilePremiumAppointmentFee.laborAmount;
|
||||||
|
supportingItems[earlyBirdIndex].selingPrice =
|
||||||
|
this.mobilePremiumAppointmentFee.selingPrice;
|
||||||
|
supportingItems[earlyBirdIndex].kitPrice =
|
||||||
|
this.mobilePremiumAppointmentFee.kitPrice;
|
||||||
|
} else {
|
||||||
|
supportingItems.push(this.mobilePremiumAppointmentFee);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dispatchStoreAction(
|
||||||
|
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
||||||
|
supportingItems,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectedDate(newValue, oldValue) {
|
selectedDate(newValue, oldValue) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue