Merging
This commit is contained in:
commit
87837f013c
6 changed files with 42 additions and 164 deletions
|
|
@ -380,7 +380,11 @@ export default {
|
|||
},
|
||||
async navigateForward() {
|
||||
if (this.unverified || this.verifiedDeductible) {
|
||||
<<<<<<< HEAD
|
||||
useMainStore().saveSupportingItems(this.supportingItems);
|
||||
=======
|
||||
useMainStore().updateSupportingItems(this.supportingItems);
|
||||
>>>>>>> 24103335eec282fad8ded09087cf8502b0150ad6
|
||||
this.$router.navigate(
|
||||
navigationScenarios.CLICKED_FORWARD,
|
||||
this.$route,
|
||||
|
|
@ -388,9 +392,15 @@ export default {
|
|||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
||||
);
|
||||
} else if (this.verifiedITAC || this.verifiedNoComp) {
|
||||
<<<<<<< HEAD
|
||||
useMainStore().updateIsSafeliteProvider(this.selectedProvider === SAFELITE_PROVIDER);
|
||||
if (this.selectedProvider === SAFELITE_PROVIDER) {
|
||||
useMainStore().saveSupportingItems(this.supportingItems);
|
||||
=======
|
||||
useMainStore().updateIsSafeliteProvider(this.selectedProvider === 'Safelite');
|
||||
if (this.selectedProvider === 'Safelite') {
|
||||
useMainStore().updateSupportingItems(this.supportingItems);
|
||||
>>>>>>> 24103335eec282fad8ded09087cf8502b0150ad6
|
||||
this.$router.navigate(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE,
|
||||
this.$route,
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@ function getShallowMountedComponent(initialData = {}, methodToRun = () => {}) {
|
|||
}
|
||||
});
|
||||
|
||||
// mountOptions.global.mocks["$store"] = store;
|
||||
|
||||
mountOptions.global.stubs = {
|
||||
siteFooter: footerStub,
|
||||
loadingModal: loadingModalStub
|
||||
|
|
@ -337,81 +335,4 @@ describe('schedule-page.vue', () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
||||
});
|
||||
test('for mobile appts, updateSupportingItems should call store action to save supporting items', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = getShallowMountedComponent();
|
||||
wrapper.vm.mainStore.order.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE;
|
||||
wrapper.vm.mobilePremiumAppointmentFee = 14.99;
|
||||
wrapper.vm.selectedTimeSlotInfo.isPremiumAppointment = true;
|
||||
wrapper.vm.mainStore.lineItems.supportingItems = [
|
||||
{
|
||||
partNumber: 'EARLY BIRD',
|
||||
description: null,
|
||||
partType: 'EARLY BIRD',
|
||||
laborAmount: 0,
|
||||
sellingPrice: 0,
|
||||
kitPrice: 0
|
||||
}
|
||||
];
|
||||
const store = useMainStore();
|
||||
|
||||
// Act
|
||||
await wrapper.vm.updateSupportingItems();
|
||||
|
||||
// Assert
|
||||
expect(store.saveSupportingItemsSuppressingStateResetting).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.mainStore.lineItems.supportingItems)
|
||||
.toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
partType: 'EARLY BIRD'
|
||||
})
|
||||
]));
|
||||
});
|
||||
test(
|
||||
'for Inshop appts, updateSupportingItems should call store action to save supporting items WITHOUT the EARLY BIRD supporting item',
|
||||
async () => {
|
||||
// Arrange
|
||||
const { wrapper } = getShallowMountedComponent();
|
||||
wrapper.vm.mainStore.order.serviceLocation.appointmentType = AppointmentTypeStrings.IN_SHOP;
|
||||
wrapper.vm.mobilePremiumAppointmentFee = 14.99;
|
||||
wrapper.vm.selectedTimeSlotInfo.isPremiumAppointment = true;
|
||||
wrapper.vm.mainStore.lineItems.supportingItems = [
|
||||
{
|
||||
partNumber: 'EARLY BIRD',
|
||||
description: null,
|
||||
partType: 'EARLY BIRD',
|
||||
laborAmount: 0,
|
||||
sellingPrice: 0,
|
||||
kitPrice: 0
|
||||
}
|
||||
];
|
||||
const store = useMainStore();
|
||||
|
||||
// Act
|
||||
await wrapper.vm.updateSupportingItems();
|
||||
|
||||
// Assert
|
||||
expect(store.saveSupportingItemsSuppressingStateResetting).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.mainStore.lineItems.supportingItems)
|
||||
.not.toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
partType: 'EARLY BIRD'
|
||||
})
|
||||
]));
|
||||
}
|
||||
);
|
||||
test('if no EARLY BIRD supporting item, then updateSupportingItems should NOT call store action', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = getShallowMountedComponent();
|
||||
wrapper.vm.mainStore.order.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE;
|
||||
wrapper.vm.mobilePremiumAppointmentFee = 14.99;
|
||||
wrapper.vm.selectedTimeSlotInfo.isPremiumAppointment = false;
|
||||
wrapper.vm.mainStore.lineItems.supportingItems = [];
|
||||
const store = useMainStore();
|
||||
// Act
|
||||
await wrapper.vm.updateSupportingItems();
|
||||
|
||||
// Assert
|
||||
expect(store.saveSupportingItemsSuppressingStateResetting).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -291,6 +291,9 @@ export default {
|
|||
}
|
||||
|
||||
return this.selectableDatesData.days?.find((selectableDate) => selectableDate.date === this.selectedDate);
|
||||
},
|
||||
supportingItems() {
|
||||
return useMainStore().lineItems.supportingItems;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -324,7 +327,7 @@ export default {
|
|||
&& ((serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE
|
||||
|| serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP)
|
||||
|| serviceLocation.provider.providerNumber);
|
||||
const supportingItems = useMainStore().lineItems.supportingItems !== null;
|
||||
const supportingItems = this.supportingItems !== null;
|
||||
const damageInfo =
|
||||
useMainStore().order.damage.isRepair
|
||||
|| (useMainStore().order.lineItems?.glassParts != null
|
||||
|
|
@ -360,9 +363,8 @@ export default {
|
|||
return this.mainStore.order.schedule.date;
|
||||
},
|
||||
getSelectedTimeSlotInfo() {
|
||||
const supportingItems = this.getSupportingItems();
|
||||
const isPremiumAppointment =
|
||||
!!supportingItems.filter((lineItem) => lineItem.partType === PREMIUM_FEE_PART_TYPE)
|
||||
!!(this.supportingItems?.filter((lineItem) => lineItem.partType === PREMIUM_FEE_PART_TYPE) ?? [])
|
||||
.length > 0;
|
||||
|
||||
const selectedTimeSlotInfo = {
|
||||
|
|
@ -372,9 +374,6 @@ export default {
|
|||
|
||||
return selectedTimeSlotInfo;
|
||||
},
|
||||
getSupportingItems() {
|
||||
return this.mainStore.lineItems.supportingItems;
|
||||
},
|
||||
timeSlotModalClosed() {
|
||||
// Clear the selectedDate if no timeSlot has been selected
|
||||
if (this.selectedTimeSlotInfo.timeSlot.routeCode == null) {
|
||||
|
|
@ -424,40 +423,7 @@ export default {
|
|||
}
|
||||
return `${hours}:${minutes} ${meridianNotation}`;
|
||||
},
|
||||
updateSupportingItems() {
|
||||
const supportingItems = this.getSupportingItems();
|
||||
|
||||
// if we have a premium fee(early bird), then save/update supporting items
|
||||
if (
|
||||
this.appointmentType === AppointmentTypeStrings.MOBILE
|
||||
&& this.selectedTimeSlotInfo?.isPremiumAppointment
|
||||
) {
|
||||
const premiumFeeIndex = supportingItems.findIndex((item) => item.partType === PREMIUM_FEE_PART_TYPE);
|
||||
|
||||
if (premiumFeeIndex >= 0) {
|
||||
supportingItems[premiumFeeIndex].laborAmount =
|
||||
this.mobilePremiumAppointmentFee.laborAmount;
|
||||
supportingItems[premiumFeeIndex].sellingPrice =
|
||||
this.mobilePremiumAppointmentFee.sellingPrice;
|
||||
supportingItems[premiumFeeIndex].kitPrice =
|
||||
this.mobilePremiumAppointmentFee.kitPrice;
|
||||
} else {
|
||||
supportingItems.push(this.mobilePremiumAppointmentFee);
|
||||
}
|
||||
|
||||
this.mainStore.saveSupportingItemsSuppressingStateResetting(supportingItems);
|
||||
} else {
|
||||
// if it's not a mobile and/or premium early bird, then make sure we remove any that may have been added
|
||||
const removePremiumFeeIndex = supportingItems.findIndex((item) => item.partType === PREMIUM_FEE_PART_TYPE);
|
||||
|
||||
if (removePremiumFeeIndex >= 0) {
|
||||
supportingItems.splice(removePremiumFeeIndex, 1);
|
||||
this.mainStore.saveSupportingItemsSuppressingStateResetting(supportingItems);
|
||||
}
|
||||
}
|
||||
},
|
||||
forwardButtonAction() {
|
||||
this.updateSupportingItems();
|
||||
this.mainStore.saveSchedule(this.selectedTimeSlotInfo.timeSlot);
|
||||
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,13 @@ export default {
|
|||
let hasBailedOut = false;
|
||||
const pricingResults = await store.getPriceOrderItems(availableLineItems)
|
||||
.catch((err) => {
|
||||
useMainStore().setBailout(to, bailoutMessage.pricingResponseError(availableLineItems.map((li) => li.partNumber), { code: err.code, message: err.message, data: err.data }));
|
||||
useMainStore().setBailout(
|
||||
to,
|
||||
bailoutMessage.pricingResponseError(
|
||||
availableLineItems.map((li) => li.partNumber),
|
||||
{ code: err.code, message: err.message, data: err.data }
|
||||
)
|
||||
);
|
||||
hasBailedOut = true;
|
||||
next(`/?issPage=${issPageValues.BAILOUT_PAGE}`);
|
||||
});
|
||||
|
|
@ -179,15 +185,19 @@ export default {
|
|||
this.selectedVaps = vapsItemsSelected;
|
||||
},
|
||||
forwardButtonAction() {
|
||||
const parts = { glassParts: this.pricedGlassParts, supportingItems: this.supportingItems, vaps: this.selectedVaps };
|
||||
const parts = {
|
||||
glassParts: this.pricedGlassParts,
|
||||
supportingItems: this.supportingItems,
|
||||
vaps: this.selectedVaps
|
||||
};
|
||||
if (!allGlassPartsAndItemsHavePrices(parts)) {
|
||||
window.console.error('One or more items have no price assigned!');
|
||||
}
|
||||
if (this.pricedGlassParts.length > 0) {
|
||||
store.saveGlassParts(this.pricedGlassParts);
|
||||
store.updateGlassParts(this.pricedGlassParts);
|
||||
}
|
||||
store.saveSupportingItems(this.supportingItems);
|
||||
store.saveVaps(this.selectedVaps);
|
||||
store.updateSupportingItems(this.supportingItems);
|
||||
store.updateVaps(this.selectedVaps);
|
||||
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ export default {
|
|||
|
||||
if (this.isWindshieldRepair) {
|
||||
const supportingItems = await useMainStore().getSupportingItems();
|
||||
this.mainStore.saveSupportingItems(supportingItems.data);
|
||||
useMainStore().updateSupportingItems(supportingItems.data);
|
||||
}
|
||||
|
||||
if (this.mainStore.damage.isRepair) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import applicationConfig from '@/constants/application-config';
|
|||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import damageLocationsSelected from '@/constants/damage-locations-selected';
|
||||
import coverageStatuses from '@/constants/coverage-statuses';
|
||||
import { AppointmentTypeStrings, PREMIUM_FEE_PART_TYPE } from '@/constants/schedule-constants';
|
||||
import { AppointmentTypeStrings } from '@/constants/schedule-constants';
|
||||
import { convertDateStringToDate, getDateDifferenceInDays, militaryToTwelveHourTime } from '@/helpers/date-helper';
|
||||
import { paymentMethods } from '@/constants/payment-method-constants';
|
||||
import {
|
||||
|
|
@ -947,7 +947,7 @@ export const useMainStore = defineStore({
|
|||
},
|
||||
|
||||
async getSupportingItems() {
|
||||
const glassPartsArray = this.lineItems.glassParts ?? [];
|
||||
const { glassParts } = this.lineItems;
|
||||
const { carId } = this.vehicle;
|
||||
const { isRepair, numberOfChips } = this.damage;
|
||||
const { parentAccountNumber } = this.issConfig;
|
||||
|
|
@ -960,7 +960,7 @@ export const useMainStore = defineStore({
|
|||
carId,
|
||||
damageType: isRepair ? 'Repair' : 'Replace',
|
||||
parentAccountNumber,
|
||||
parts: glassPartsArray,
|
||||
parts: glassParts ?? [],
|
||||
numberOfRepairChips: isRepair ? numberOfChips : 0
|
||||
}
|
||||
});
|
||||
|
|
@ -1472,8 +1472,8 @@ export const useMainStore = defineStore({
|
|||
this.order.originalDeductible = vehicle.deductible;
|
||||
this.order.currentDeductible = vehicle.deductible;
|
||||
|
||||
this.resetSupportingItemsState();
|
||||
this.resetVapsState();
|
||||
this.updateSupportingItems(null);
|
||||
this.updateVaps(null);
|
||||
},
|
||||
|
||||
updateVehicleVin(vin) {
|
||||
|
|
@ -1496,6 +1496,7 @@ export const useMainStore = defineStore({
|
|||
|
||||
resetGlassPartsState() {
|
||||
this.order.lineItems.glassParts = null;
|
||||
this.order.lineItems.supportingItems = null;
|
||||
this.order.damage.partQuestionAnswers = null;
|
||||
this.order.damage.moldingQuestionAnswers = null;
|
||||
this.order.damage.capabilityQuestionAnswers = null;
|
||||
|
|
@ -1511,21 +1512,6 @@ export const useMainStore = defineStore({
|
|||
this.order.schedule.routeCode = null;
|
||||
this.order.schedule.jobMaxMinutes = null;
|
||||
this.order.schedule.jobMinMinutes = null;
|
||||
|
||||
// premium appointment fee used on schedule page also needs reset when schedule is reset
|
||||
const { supportingItems } = this.order.lineItems;
|
||||
const premiumAppointmentFeeIndex = supportingItems?.findIndex((item) => item.partType === PREMIUM_FEE_PART_TYPE);
|
||||
|
||||
if (premiumAppointmentFeeIndex >= 0) {
|
||||
supportingItems.splice(premiumAppointmentFeeIndex, 1);
|
||||
state.order.lineItems.supportingItems = supportingItems;
|
||||
}
|
||||
},
|
||||
resetSupportingItemsState() {
|
||||
this.order.lineItems.supportingItems = null;
|
||||
},
|
||||
resetVapsState() {
|
||||
this.order.lineItems.vaps = null;
|
||||
},
|
||||
resetDamageState() {
|
||||
this.order.damage.isRepair = null;
|
||||
|
|
@ -1685,8 +1671,8 @@ export const useMainStore = defineStore({
|
|||
this.updateGlassParts(null);
|
||||
this.updateMoldingQuestionAnswers(null);
|
||||
this.updateCapabilityQuestionAnswers(null);
|
||||
this.resetSupportingItemsState();
|
||||
this.resetVapsState();
|
||||
this.updateSupportingItems(null);
|
||||
this.updateVaps(null);
|
||||
|
||||
this.updatePageData({ page: issPageValues.VEHICLE_PARTS, data: null });
|
||||
this.updatePageData({ page: issPageValues.MOLDING_QUESTIONS, data: null });
|
||||
|
|
@ -1730,18 +1716,6 @@ export const useMainStore = defineStore({
|
|||
// Save new values
|
||||
this.updateCapabilityQuestionAnswers(capabilityQuestionAnswersArray);
|
||||
},
|
||||
saveGlassParts(glassParts) {
|
||||
this.order.lineItems.glassParts = glassParts;
|
||||
},
|
||||
saveSupportingItems(supportingItems) {
|
||||
this.order.lineItems.supportingItems = supportingItems;
|
||||
},
|
||||
saveSupportingItemsSuppressingStateResetting(supportingItems) {
|
||||
this.order.lineItems.supportingItems = supportingItems;
|
||||
},
|
||||
saveVaps(vaps) {
|
||||
this.order.lineItems.vaps = vaps;
|
||||
},
|
||||
|
||||
// Price order actions
|
||||
async priceOrderItemsAndSaveServerData(availableLineItems, serviceZipCode, serviceZipCodeCtu) {
|
||||
|
|
@ -2110,21 +2084,18 @@ export const useMainStore = defineStore({
|
|||
resetRegistrationAndDependencies() {
|
||||
this.resetRegistrationState();
|
||||
this.resetGlassPartsState();
|
||||
this.resetSupportingItemsState();
|
||||
this.resetVapsState();
|
||||
this.updateVaps(null);
|
||||
},
|
||||
|
||||
resetDamageAndDependencies() {
|
||||
this.resetDamageState();
|
||||
this.resetGlassPartsState();
|
||||
this.resetSupportingItemsState();
|
||||
this.resetVapsState();
|
||||
this.updateVaps(null);
|
||||
},
|
||||
|
||||
resetPartsAndDependencies() {
|
||||
this.resetGlassPartsState();
|
||||
this.resetSupportingItemsState();
|
||||
this.resetVapsState();
|
||||
this.updateVaps(null);
|
||||
|
||||
this.resetServiceLocationAndDependencies();
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue