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=""
v-bind:isDismissible="false"
/>
<alert
cmsWidgetName="FoundWindshield"
ref="alertFoundWindshield"
class="my-5"
alertClass="alert-warning"
:manualHeadline="AlertFoundWindshieldHeader"
:manualCopy="AlertFoundWindshieldBody"
v-bind:isDismissible="false"
/>
<addressVehiclesQuestion
ref="addressVehiclesQuestion"
cmsWidgetName="VehicleConfirmationQuestion"
@ -46,7 +37,7 @@
<span v-if="doesCopyContainRouterLink(copy)" class="text-body">
<router-link
:to="{
query: { fmgPage: `${getRouterLinkRouteFromCopy(copy)}` },
query: { issPage: `${getRouterLinkRouteFromCopy(copy)}` },
name: 'root',
}"
>{{ getRouterLinkDisplayTextFromCopy(copy) }}</router-link
@ -132,18 +123,10 @@ export default {
return this.VehiclesForQuestions.length;
},
AlertFoundMultipleVehiclesHeader() {
return this.getCmsContent("FoundMultipleVehicles", "HeadlineText")
.replaceAll("{custom:vehicleCount}", this.vehicleCount);
},
AlertFoundWindshieldHeader() {
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);
return this.getCmsContent(
"FoundMultipleVehicles",
"HeadlineText"
).replaceAll("{custom:vehicleCount}", this.vehicleCount);
},
AlertProvideVinBody() {
return this.getCmsContent("ProvideVinAlert", "BodyText");
@ -194,17 +177,11 @@ export default {
return false;
},
backButtonAction() {
this.$router.navigate(
this.navigationScenarios.CLICKED_BACK,
this.$route
);
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
},
async forwardButtonAction() {
const vinLookup = await this.dispatchStoreAction(
storeActions.LOOKUP_VEHICLE_BY_VIN,
{
vin: this.selectedVehicle.vin,
}
const vinLookup = await useMainStore().lookupVehicleByVin(
this.selectedVehicle.vin,
).catch(() => {
this.$refs.siteFooter.removeLoader();
});
@ -214,9 +191,7 @@ export default {
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(
vinLookup.data.carId
);
await this.dispatchStoreAction(
storeActions.SAVE_VIN,
{
await useMainStore().saveVin({
vehicleInfo: Object.assign(this.selectedVehicle.vehicle, {
vin: this.selectedVehicle.vin,
}),
@ -225,12 +200,15 @@ export default {
},
false
);
return await this.navigateForward();
return await this.navigateForwardWithSingleCarMatch();
},
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) {
this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD,
this.$router.navigate(
this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
this.$route,
{},
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }

View file

@ -328,6 +328,30 @@ const routingTable = function(store) {
scenario: navigationScenarios.CLICKED_BACK,
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);
}
},
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 }) {
//Reset dependent state when changing
if