Fixed multiple vehicle matching entered vehicle bug
This commit is contained in:
parent
e054eef031
commit
fc8be0cee2
3 changed files with 38 additions and 14 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="dropdown-question">
|
<div class="dropdown-question" :class="(errors && errors.length) || hasError ? 'has-error' : ''">
|
||||||
<label :for="inputId" :aria-label="questionText" class="form-label" v-html="labelText"></label>
|
<label :for="inputId" :aria-label="questionText" class="form-label" v-html="labelText"></label>
|
||||||
<select v-model="selectedOption"
|
<select v-model="selectedOption"
|
||||||
class="form-select"
|
class="form-select"
|
||||||
|
|
@ -9,8 +9,7 @@
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
:aria-required="isRequired"
|
:aria-required="isRequired"
|
||||||
:validationRules="validationRules"
|
:validationRules="validationRules"
|
||||||
@input="handleChange"
|
>
|
||||||
@blur="handleBlur" >
|
|
||||||
<option v-for="(value, name, index) in options" :value="name" :key="index">
|
<option v-for="(value, name, index) in options" :value="name" :key="index">
|
||||||
{{ value }}
|
{{ value }}
|
||||||
</option>
|
</option>
|
||||||
|
|
@ -40,10 +39,23 @@ export default {
|
||||||
cmsWidgetName: String,
|
cmsWidgetName: String,
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
|
const propsClone = Object.assign({}, props);
|
||||||
|
const modelValue = propsClone.modelValue;
|
||||||
|
let initialValue;
|
||||||
|
|
||||||
|
switch (typeof modelValue) {
|
||||||
|
case "number":
|
||||||
|
initialValue = modelValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
initialValue = (modelValue && modelValue.length > 0) ? modelValue : "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
const fieldOptions = {
|
const fieldOptions = {
|
||||||
type: "text",
|
type: "select",
|
||||||
value: props.modelValue,
|
value: props.modelValue,
|
||||||
initialValue: props.modelValue,
|
initialValue: initialValue,
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
|
||||||
|
|
@ -13,27 +13,27 @@
|
||||||
<div class="fade-on-route-transition sub-container make-tall">
|
<div class="fade-on-route-transition sub-container make-tall">
|
||||||
<customerQuestions ref="customerQuestions" v-model="customerQuestions" />
|
<customerQuestions ref="customerQuestions" v-model="customerQuestions" />
|
||||||
<alert ref="alertVinNotFound" v-show="displayVinNotFoundAlert"
|
<alert ref="alertVinNotFound" v-show="displayVinNotFoundAlert"
|
||||||
class="my-3"
|
class="mb-4"
|
||||||
cmsWidgetName="AlertVinNotFoundWidget"
|
cmsWidgetName="AlertVinNotFoundWidget"
|
||||||
alertClass="alert-danger"
|
alertClass="alert-danger"
|
||||||
v-bind:isDismissible="false"
|
v-bind:isDismissible="false"
|
||||||
/>
|
/>
|
||||||
<alert ref="alertMatchedDifferentVehicle" v-show="displayMatchedDifferentVehicleAlert"
|
<alert ref="alertMatchedDifferentVehicle" v-show="displayMatchedDifferentVehicleAlert"
|
||||||
class="my-3"
|
class="mb-4"
|
||||||
:manualHeadline="AlertMatchedDifferentVehicleHeader"
|
:manualHeadline="AlertMatchedDifferentVehicleHeader"
|
||||||
:manualCopy="AlertMatchedDifferentVehicleBody"
|
:manualCopy="AlertMatchedDifferentVehicleBody"
|
||||||
alertClass="alert-warning"
|
alertClass="alert-warning"
|
||||||
v-bind:isDismissible="false"
|
v-bind:isDismissible="false"
|
||||||
/>
|
/>
|
||||||
<alert ref="alertNonServiceableZip" v-show="displayNonServiceableZipAlert"
|
<alert ref="alertNonServiceableZip" v-show="displayNonServiceableZipAlert"
|
||||||
class="my-3"
|
class="mb-4"
|
||||||
alertClass="alert-danger"
|
alertClass="alert-danger"
|
||||||
:manualHeadline="AlertNonServiceableZipHeader"
|
:manualHeadline="AlertNonServiceableZipHeader"
|
||||||
:manualCopy="AlertNonServiceableZipBody"
|
:manualCopy="AlertNonServiceableZipBody"
|
||||||
v-bind:isDismissible="false"
|
v-bind:isDismissible="false"
|
||||||
/>
|
/>
|
||||||
<alert ref="alertVinLookupsByHomeAddressNotAllowed" v-show="displayVinLookupByHomeAddressNotAllowedAlert"
|
<alert ref="alertVinLookupsByHomeAddressNotAllowed" v-show="displayVinLookupByHomeAddressNotAllowedAlert"
|
||||||
class="my-3"
|
class="mb-4"
|
||||||
cmsWidgetName="AlertVinLookupsByHomeAddressNotAllowedWidget"
|
cmsWidgetName="AlertVinLookupsByHomeAddressNotAllowedWidget"
|
||||||
alertClass="alert-danger"
|
alertClass="alert-danger"
|
||||||
v-bind:isDismissible="false"
|
v-bind:isDismissible="false"
|
||||||
|
|
@ -252,6 +252,15 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if multiple cars were found
|
||||||
|
let matchingCars = carsFound.filter(car => car.vehicle.carId === carEntered.carId);
|
||||||
|
if (matchingCars.length === 1) {
|
||||||
|
// and one and only one of them matches the carId entered, save the vehicle info
|
||||||
|
// so we can go to the Heritage Funnel directly
|
||||||
|
const matchingCar = matchingCars[0];
|
||||||
|
this.updateVehicleInfo(matchingCar.vin, matchingCar.vehicle);
|
||||||
|
}
|
||||||
|
|
||||||
// update data if the zip or service zip is servicable
|
// update data if the zip or service zip is servicable
|
||||||
this.updateCustomerInfo();
|
this.updateCustomerInfo();
|
||||||
}
|
}
|
||||||
|
|
@ -283,13 +292,14 @@ export default {
|
||||||
navigateAfterSaveToHeritageFunnel(this.$route);
|
navigateAfterSaveToHeritageFunnel(this.$route);
|
||||||
}
|
}
|
||||||
} else if (carsFound.length > 1) {
|
} else if (carsFound.length > 1) {
|
||||||
// if multiple cars were found
|
// if multiple cars were found
|
||||||
if (carsFound.find(car => car.vehicle.carId === carEntered.carId)) {
|
let matchingCars = carsFound.filter(car => car.vehicle.carId === carEntered.carId);
|
||||||
// and one of them matches the car id entered
|
if (matchingCars.length === 1) {
|
||||||
|
// and one and only of them matches the car id entered
|
||||||
this.$refs.loadingModal.showModal();
|
this.$refs.loadingModal.showModal();
|
||||||
navigateAfterSaveToHeritageFunnel(this.$route);
|
navigateAfterSaveToHeritageFunnel(this.$route);
|
||||||
} else {
|
} else {
|
||||||
// and there is no match, navigate to "address-vehicles" page
|
// if there are no matches or there are multiple matches, navigate to "address-vehicles" page
|
||||||
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, this.$route, {}, {}, carsFound);
|
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, this.$route, {}, {}, carsFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,13 @@
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
<alert ref="alertVerificationWarning" v-show="displayVerificationWarning"
|
<alert ref="alertVerificationWarning" v-show="displayVerificationWarning"
|
||||||
|
class="mb-4"
|
||||||
cmsWidgetName="AlertVerificationWarningWidget"
|
cmsWidgetName="AlertVerificationWarningWidget"
|
||||||
alertClass="alert-warning"
|
alertClass="alert-warning"
|
||||||
v-bind:isDismissible="false"
|
v-bind:isDismissible="false"
|
||||||
/>
|
/>
|
||||||
<alert ref="alertNoMatchWarning" v-show="displayNoMatchWarning"
|
<alert ref="alertNoMatchWarning" v-show="displayNoMatchWarning"
|
||||||
|
class="mb-4"
|
||||||
cmsWidgetName="AlertNoMatchWarningWidget"
|
cmsWidgetName="AlertNoMatchWarningWidget"
|
||||||
alertClass="alert-warning"
|
alertClass="alert-warning"
|
||||||
v-bind:isDismissible="false"
|
v-bind:isDismissible="false"
|
||||||
|
|
@ -270,7 +272,7 @@ export default ({
|
||||||
watch: {
|
watch: {
|
||||||
addressModel: {
|
addressModel: {
|
||||||
handler(newValue){
|
handler(newValue){
|
||||||
this.displayNoMatchWarning = false;
|
//this.displayNoMatchWarning = false;
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue