EOD commit - address-vehicles

This commit is contained in:
US\katie.kroell 2023-01-26 16:55:39 -05:00
parent eabefd8ee4
commit 962dadf78f
3 changed files with 52 additions and 37 deletions

View file

@ -21,15 +21,6 @@
manualCopy="" manualCopy=""
v-bind:isDismissible="false" v-bind:isDismissible="false"
/> />
<alert
cmsWidgetName="FoundWindshield"
ref="alertFoundWindshield"
class="my-5"
alertClass="alert-warning"
:manualHeadline="AlertFoundWindshieldHeader"
:manualCopy="AlertFoundWindshieldBody"
v-bind:isDismissible="false"
/>
<addressVehiclesQuestion <addressVehiclesQuestion
ref="addressVehiclesQuestion" ref="addressVehiclesQuestion"
cmsWidgetName="VehicleConfirmationQuestion" cmsWidgetName="VehicleConfirmationQuestion"
@ -46,7 +37,7 @@
<span v-if="doesCopyContainRouterLink(copy)" class="text-body"> <span v-if="doesCopyContainRouterLink(copy)" class="text-body">
<router-link <router-link
:to="{ :to="{
query: { fmgPage: `${getRouterLinkRouteFromCopy(copy)}` }, query: { issPage: `${getRouterLinkRouteFromCopy(copy)}` },
name: 'root', name: 'root',
}" }"
>{{ getRouterLinkDisplayTextFromCopy(copy) }}</router-link >{{ getRouterLinkDisplayTextFromCopy(copy) }}</router-link
@ -132,18 +123,10 @@ export default {
return this.VehiclesForQuestions.length; return this.VehiclesForQuestions.length;
}, },
AlertFoundMultipleVehiclesHeader() { AlertFoundMultipleVehiclesHeader() {
return this.getCmsContent("FoundMultipleVehicles", "HeadlineText") return this.getCmsContent(
.replaceAll("{custom:vehicleCount}", this.vehicleCount); "FoundMultipleVehicles",
}, "HeadlineText"
AlertFoundWindshieldHeader() { ).replaceAll("{custom:vehicleCount}", this.vehicleCount);
return this.getCmsContent("FoundWindshield", "HeadlineText")
.replaceAll("{custom:vehicleCount}", this.vehicleCount);
},
AlertFoundWindshieldBody() {
return this.getCmsContent("FoundWindshield", "BodyText")
.replaceAll("{custom:vinlookupYear}", this.vehicleCount)
.replaceAll("{custom:vinlookupMake}", this.vehicleCount)
.replaceAll("{custom:vinlookupModel}", this.vehicleCount);
}, },
AlertProvideVinBody() { AlertProvideVinBody() {
return this.getCmsContent("ProvideVinAlert", "BodyText"); return this.getCmsContent("ProvideVinAlert", "BodyText");
@ -194,17 +177,11 @@ export default {
return false; return false;
}, },
backButtonAction() { backButtonAction() {
this.$router.navigate( this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
this.navigationScenarios.CLICKED_BACK,
this.$route
);
}, },
async forwardButtonAction() { async forwardButtonAction() {
const vinLookup = await this.dispatchStoreAction( const vinLookup = await useMainStore().lookupVehicleByVin(
storeActions.LOOKUP_VEHICLE_BY_VIN, this.selectedVehicle.vin,
{
vin: this.selectedVehicle.vin,
}
).catch(() => { ).catch(() => {
this.$refs.siteFooter.removeLoader(); this.$refs.siteFooter.removeLoader();
}); });
@ -214,9 +191,7 @@ export default {
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId( this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(
vinLookup.data.carId vinLookup.data.carId
); );
await this.dispatchStoreAction( await useMainStore().saveVin({
storeActions.SAVE_VIN,
{
vehicleInfo: Object.assign(this.selectedVehicle.vehicle, { vehicleInfo: Object.assign(this.selectedVehicle.vehicle, {
vin: this.selectedVehicle.vin, vin: this.selectedVehicle.vin,
}), }),
@ -225,12 +200,15 @@ export default {
}, },
false false
); );
return await this.navigateForward();
return await this.navigateForwardWithSingleCarMatch();
}, },
async navigateForward() { async navigateForward() {
// If the vehicle selected on this page is different from the one originally entered and the selected glass is not available
// for that vehicle, then navigate back to "vehicle-damage" and display vehicle changed alert on that page.
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
this.$router.navigateWithSaving( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD, this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
this.$route, this.$route,
{}, {},
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true } { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }

View file

@ -328,6 +328,30 @@ const routingTable = function(store) {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.ADDRESS_LOOKUP, destinationIssPageValue: issPageValues.ADDRESS_LOOKUP,
}, },
{
scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
destinationIssPageValue: issPageValues.PART_QUESTIONS,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
destinationIssPageValue: issPageValues.VEHICLE_PARTS,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
destinationIssPageValue: issPageValues.MOLDING_QUESTIONS,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT,
},
], ],
}, },
{ {

View file

@ -896,7 +896,20 @@ export const useMainStore = defineStore({
this.updateRegistration(registrationInfo); this.updateRegistration(registrationInfo);
} }
}, },
saveVin({ isSelectedGlassAvailableForVehicle, vehicleInfo }) {
//Reset dependent state when changing
if (vehicleInfo.vin !== this.order.vehicle.vin) {
this.resetRegistrationAndDependencies();
if (!isSelectedGlassAvailableForVehicle) {
this.resetDamageAndDependencies();
this.resetPartsAndDependencies();
//Save new values
this.updateVehicle(vehicleInfo);
}
}
},
saveRegistrationLicensePlateLookup({ isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo }) { saveRegistrationLicensePlateLookup({ isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo }) {
//Reset dependent state when changing //Reset dependent state when changing
if if