Merge pull request #668 from Safelite/SSR-1201-spacing-updates
Code format.
This commit is contained in:
commit
2d2437890a
1 changed files with 103 additions and 159 deletions
|
|
@ -143,7 +143,7 @@ export default {
|
|||
replaceOptionsQuestion,
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
Form,
|
||||
alert,
|
||||
alert
|
||||
},
|
||||
mixins: [BaseFormMixin, vehicleQuestionsMixin],
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
|
|
@ -151,20 +151,18 @@ export default {
|
|||
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
const damageOptionsPromise = store.getDamageOptions(
|
||||
store.order.vehicle.carId
|
||||
);
|
||||
const damageOptionsPromise = store.getDamageOptions(store.order.vehicle.carId);
|
||||
|
||||
// Settle promises and get results
|
||||
const promiseResultMap = [
|
||||
{
|
||||
resultKey: 'cmsContent',
|
||||
promise: cmsContentPromise,
|
||||
promise: cmsContentPromise
|
||||
},
|
||||
{
|
||||
resultKey: 'damageOptions',
|
||||
promise: damageOptionsPromise,
|
||||
},
|
||||
promise: damageOptionsPromise
|
||||
}
|
||||
];
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
|
@ -172,23 +170,17 @@ export default {
|
|||
// Call the "next" function to complete the transition to this page.
|
||||
next((vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
vm.$refs.damageLocation.initializeComponent(
|
||||
resultMap.damageOptions
|
||||
);
|
||||
vm.$refs.damageLocation.initializeComponent(resultMap.damageOptions);
|
||||
vm.$refs.sideDoorOptions.initializeComponent(
|
||||
resultMap.damageOptions.driverSideOptions
|
||||
.availableReplacementOptions,
|
||||
resultMap.damageOptions.passengerSideOptions
|
||||
.availableReplacementOptions
|
||||
);
|
||||
vm.$refs.windshieldOptions.initializeComponent(
|
||||
resultMap.damageOptions.windshieldOptions
|
||||
.availableReplacementOptions
|
||||
);
|
||||
vm.$refs.backGlassOptions.initializeComponent(
|
||||
resultMap.damageOptions.backGlassOptions
|
||||
.availableReplacementOptions
|
||||
);
|
||||
vm.$refs.windshieldOptions.initializeComponent(resultMap.damageOptions.windshieldOptions
|
||||
.availableReplacementOptions);
|
||||
vm.$refs.backGlassOptions.initializeComponent(resultMap.damageOptions.backGlassOptions
|
||||
.availableReplacementOptions);
|
||||
});
|
||||
},
|
||||
setup() {
|
||||
|
|
@ -204,7 +196,7 @@ export default {
|
|||
selectedDriverSideReplaceOptions:
|
||||
this.getDriverSideReplaceOptionsFromStore(),
|
||||
selectedPassengerSideReplaceOptions:
|
||||
this.getPassengerSideReplaceOptionsFromStore(),
|
||||
this.getPassengerSideReplaceOptionsFromStore()
|
||||
},
|
||||
selectedWindshieldOptions: this.getWindshieldOptionsFromStore(),
|
||||
selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(),
|
||||
|
|
@ -213,83 +205,66 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
isWindshieldDamageLocation() {
|
||||
return this.selectedDamageLocations.some(
|
||||
(selectedDamages) =>
|
||||
selectedDamages.toUpperCase() ===
|
||||
damageLocationsCms.WINDSHIELD
|
||||
);
|
||||
return this.selectedDamageLocations.some((selectedDamages) =>
|
||||
selectedDamages.toUpperCase()
|
||||
=== damageLocationsCms.WINDSHIELD);
|
||||
},
|
||||
isSideDoorDamageLocation() {
|
||||
return this.selectedDamageLocations.some(
|
||||
(selectedDamages) =>
|
||||
selectedDamages.toUpperCase() ===
|
||||
damageLocationsCms.SIDEDOOR
|
||||
);
|
||||
return this.selectedDamageLocations.some((selectedDamages) =>
|
||||
selectedDamages.toUpperCase()
|
||||
=== damageLocationsCms.SIDEDOOR);
|
||||
},
|
||||
isRearWindowDamageLocation() {
|
||||
return this.selectedDamageLocations.some(
|
||||
(selectedDamages) =>
|
||||
selectedDamages.toUpperCase() ===
|
||||
damageLocationsCms.REARWINDOW
|
||||
);
|
||||
return this.selectedDamageLocations.some((selectedDamages) =>
|
||||
selectedDamages.toUpperCase()
|
||||
=== damageLocationsCms.REARWINDOW);
|
||||
},
|
||||
isWindshieldRepair() {
|
||||
return (
|
||||
this.isWindshieldDamageLocation &&
|
||||
this.selectedWindshieldOptions.selectedWindshieldDamageType ===
|
||||
damageLocationsSelected.REPAIR
|
||||
this.isWindshieldDamageLocation
|
||||
&& this.selectedWindshieldOptions.selectedWindshieldDamageType
|
||||
=== damageLocationsSelected.REPAIR
|
||||
);
|
||||
},
|
||||
isDriverSideReplace() {
|
||||
if (!this.isSideDoorDamageLocation) return false;
|
||||
|
||||
return this.sideDoorOptionsData.selectedDoorSides.some(
|
||||
(selectedDriverSide) =>
|
||||
selectedDriverSide.toUpperCase() ===
|
||||
damageLocationsCms.DRIVERSIDE
|
||||
);
|
||||
return this.sideDoorOptionsData.selectedDoorSides.some((selectedDriverSide) =>
|
||||
selectedDriverSide.toUpperCase()
|
||||
=== damageLocationsCms.DRIVERSIDE);
|
||||
},
|
||||
isPassengerSideReplace() {
|
||||
if (!this.isSideDoorDamageLocation) return false;
|
||||
|
||||
return this.sideDoorOptionsData.selectedDoorSides.some(
|
||||
(selectedPassengerSide) =>
|
||||
selectedPassengerSide.toUpperCase() ===
|
||||
damageLocationsCms.PASSENGERSIDE
|
||||
);
|
||||
return this.sideDoorOptionsData.selectedDoorSides.some((selectedPassengerSide) =>
|
||||
selectedPassengerSide.toUpperCase()
|
||||
=== damageLocationsCms.PASSENGERSIDE);
|
||||
},
|
||||
hasRepairReplaceConflict() {
|
||||
return (
|
||||
this.isWindshieldDamageLocation &&
|
||||
this.selectedDamageLocations.length > 1 &&
|
||||
this.isWindshieldRepair
|
||||
this.isWindshieldDamageLocation
|
||||
&& this.selectedDamageLocations.length > 1
|
||||
&& this.isWindshieldRepair
|
||||
);
|
||||
},
|
||||
hasSplitSingleConflict() {
|
||||
if (
|
||||
!this.selectedDamageLocations?.includes('Windshield') ||
|
||||
this.selectedWindshieldOptions.selectedWindshieldDamageType ===
|
||||
damageLocationsSelected.REPAIR ||
|
||||
!this.selectedWindshieldOptions.selectedWindshieldReplaceOptions
|
||||
)
|
||||
return false;
|
||||
!this.selectedDamageLocations?.includes('Windshield')
|
||||
|| this.selectedWindshieldOptions.selectedWindshieldDamageType
|
||||
=== damageLocationsSelected.REPAIR
|
||||
|| !this.selectedWindshieldOptions.selectedWindshieldReplaceOptions
|
||||
) return false;
|
||||
|
||||
return (
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
||||
(selectedSingleWindshield) =>
|
||||
selectedSingleWindshield.toUpperCase() ===
|
||||
damageLocationsSelected.SINGLE.toUpperCase()
|
||||
) &&
|
||||
(this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
||||
(selectedDriverWindshield) =>
|
||||
selectedDriverWindshield.toUpperCase() ===
|
||||
damageLocationsSelected.DRIVER.toUpperCase()
|
||||
) ||
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
||||
(selectedPassengerWindshield) =>
|
||||
selectedPassengerWindshield.toUpperCase() ===
|
||||
damageLocationsSelected.PASSENGER.toUpperCase()
|
||||
))
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some((selectedSingleWindshield) =>
|
||||
selectedSingleWindshield.toUpperCase()
|
||||
=== damageLocationsSelected.SINGLE.toUpperCase())
|
||||
&& (this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some((selectedDriverWindshield) =>
|
||||
selectedDriverWindshield.toUpperCase()
|
||||
=== damageLocationsSelected.DRIVER.toUpperCase())
|
||||
|| this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some((selectedPassengerWindshield) =>
|
||||
selectedPassengerWindshield.toUpperCase()
|
||||
=== damageLocationsSelected.PASSENGER.toUpperCase()))
|
||||
);
|
||||
},
|
||||
shouldDisplayVehicleChangeAlert() {
|
||||
|
|
@ -309,32 +284,26 @@ export default {
|
|||
const glassSelections = [];
|
||||
|
||||
if (
|
||||
this.mainStore.order.damage.glassToReplace?.some(
|
||||
(glass) =>
|
||||
glass.glassLocation ===
|
||||
damageLocationsSelected.WINDSHIELD
|
||||
) ||
|
||||
this.mainStore.order.damage.isRepair
|
||||
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||
glass.glassLocation
|
||||
=== damageLocationsSelected.WINDSHIELD)
|
||||
|| this.mainStore.order.damage.isRepair
|
||||
) {
|
||||
glassSelections.push(damageLocationsSelected.WINDSHIELD);
|
||||
}
|
||||
if (
|
||||
this.mainStore.order.damage.glassToReplace?.some(
|
||||
(glass) =>
|
||||
glass.glassLocation ===
|
||||
damageLocationsSelected.DRIVER ||
|
||||
glass.glassLocation ===
|
||||
damageLocationsSelected.PASSENGER
|
||||
)
|
||||
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||
glass.glassLocation
|
||||
=== damageLocationsSelected.DRIVER
|
||||
|| glass.glassLocation
|
||||
=== damageLocationsSelected.PASSENGER)
|
||||
) {
|
||||
glassSelections.push(damageLocationsSelected.SIDEDOOR);
|
||||
}
|
||||
|
||||
if (
|
||||
this.mainStore.order.damage.glassToReplace?.some(
|
||||
(glass) =>
|
||||
glass.glassLocation === damageLocationsSelected.REAR
|
||||
)
|
||||
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||
glass.glassLocation === damageLocationsSelected.REAR)
|
||||
) {
|
||||
glassSelections.push(damageLocationsSelected.REARWINDOW);
|
||||
}
|
||||
|
|
@ -345,11 +314,10 @@ export default {
|
|||
const windShieldOptions = {
|
||||
selectedWindshieldDamageType: '',
|
||||
selectedWindshieldChipCount: null,
|
||||
selectedWindshieldReplaceOptions: [],
|
||||
selectedWindshieldReplaceOptions: []
|
||||
};
|
||||
|
||||
if (this.mainStore.order.damage.isRepair === undefined)
|
||||
return windshieldOptions;
|
||||
if (this.mainStore.order.damage.isRepair === undefined) return windshieldOptions;
|
||||
|
||||
if (this.mainStore.order.damage.isRepair) {
|
||||
windShieldOptions.selectedWindshieldDamageType =
|
||||
|
|
@ -358,49 +326,37 @@ export default {
|
|||
this.mainStore.order.damage.numberOfChips;
|
||||
} else {
|
||||
if (
|
||||
this.mainStore.order.damage.glassToReplace?.some(
|
||||
(glass) =>
|
||||
glass.glassLocation ===
|
||||
damageLocationsSelected.WINDSHIELD &&
|
||||
glass.glassName === damageLocationsSelected.SINGLE
|
||||
)
|
||||
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||
glass.glassLocation
|
||||
=== damageLocationsSelected.WINDSHIELD
|
||||
&& glass.glassName === damageLocationsSelected.SINGLE)
|
||||
) {
|
||||
windShieldOptions.selectedWindshieldDamageType =
|
||||
damageLocationsSelected.REPLACE;
|
||||
windShieldOptions.selectedWindshieldReplaceOptions.push(
|
||||
damageLocationsSelected.SINGLE
|
||||
);
|
||||
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.SINGLE);
|
||||
}
|
||||
|
||||
if (
|
||||
this.mainStore.order.damage.glassToReplace?.some(
|
||||
(glass) =>
|
||||
glass.glassLocation ===
|
||||
damageLocationsSelected.WINDSHIELD &&
|
||||
glass.glassName === damageLocationsSelected.DRIVER
|
||||
)
|
||||
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||
glass.glassLocation
|
||||
=== damageLocationsSelected.WINDSHIELD
|
||||
&& glass.glassName === damageLocationsSelected.DRIVER)
|
||||
) {
|
||||
windShieldOptions.selectedWindshieldDamageType =
|
||||
damageLocationsSelected.REPLACE;
|
||||
windShieldOptions.selectedWindshieldReplaceOptions.push(
|
||||
damageLocationsSelected.DRIVER
|
||||
);
|
||||
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.DRIVER);
|
||||
}
|
||||
|
||||
if (
|
||||
this.mainStore.order.damage.glassToReplace?.some(
|
||||
(glass) =>
|
||||
glass.glassLocation ===
|
||||
damageLocationsSelected.WINDSHIELD &&
|
||||
glass.glassName ===
|
||||
damageLocationsSelected.PASSENGER
|
||||
)
|
||||
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||
glass.glassLocation
|
||||
=== damageLocationsSelected.WINDSHIELD
|
||||
&& glass.glassName
|
||||
=== damageLocationsSelected.PASSENGER)
|
||||
) {
|
||||
windShieldOptions.selectedWindshieldDamageType =
|
||||
damageLocationsSelected.REPLACE;
|
||||
windShieldOptions.selectedWindshieldReplaceOptions.push(
|
||||
damageLocationsSelected.PASSENGER
|
||||
);
|
||||
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.PASSENGER);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -409,20 +365,16 @@ export default {
|
|||
getDoorSidesFromStore() {
|
||||
const doorSides = [];
|
||||
if (
|
||||
this.mainStore.order.damage.glassToReplace?.some(
|
||||
(glass) =>
|
||||
glass.glassLocation === damageLocationsSelected.DRIVER
|
||||
)
|
||||
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||
glass.glassLocation === damageLocationsSelected.DRIVER)
|
||||
) {
|
||||
doorSides.push(damageLocationsSelected.DRIVERSIDE);
|
||||
}
|
||||
|
||||
if (
|
||||
this.mainStore.order.damage.glassToReplace?.some(
|
||||
(glass) =>
|
||||
glass.glassLocation ===
|
||||
damageLocationsSelected.PASSENGER
|
||||
)
|
||||
this.mainStore.order.damage.glassToReplace?.some((glass) =>
|
||||
glass.glassLocation
|
||||
=== damageLocationsSelected.PASSENGER)
|
||||
) {
|
||||
doorSides.push(damageLocationsSelected.PASSENGERSIDE);
|
||||
}
|
||||
|
|
@ -453,10 +405,8 @@ export default {
|
|||
},
|
||||
getRearReplaceOptionsFromStore() {
|
||||
const rearReplaceOptions =
|
||||
this.mainStore.order.damage.glassToReplace?.filter(
|
||||
(glass) =>
|
||||
glass.glassLocation === damageLocationsSelected.REAR
|
||||
)[0]?.glassName;
|
||||
this.mainStore.order.damage.glassToReplace?.filter((glass) =>
|
||||
glass.glassLocation === damageLocationsSelected.REAR)[0]?.glassName;
|
||||
|
||||
return rearReplaceOptions;
|
||||
},
|
||||
|
|
@ -512,48 +462,42 @@ export default {
|
|||
selectedGlassToReplace() {
|
||||
const selectedGlassToReplace = [];
|
||||
if (this.isWindshieldDamageLocation && !this.isWindshieldRepair) {
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.forEach(
|
||||
(wsItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.WINDSHIELD,
|
||||
glassName: wsItem,
|
||||
});
|
||||
}
|
||||
);
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.forEach((wsItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.WINDSHIELD,
|
||||
glassName: wsItem
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (this.isDriverSideReplace) {
|
||||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.forEach(
|
||||
(driverItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.DRIVER,
|
||||
glassName: driverItem,
|
||||
});
|
||||
}
|
||||
);
|
||||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.forEach((driverItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.DRIVER,
|
||||
glassName: driverItem
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (this.isPassengerSideReplace) {
|
||||
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.forEach(
|
||||
(passengerItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.PASSENGER,
|
||||
glassName: passengerItem,
|
||||
});
|
||||
}
|
||||
);
|
||||
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.forEach((passengerItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.PASSENGER,
|
||||
glassName: passengerItem
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (this.isRearWindowDamageLocation) {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.REAR,
|
||||
glassName: this.selectedRearReplaceOptions,
|
||||
glassName: this.selectedRearReplaceOptions
|
||||
});
|
||||
}
|
||||
|
||||
return selectedGlassToReplace;
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue