fix bailout issue, update bailout name
This commit is contained in:
parent
25471d18df
commit
176669e3eb
5 changed files with 134 additions and 196 deletions
|
|
@ -9,7 +9,7 @@ const bailoutCode = Object.freeze({
|
||||||
TPANotEnabled: 7,
|
TPANotEnabled: 7,
|
||||||
RequestCallback: 8,
|
RequestCallback: 8,
|
||||||
HeavyTruckVehicle: 9,
|
HeavyTruckVehicle: 9,
|
||||||
NoPartsAvailable: 10
|
PartDBError: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
export default bailoutCode;
|
export default bailoutCode;
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,8 @@ const bailoutMessage = Object.freeze({
|
||||||
code: bailoutCode.HeavyTruckVehicle,
|
code: bailoutCode.HeavyTruckVehicle,
|
||||||
message: `User selected a heavy truck vehicle. Car ID: ${carId} `
|
message: `User selected a heavy truck vehicle. Car ID: ${carId} `
|
||||||
}),
|
}),
|
||||||
NoPartsAvailable: (error) => ({
|
PartDBError: (error) => ({
|
||||||
code: bailoutCode.NoPartsAvailable,
|
code: bailoutCode.PartDBError,
|
||||||
message: `An error occurred in getPartsOrQuestions. Error: ${getItemData(error)}`
|
message: `An error occurred in getPartsOrQuestions. Error: ${getItemData(error)}`
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ export default {
|
||||||
replaceOptionsQuestion,
|
replaceOptionsQuestion,
|
||||||
// eslint-disable-next-line vue/no-reserved-component-names
|
// eslint-disable-next-line vue/no-reserved-component-names
|
||||||
Form,
|
Form,
|
||||||
alert,
|
alert
|
||||||
},
|
},
|
||||||
mixins: [BaseFormMixin, vehicleQuestionsMixin],
|
mixins: [BaseFormMixin, vehicleQuestionsMixin],
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
|
@ -151,20 +151,18 @@ export default {
|
||||||
|
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||||
const damageOptionsPromise = store.getDamageOptions(
|
const damageOptionsPromise = store.getDamageOptions(store.order.vehicle.carId);
|
||||||
store.order.vehicle.carId
|
|
||||||
);
|
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
resultKey: 'cmsContent',
|
resultKey: 'cmsContent',
|
||||||
promise: cmsContentPromise,
|
promise: cmsContentPromise
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
resultKey: 'damageOptions',
|
resultKey: 'damageOptions',
|
||||||
promise: damageOptionsPromise,
|
promise: damageOptionsPromise
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
@ -172,23 +170,17 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.$refs.damageLocation.initializeComponent(
|
vm.$refs.damageLocation.initializeComponent(resultMap.damageOptions);
|
||||||
resultMap.damageOptions
|
|
||||||
);
|
|
||||||
vm.$refs.sideDoorOptions.initializeComponent(
|
vm.$refs.sideDoorOptions.initializeComponent(
|
||||||
resultMap.damageOptions.driverSideOptions
|
resultMap.damageOptions.driverSideOptions
|
||||||
.availableReplacementOptions,
|
.availableReplacementOptions,
|
||||||
resultMap.damageOptions.passengerSideOptions
|
resultMap.damageOptions.passengerSideOptions
|
||||||
.availableReplacementOptions
|
.availableReplacementOptions
|
||||||
);
|
);
|
||||||
vm.$refs.windshieldOptions.initializeComponent(
|
vm.$refs.windshieldOptions.initializeComponent(resultMap.damageOptions.windshieldOptions
|
||||||
resultMap.damageOptions.windshieldOptions
|
.availableReplacementOptions);
|
||||||
.availableReplacementOptions
|
vm.$refs.backGlassOptions.initializeComponent(resultMap.damageOptions.backGlassOptions
|
||||||
);
|
.availableReplacementOptions);
|
||||||
vm.$refs.backGlassOptions.initializeComponent(
|
|
||||||
resultMap.damageOptions.backGlassOptions
|
|
||||||
.availableReplacementOptions
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
|
@ -204,7 +196,7 @@ export default {
|
||||||
selectedDriverSideReplaceOptions:
|
selectedDriverSideReplaceOptions:
|
||||||
this.getDriverSideReplaceOptionsFromStore(),
|
this.getDriverSideReplaceOptionsFromStore(),
|
||||||
selectedPassengerSideReplaceOptions:
|
selectedPassengerSideReplaceOptions:
|
||||||
this.getPassengerSideReplaceOptionsFromStore(),
|
this.getPassengerSideReplaceOptionsFromStore()
|
||||||
},
|
},
|
||||||
selectedWindshieldOptions: this.getWindshieldOptionsFromStore(),
|
selectedWindshieldOptions: this.getWindshieldOptionsFromStore(),
|
||||||
selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(),
|
selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(),
|
||||||
|
|
@ -213,83 +205,66 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isWindshieldDamageLocation() {
|
isWindshieldDamageLocation() {
|
||||||
return this.selectedDamageLocations.some(
|
return this.selectedDamageLocations.some((selectedDamages) =>
|
||||||
(selectedDamages) =>
|
selectedDamages.toUpperCase()
|
||||||
selectedDamages.toUpperCase() ===
|
=== damageLocationsCms.WINDSHIELD);
|
||||||
damageLocationsCms.WINDSHIELD
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
isSideDoorDamageLocation() {
|
isSideDoorDamageLocation() {
|
||||||
return this.selectedDamageLocations.some(
|
return this.selectedDamageLocations.some((selectedDamages) =>
|
||||||
(selectedDamages) =>
|
selectedDamages.toUpperCase()
|
||||||
selectedDamages.toUpperCase() ===
|
=== damageLocationsCms.SIDEDOOR);
|
||||||
damageLocationsCms.SIDEDOOR
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
isRearWindowDamageLocation() {
|
isRearWindowDamageLocation() {
|
||||||
return this.selectedDamageLocations.some(
|
return this.selectedDamageLocations.some((selectedDamages) =>
|
||||||
(selectedDamages) =>
|
selectedDamages.toUpperCase()
|
||||||
selectedDamages.toUpperCase() ===
|
=== damageLocationsCms.REARWINDOW);
|
||||||
damageLocationsCms.REARWINDOW
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
isWindshieldRepair() {
|
isWindshieldRepair() {
|
||||||
return (
|
return (
|
||||||
this.isWindshieldDamageLocation &&
|
this.isWindshieldDamageLocation
|
||||||
this.selectedWindshieldOptions.selectedWindshieldDamageType ===
|
&& this.selectedWindshieldOptions.selectedWindshieldDamageType
|
||||||
damageLocationsSelected.REPAIR
|
=== damageLocationsSelected.REPAIR
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
isDriverSideReplace() {
|
isDriverSideReplace() {
|
||||||
if (!this.isSideDoorDamageLocation) return false;
|
if (!this.isSideDoorDamageLocation) return false;
|
||||||
|
|
||||||
return this.sideDoorOptionsData.selectedDoorSides.some(
|
return this.sideDoorOptionsData.selectedDoorSides.some((selectedDriverSide) =>
|
||||||
(selectedDriverSide) =>
|
selectedDriverSide.toUpperCase()
|
||||||
selectedDriverSide.toUpperCase() ===
|
=== damageLocationsCms.DRIVERSIDE);
|
||||||
damageLocationsCms.DRIVERSIDE
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
isPassengerSideReplace() {
|
isPassengerSideReplace() {
|
||||||
if (!this.isSideDoorDamageLocation) return false;
|
if (!this.isSideDoorDamageLocation) return false;
|
||||||
|
|
||||||
return this.sideDoorOptionsData.selectedDoorSides.some(
|
return this.sideDoorOptionsData.selectedDoorSides.some((selectedPassengerSide) =>
|
||||||
(selectedPassengerSide) =>
|
selectedPassengerSide.toUpperCase()
|
||||||
selectedPassengerSide.toUpperCase() ===
|
=== damageLocationsCms.PASSENGERSIDE);
|
||||||
damageLocationsCms.PASSENGERSIDE
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
hasRepairReplaceConflict() {
|
hasRepairReplaceConflict() {
|
||||||
return (
|
return (
|
||||||
this.isWindshieldDamageLocation &&
|
this.isWindshieldDamageLocation
|
||||||
this.selectedDamageLocations.length > 1 &&
|
&& this.selectedDamageLocations.length > 1
|
||||||
this.isWindshieldRepair
|
&& this.isWindshieldRepair
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
hasSplitSingleConflict() {
|
hasSplitSingleConflict() {
|
||||||
if (
|
if (
|
||||||
!this.selectedDamageLocations?.includes('Windshield') ||
|
!this.selectedDamageLocations?.includes('Windshield')
|
||||||
this.selectedWindshieldOptions.selectedWindshieldDamageType ===
|
|| this.selectedWindshieldOptions.selectedWindshieldDamageType
|
||||||
damageLocationsSelected.REPAIR ||
|
=== damageLocationsSelected.REPAIR
|
||||||
!this.selectedWindshieldOptions.selectedWindshieldReplaceOptions
|
|| !this.selectedWindshieldOptions.selectedWindshieldReplaceOptions
|
||||||
)
|
) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some((selectedSingleWindshield) =>
|
||||||
(selectedSingleWindshield) =>
|
selectedSingleWindshield.toUpperCase()
|
||||||
selectedSingleWindshield.toUpperCase() ===
|
=== damageLocationsSelected.SINGLE.toUpperCase())
|
||||||
damageLocationsSelected.SINGLE.toUpperCase()
|
&& (this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some((selectedDriverWindshield) =>
|
||||||
) &&
|
selectedDriverWindshield.toUpperCase()
|
||||||
(this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
=== damageLocationsSelected.DRIVER.toUpperCase())
|
||||||
(selectedDriverWindshield) =>
|
|| this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some((selectedPassengerWindshield) =>
|
||||||
selectedDriverWindshield.toUpperCase() ===
|
selectedPassengerWindshield.toUpperCase()
|
||||||
damageLocationsSelected.DRIVER.toUpperCase()
|
=== damageLocationsSelected.PASSENGER.toUpperCase()))
|
||||||
) ||
|
|
||||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
|
||||||
(selectedPassengerWindshield) =>
|
|
||||||
selectedPassengerWindshield.toUpperCase() ===
|
|
||||||
damageLocationsSelected.PASSENGER.toUpperCase()
|
|
||||||
))
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
shouldDisplayVehicleChangeAlert() {
|
shouldDisplayVehicleChangeAlert() {
|
||||||
|
|
@ -309,32 +284,26 @@ export default {
|
||||||
const glassSelections = [];
|
const glassSelections = [];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.mainStore.order.damage.glassToReplace?.some(
|
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||||
(glass) =>
|
glass.glassLocation
|
||||||
glass.glassLocation ===
|
=== damageLocationsSelected.WINDSHIELD)
|
||||||
damageLocationsSelected.WINDSHIELD
|
|| this.mainStore.order.damage.isRepair
|
||||||
) ||
|
|
||||||
this.mainStore.order.damage.isRepair
|
|
||||||
) {
|
) {
|
||||||
glassSelections.push(damageLocationsSelected.WINDSHIELD);
|
glassSelections.push(damageLocationsSelected.WINDSHIELD);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.mainStore.order.damage.glassToReplace?.some(
|
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||||
(glass) =>
|
glass.glassLocation
|
||||||
glass.glassLocation ===
|
=== damageLocationsSelected.DRIVER
|
||||||
damageLocationsSelected.DRIVER ||
|
|| glass.glassLocation
|
||||||
glass.glassLocation ===
|
=== damageLocationsSelected.PASSENGER)
|
||||||
damageLocationsSelected.PASSENGER
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
glassSelections.push(damageLocationsSelected.SIDEDOOR);
|
glassSelections.push(damageLocationsSelected.SIDEDOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.mainStore.order.damage.glassToReplace?.some(
|
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||||
(glass) =>
|
glass.glassLocation === damageLocationsSelected.REAR)
|
||||||
glass.glassLocation === damageLocationsSelected.REAR
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
glassSelections.push(damageLocationsSelected.REARWINDOW);
|
glassSelections.push(damageLocationsSelected.REARWINDOW);
|
||||||
}
|
}
|
||||||
|
|
@ -345,11 +314,10 @@ export default {
|
||||||
const windShieldOptions = {
|
const windShieldOptions = {
|
||||||
selectedWindshieldDamageType: '',
|
selectedWindshieldDamageType: '',
|
||||||
selectedWindshieldChipCount: null,
|
selectedWindshieldChipCount: null,
|
||||||
selectedWindshieldReplaceOptions: [],
|
selectedWindshieldReplaceOptions: []
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.mainStore.order.damage.isRepair === undefined)
|
if (this.mainStore.order.damage.isRepair === undefined) return windshieldOptions;
|
||||||
return windshieldOptions;
|
|
||||||
|
|
||||||
if (this.mainStore.order.damage.isRepair) {
|
if (this.mainStore.order.damage.isRepair) {
|
||||||
windShieldOptions.selectedWindshieldDamageType =
|
windShieldOptions.selectedWindshieldDamageType =
|
||||||
|
|
@ -358,49 +326,37 @@ export default {
|
||||||
this.mainStore.order.damage.numberOfChips;
|
this.mainStore.order.damage.numberOfChips;
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
this.mainStore.order.damage.glassToReplace?.some(
|
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||||
(glass) =>
|
glass.glassLocation
|
||||||
glass.glassLocation ===
|
=== damageLocationsSelected.WINDSHIELD
|
||||||
damageLocationsSelected.WINDSHIELD &&
|
&& glass.glassName === damageLocationsSelected.SINGLE)
|
||||||
glass.glassName === damageLocationsSelected.SINGLE
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
windShieldOptions.selectedWindshieldDamageType =
|
windShieldOptions.selectedWindshieldDamageType =
|
||||||
damageLocationsSelected.REPLACE;
|
damageLocationsSelected.REPLACE;
|
||||||
windShieldOptions.selectedWindshieldReplaceOptions.push(
|
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.SINGLE);
|
||||||
damageLocationsSelected.SINGLE
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.mainStore.order.damage.glassToReplace?.some(
|
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||||
(glass) =>
|
glass.glassLocation
|
||||||
glass.glassLocation ===
|
=== damageLocationsSelected.WINDSHIELD
|
||||||
damageLocationsSelected.WINDSHIELD &&
|
&& glass.glassName === damageLocationsSelected.DRIVER)
|
||||||
glass.glassName === damageLocationsSelected.DRIVER
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
windShieldOptions.selectedWindshieldDamageType =
|
windShieldOptions.selectedWindshieldDamageType =
|
||||||
damageLocationsSelected.REPLACE;
|
damageLocationsSelected.REPLACE;
|
||||||
windShieldOptions.selectedWindshieldReplaceOptions.push(
|
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.DRIVER);
|
||||||
damageLocationsSelected.DRIVER
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.mainStore.order.damage.glassToReplace?.some(
|
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||||
(glass) =>
|
glass.glassLocation
|
||||||
glass.glassLocation ===
|
=== damageLocationsSelected.WINDSHIELD
|
||||||
damageLocationsSelected.WINDSHIELD &&
|
&& glass.glassName
|
||||||
glass.glassName ===
|
=== damageLocationsSelected.PASSENGER)
|
||||||
damageLocationsSelected.PASSENGER
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
windShieldOptions.selectedWindshieldDamageType =
|
windShieldOptions.selectedWindshieldDamageType =
|
||||||
damageLocationsSelected.REPLACE;
|
damageLocationsSelected.REPLACE;
|
||||||
windShieldOptions.selectedWindshieldReplaceOptions.push(
|
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.PASSENGER);
|
||||||
damageLocationsSelected.PASSENGER
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,20 +365,16 @@ export default {
|
||||||
getDoorSidesFromStore() {
|
getDoorSidesFromStore() {
|
||||||
const doorSides = [];
|
const doorSides = [];
|
||||||
if (
|
if (
|
||||||
this.mainStore.order.damage.glassToReplace?.some(
|
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||||
(glass) =>
|
glass.glassLocation === damageLocationsSelected.DRIVER)
|
||||||
glass.glassLocation === damageLocationsSelected.DRIVER
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
doorSides.push(damageLocationsSelected.DRIVERSIDE);
|
doorSides.push(damageLocationsSelected.DRIVERSIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.mainStore.order.damage.glassToReplace?.some(
|
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||||
(glass) =>
|
glass.glassLocation
|
||||||
glass.glassLocation ===
|
=== damageLocationsSelected.PASSENGER)
|
||||||
damageLocationsSelected.PASSENGER
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
doorSides.push(damageLocationsSelected.PASSENGERSIDE);
|
doorSides.push(damageLocationsSelected.PASSENGERSIDE);
|
||||||
}
|
}
|
||||||
|
|
@ -453,10 +405,8 @@ export default {
|
||||||
},
|
},
|
||||||
getRearReplaceOptionsFromStore() {
|
getRearReplaceOptionsFromStore() {
|
||||||
const rearReplaceOptions =
|
const rearReplaceOptions =
|
||||||
this.mainStore.order.damage.glassToReplace?.filter(
|
this.mainStore.order.damage.glassToReplace?.filter((glass) =>
|
||||||
(glass) =>
|
glass.glassLocation === damageLocationsSelected.REAR)[0]?.glassName;
|
||||||
glass.glassLocation === damageLocationsSelected.REAR
|
|
||||||
)[0]?.glassName;
|
|
||||||
|
|
||||||
return rearReplaceOptions;
|
return rearReplaceOptions;
|
||||||
},
|
},
|
||||||
|
|
@ -483,7 +433,7 @@ export default {
|
||||||
|
|
||||||
const partsOrQuestionsResponse = await this.getPartsOrQuestions();
|
const partsOrQuestionsResponse = await this.getPartsOrQuestions();
|
||||||
if (partsOrQuestionsResponse.error) {
|
if (partsOrQuestionsResponse.error) {
|
||||||
this.mainStore.setBailout(bailoutMessage.NoPartsAvailable(partsOrQuestionsResponse.error.data));
|
this.mainStore.setBailout(bailoutMessage.PartDBError(partsOrQuestionsResponse.error.data));
|
||||||
window.console.error('Error on retrieving PartsOrQuestions');
|
window.console.error('Error on retrieving PartsOrQuestions');
|
||||||
this.$refs.siteFooter.removeLoader();
|
this.$refs.siteFooter.removeLoader();
|
||||||
this.hasBailedOut = true;
|
this.hasBailedOut = true;
|
||||||
|
|
@ -512,48 +462,42 @@ export default {
|
||||||
selectedGlassToReplace() {
|
selectedGlassToReplace() {
|
||||||
const selectedGlassToReplace = [];
|
const selectedGlassToReplace = [];
|
||||||
if (this.isWindshieldDamageLocation && !this.isWindshieldRepair) {
|
if (this.isWindshieldDamageLocation && !this.isWindshieldRepair) {
|
||||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.forEach(
|
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.forEach((wsItem) => {
|
||||||
(wsItem) => {
|
selectedGlassToReplace.push({
|
||||||
selectedGlassToReplace.push({
|
glassLocation: damageLocationsSelected.WINDSHIELD,
|
||||||
glassLocation: damageLocationsSelected.WINDSHIELD,
|
glassName: wsItem
|
||||||
glassName: wsItem,
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isDriverSideReplace) {
|
if (this.isDriverSideReplace) {
|
||||||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.forEach(
|
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.forEach((driverItem) => {
|
||||||
(driverItem) => {
|
selectedGlassToReplace.push({
|
||||||
selectedGlassToReplace.push({
|
glassLocation: damageLocationsSelected.DRIVER,
|
||||||
glassLocation: damageLocationsSelected.DRIVER,
|
glassName: driverItem
|
||||||
glassName: driverItem,
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isPassengerSideReplace) {
|
if (this.isPassengerSideReplace) {
|
||||||
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.forEach(
|
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.forEach((passengerItem) => {
|
||||||
(passengerItem) => {
|
selectedGlassToReplace.push({
|
||||||
selectedGlassToReplace.push({
|
glassLocation: damageLocationsSelected.PASSENGER,
|
||||||
glassLocation: damageLocationsSelected.PASSENGER,
|
glassName: passengerItem
|
||||||
glassName: passengerItem,
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isRearWindowDamageLocation) {
|
if (this.isRearWindowDamageLocation) {
|
||||||
selectedGlassToReplace.push({
|
selectedGlassToReplace.push({
|
||||||
glassLocation: damageLocationsSelected.REAR,
|
glassLocation: damageLocationsSelected.REAR,
|
||||||
glassName: this.selectedRearReplaceOptions,
|
glassName: this.selectedRearReplaceOptions
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return selectedGlassToReplace;
|
return selectedGlassToReplace;
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,12 +74,12 @@ export default {
|
||||||
vehicleBanner,
|
vehicleBanner,
|
||||||
vinLocationInformation,
|
vinLocationInformation,
|
||||||
vinLookupAlerts,
|
vinLookupAlerts,
|
||||||
vinQuestion,
|
vinQuestion
|
||||||
},
|
},
|
||||||
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
||||||
provide() {
|
provide() {
|
||||||
return {
|
return {
|
||||||
vehicleFromLookup: computed(() => this.vehicleFromLookup),
|
vehicleFromLookup: computed(() => this.vehicleFromLookup)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
|
@ -89,8 +89,8 @@ export default {
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
resultKey: 'cmsContent',
|
resultKey: 'cmsContent',
|
||||||
promise: cmsContentPromise,
|
promise: cmsContentPromise
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
@ -123,9 +123,9 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
isCarIdDifferentFromTheStore() {
|
isCarIdDifferentFromTheStore() {
|
||||||
return (
|
return (
|
||||||
this.vehicleFromLookup !== null &&
|
this.vehicleFromLookup !== null
|
||||||
this.hasValidCarId() &&
|
&& this.hasValidCarId()
|
||||||
this.vehicleFromLookup.carId !== this.mainStore.vehicle.carId
|
&& this.vehicleFromLookup.carId !== this.mainStore.vehicle.carId
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
isTwoIdenticalYMMVehicleFound() {
|
isTwoIdenticalYMMVehicleFound() {
|
||||||
|
|
@ -157,10 +157,8 @@ export default {
|
||||||
this.resetActiveAlert();
|
this.resetActiveAlert();
|
||||||
this.$refs.siteFooter.enableForwardAction();
|
this.$refs.siteFooter.enableForwardAction();
|
||||||
this.needToLookupVehicle = true;
|
this.needToLookupVehicle = true;
|
||||||
this.$refs.siteFooter.updateButtonText(
|
this.$refs.siteFooter.updateButtonText(this.getCmsContent('SiteFooterWidget', 'ForwardButtonText'));
|
||||||
this.getCmsContent('SiteFooterWidget', 'ForwardButtonText')
|
}
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisiteValid() {
|
arePagePrerequisiteValid() {
|
||||||
|
|
@ -171,8 +169,8 @@ export default {
|
||||||
},
|
},
|
||||||
hasValidCarId() {
|
hasValidCarId() {
|
||||||
return (
|
return (
|
||||||
this.mainStore.vehicle.carId &&
|
this.mainStore.vehicle.carId
|
||||||
this.mainStore.vehicle.carId !== '0'
|
&& this.mainStore.vehicle.carId !== '0'
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// NOTE: If form is not valid, this method is not called when 'Continue' button is clicked
|
// NOTE: If form is not valid, this method is not called when 'Continue' button is clicked
|
||||||
|
|
@ -182,16 +180,12 @@ export default {
|
||||||
this.$refs.siteFooter.enableForwardAction();
|
this.$refs.siteFooter.enableForwardAction();
|
||||||
|
|
||||||
if (this.needToLookupVehicle) {
|
if (this.needToLookupVehicle) {
|
||||||
const vehicleLookupResponse = await this.lookupVehicleByVin(
|
const vehicleLookupResponse = await this.lookupVehicleByVin(this.vin);
|
||||||
this.vin
|
|
||||||
);
|
|
||||||
|
|
||||||
if (vehicleLookupResponse.error) {
|
if (vehicleLookupResponse.error) {
|
||||||
this.activeVehicleLookupAlertType =
|
this.activeVehicleLookupAlertType =
|
||||||
vehicleLookupAlertTypes.NOT_FOUND;
|
vehicleLookupAlertTypes.NOT_FOUND;
|
||||||
this.mainStore.setBailout(
|
this.mainStore.setBailout(bailoutMessage.vehicleNotFound(this.vin));
|
||||||
bailoutMessage.vehicleNotFound(this.vin)
|
|
||||||
);
|
|
||||||
this.resetVehicleFromLookup();
|
this.resetVehicleFromLookup();
|
||||||
this.$refs.siteFooter.removeLoader();
|
this.$refs.siteFooter.removeLoader();
|
||||||
// Temp solution to turn on 'disabled' style on the Continue button
|
// Temp solution to turn on 'disabled' style on the Continue button
|
||||||
|
|
@ -207,7 +201,7 @@ export default {
|
||||||
this.vehicleFromLookup = Object.assign(
|
this.vehicleFromLookup = Object.assign(
|
||||||
vehicleLookupResponse.data,
|
vehicleLookupResponse.data,
|
||||||
{
|
{
|
||||||
vin: this.vin,
|
vin: this.vin
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -225,9 +219,7 @@ export default {
|
||||||
const vehicleYearMakeModelStyle =
|
const vehicleYearMakeModelStyle =
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
`${this.vehicleFromLookup.year} ${this.vehicleFromLookup.make} ${this.vehicleFromLookup.model} ${this.forwardButtonCarStyle}`;
|
`${this.vehicleFromLookup.year} ${this.vehicleFromLookup.make} ${this.vehicleFromLookup.model} ${this.forwardButtonCarStyle}`;
|
||||||
this.$refs.siteFooter.updateButtonText(
|
this.$refs.siteFooter.updateButtonText(`Continue with ${vehicleYearMakeModelStyle}`);
|
||||||
`Continue with ${vehicleYearMakeModelStyle}`
|
|
||||||
);
|
|
||||||
this.$refs.siteFooter.removeLoader();
|
this.$refs.siteFooter.removeLoader();
|
||||||
|
|
||||||
this.needToLookupVehicle = false;
|
this.needToLookupVehicle = false;
|
||||||
|
|
@ -238,15 +230,13 @@ export default {
|
||||||
let isSelectedGlassAvailableForVehicle = true;
|
let isSelectedGlassAvailableForVehicle = true;
|
||||||
if (this.isCarIdDifferentFromTheStore) {
|
if (this.isCarIdDifferentFromTheStore) {
|
||||||
isSelectedGlassAvailableForVehicle =
|
isSelectedGlassAvailableForVehicle =
|
||||||
await isGlassAvailableForCarId(
|
await isGlassAvailableForCarId(this.vehicleFromLookup.carId);
|
||||||
this.vehicleFromLookup.carId
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// navigate back to vehicle-damage
|
// navigate back to vehicle-damage
|
||||||
if (
|
if (
|
||||||
this.isCarIdDifferentFromTheStore &&
|
this.isCarIdDifferentFromTheStore
|
||||||
!isSelectedGlassAvailableForVehicle
|
&& !isSelectedGlassAvailableForVehicle
|
||||||
) {
|
) {
|
||||||
this.mainStore.updateVehicle(this.vehicleFromLookup);
|
this.mainStore.updateVehicle(this.vehicleFromLookup);
|
||||||
this.mainStore.resetDamageState();
|
this.mainStore.resetDamageState();
|
||||||
|
|
@ -276,7 +266,7 @@ export default {
|
||||||
|
|
||||||
const partsOrQuestionsResponse = await this.getPartsOrQuestions();
|
const partsOrQuestionsResponse = await this.getPartsOrQuestions();
|
||||||
if (partsOrQuestionsResponse.error) {
|
if (partsOrQuestionsResponse.error) {
|
||||||
this.mainStore.setBailout(bailoutMessage.NoPartsAvailable(partsOrQuestionsResponse.error.data));
|
this.mainStore.setBailout(bailoutMessage.PartDBError(partsOrQuestionsResponse.error.data));
|
||||||
window.console.error('Error on retrieving PartsOrQuestions');
|
window.console.error('Error on retrieving PartsOrQuestions');
|
||||||
this.$refs.siteFooter.removeLoader();
|
this.$refs.siteFooter.removeLoader();
|
||||||
this.hasBailedOut = true;
|
this.hasBailedOut = true;
|
||||||
|
|
@ -300,8 +290,8 @@ export default {
|
||||||
} catch (responseError) {
|
} catch (responseError) {
|
||||||
return {
|
return {
|
||||||
error: {
|
error: {
|
||||||
status: responseError.status,
|
status: responseError.status
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -311,7 +301,7 @@ export default {
|
||||||
resetVehicleFromLookup() {
|
resetVehicleFromLookup() {
|
||||||
this.vehicleFromLookup = null;
|
this.vehicleFromLookup = null;
|
||||||
},
|
},
|
||||||
resetDependentState() {},
|
resetDependentState() {}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@ const routingTable = () => [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
||||||
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
|
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||||
|
destinationIssPageValue: issPageValues.BAILOUT_PAGE
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue