Checking in before demoing CSR-96
This commit is contained in:
parent
f18a38fbbe
commit
7fc0f40c03
3 changed files with 108 additions and 32 deletions
|
|
@ -17,6 +17,8 @@ const errorMessages = {
|
||||||
LAST_NAME_REQUIRED: "Please enter your last name",
|
LAST_NAME_REQUIRED: "Please enter your last name",
|
||||||
EMAIL_ADDRESS_REQUIRED: "Please enter your email address",
|
EMAIL_ADDRESS_REQUIRED: "Please enter your email address",
|
||||||
EMAIL_ADDRESS_FORMAT: "Please enter a valid email address",
|
EMAIL_ADDRESS_FORMAT: "Please enter a valid email address",
|
||||||
|
SERVICE_ZIP_REQUIRED: "Please enter your Service ZIP",
|
||||||
|
SERVICE_ZIP_FORMAT: "Please enter a valid Service ZIP",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { errorMessages };
|
export { errorMessages };
|
||||||
|
|
@ -12,6 +12,7 @@ const storeActions = {
|
||||||
LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms",
|
LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms",
|
||||||
LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin",
|
LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin",
|
||||||
LOOKUP_VIN_BY_PLATE: "lookupVinByPlate",
|
LOOKUP_VIN_BY_PLATE: "lookupVinByPlate",
|
||||||
|
LOOKUP_VIN_BY_ADDRESS: "lookupVinByAddress",
|
||||||
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
|
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
|
||||||
SAVE_ORDER: "saveOrder",
|
SAVE_ORDER: "saveOrder",
|
||||||
LOAD_ORDER: "loadOrder",
|
LOAD_ORDER: "loadOrder",
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,41 @@
|
||||||
<vehicleBanner ref="vehicleBanner" :displayGenericVehicleImage=false />
|
<vehicleBanner ref="vehicleBanner" :displayGenericVehicleImage=false />
|
||||||
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" ref="funnelSubHeader" />
|
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" ref="funnelSubHeader" />
|
||||||
<customerQuestions ref="customerQuestions" v-model="customerQuestions" />
|
<customerQuestions ref="customerQuestions" v-model="customerQuestions" />
|
||||||
|
<alert ref="alertVinNotFound" v-show="displayVinNotFoundAlert"
|
||||||
|
cmsWidgetName="AlertVinNotFoundWidget"
|
||||||
|
alertClass="alert-danger"
|
||||||
|
v-bind:isDismissible="false"
|
||||||
|
/>
|
||||||
|
<alert ref="alertMatchedDifferentVehicle" v-show="displayMatchedDifferentVehicleAlert"
|
||||||
|
cmsWidgetName="AlertMatchedDifferentVehicleWidget"
|
||||||
|
alertClass="alert-danger"
|
||||||
|
v-bind:isDismissible="false"
|
||||||
|
/>
|
||||||
|
<alert ref="alertNonServiceableZip" v-show="displayNonServiceableZipAlert"
|
||||||
|
cmsWidgetName="AlertNonServiceableZipWidget"
|
||||||
|
alertClass="alert-danger"
|
||||||
|
v-bind:isDismissible="false"
|
||||||
|
/>
|
||||||
|
<alert ref="alertVinLookupsByHomeAddressNotAllowed" v-show="displayVinLookupByHomeAddressNotAllowedAlert"
|
||||||
|
cmsWidgetName="AlertVinLookupsByHomeAddressNotAllowedWidget"
|
||||||
|
alertClass="alert-danger"
|
||||||
|
v-bind:isDismissible="false"
|
||||||
|
/>
|
||||||
|
<transition name="fade" mode="out-in">
|
||||||
|
<div class="service-zip-field" v-show="showServiceZipField" aria-live="polite">
|
||||||
|
<div class="row my-4">
|
||||||
|
<div class="col">
|
||||||
|
<textboxQuestion cmsWidgetName="ServiceZipQuestionWidget" v-model="serviceZip" ref="serviceZip" inputId="7add1b26df344f2caf1678de5797803f" aria-haspopup="" disableAutoFill validationRules="street-address-required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
<funnel-footer
|
<funnel-footer
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
ref="funnelFooter"
|
ref="funnelFooter"
|
||||||
:isDisabled="!meta.valid"
|
:isDisabled="!meta.valid"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -36,6 +66,9 @@ import store from "@/store";
|
||||||
// import { storeActions } from "@/constants/store-actions";
|
// import { storeActions } from "@/constants/store-actions";
|
||||||
// import baseMixin from "@/mixins/base-mixin";
|
// import baseMixin from "@/mixins/base-mixin";
|
||||||
|
|
||||||
|
defineRule("service-zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
||||||
|
defineRule("service-zip-format", regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.SERVICE_ZIP_FORMAT));
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "address-lookup",
|
name: "address-lookup",
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
|
@ -77,8 +110,8 @@ export default {
|
||||||
return store.getters.vehicle.carId !== null;
|
return store.getters.vehicle.carId !== null;
|
||||||
},
|
},
|
||||||
resetDependentState() {
|
resetDependentState() {
|
||||||
// Invokes
|
store.commit(storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE, null);
|
||||||
|
store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
// route to move backwards
|
// route to move backwards
|
||||||
|
|
@ -87,46 +120,86 @@ export default {
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
store.commit(this.storeMutations.UPDATE_IS_REPAIR, this.isWindshieldRepair);
|
|
||||||
|
|
||||||
|
// look-up VIN by address
|
||||||
|
const vinLookup = await this.lookupVin(this.lastName, this.streetAddress, this.zip, this.state);
|
||||||
|
|
||||||
|
if (vinLookup.isStatePermissable) {
|
||||||
|
// State Restrictions allow lookup by address
|
||||||
|
if (vinLookup.vinVehicles.length == 0) {
|
||||||
|
// no VINs found
|
||||||
|
this.$refs.funnelFooter.removeLoader();
|
||||||
|
this.displayVinNotFoundAlert = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const zipValidation = this.serviceZip ? await this.validateZip(this.serviceZip) : await this.validateZip(this.zip);
|
||||||
|
if (!zipValidation.data.isServiceable) {
|
||||||
|
this.$refs.funnelFooter.removeLoader();
|
||||||
|
this.displayNonServiceableZipAlert = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isWindshieldRepair){
|
|
||||||
store.commit(this.storeMutations.UPDATE_NUMBER_OF_CHIPS, parseInt(this.selectedWindshieldOptions.selectedWindshieldChipCount));
|
|
||||||
} else {
|
} else {
|
||||||
store.commit(this.storeMutations.UPDATE_NUMBER_OF_CHIPS, null);
|
// State Restrictions forbid lookup by address
|
||||||
|
this.$refs.funnelFooter.removeLoader();
|
||||||
|
this.displayVinLookupByHomeAddressNotAllowedAlert = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
store.commit(this.storeMutations.UPDATE_GLASS_TO_REPLACE, this.selectedGlassToReplace());
|
|
||||||
|
|
||||||
const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(this.storeActions.GET_PARTS_OR_QUESTIONS,
|
// const vinLookup = await this.lookupVin(this.lastName, this.streetAddress, this.zip, this.state).catch(() => {
|
||||||
{ carId: store.getters.vehicle.carId, glassArray: this.selectedGlassToReplace()}, false);
|
// this.$refs.funnelFooter.removeLoader();
|
||||||
|
// this.vinNotValid = true;
|
||||||
|
// return;
|
||||||
|
// });
|
||||||
|
|
||||||
this.navigateForward(partsData);
|
if (vinLookup.data.vehicle.carId !== store.getters.vehicle.carId) {
|
||||||
},
|
this.$refs.funnelFooter.updateButtonText(`Continue with ${vinLookup.data.vin} ${vinLookup.data.vehicle.year} ${vinLookup.data.vehicle.make} ${vinLookup.data.vehicle.model}`);
|
||||||
navigateForward(partsData) {
|
this.$refs.funnelFooter.removeLoader();
|
||||||
// found parts questions
|
this.vinDoesNotMatchCarId = true;
|
||||||
if (partsData.data.partsOrQuestions.some(pq => pq.partQuestions != null && pq.partQuestions.length > 0)){
|
|
||||||
this.$router.navigateAfterSave(this.navigationScenarios.SELECTED_DAMAGE_WITH_PART_QUESTIONS, this.$route, {}, {}, partsData.data);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// found multiple parts for a single glass location (Windshield, Driver, Passenger, Rear)
|
const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||||
if (partsData.data.partsOrQuestions){
|
this.storeActions.GET_PARTS_OR_QUESTIONS,
|
||||||
for (var i = 0; i < partsData.data.partsOrQuestions.length; i++){
|
{
|
||||||
if (partsData.data.partsOrQuestions[i].parts != null && partsData.data.partsOrQuestions[i].parts.length > 1){
|
carId: store.getters.vehicle.carId,
|
||||||
this.$router.navigateAfterSave(this.navigationScenarios.SELECTED_DAMAGE_WITH_MULTIPLE_PARTS, this.$route, {}, {}, partsData.data);
|
glassArray: store.getters.damage.glassToReplace,
|
||||||
return;
|
zipCode: this.zip,
|
||||||
}
|
vin: vinLookup.vin
|
||||||
}
|
}, false
|
||||||
}
|
);
|
||||||
|
this.navigateForward(partsData);
|
||||||
//if not a repair then there should only be 1 part and no problem questions at this point so save the part to the store.
|
|
||||||
if (!this.isWindshieldRepair){
|
|
||||||
store.commit(this.storeMutations.UPDATE_PARTS, partsData.data.partsOrQuestions[0].parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$router.navigate(this.navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART, this.$route);
|
|
||||||
},
|
},
|
||||||
|
navigateForward(partsData){
|
||||||
|
if(partsData.data.partsOrQuestions[0].partQuestions && partsData.data.partsOrQuestions[0].partQuestions.length > 0){
|
||||||
|
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_PARTS_QUESTION, this.$route, {}, {}, partsData.data);
|
||||||
|
return;
|
||||||
|
} else if((!partsData.data.partsOrQuestions[0].partQuestions || partsData.data.partsOrQuestions[0].partQuestions.length < 1) && partsData.data.partsOrQuestions[0].parts.length > 1) {
|
||||||
|
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_PARTS, this.$route, {}, {}, partsData.data);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.$router.navigate(this.navigationScenarios.CONTINUING_WITH_SINGLE_PART, this.$route);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateZip(zip) {
|
||||||
|
return baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||||
|
storeActions.VALIDATE_ZIP,
|
||||||
|
{ zip });
|
||||||
|
},
|
||||||
|
lookupVin(lastName, streetAddress, zip, state) {
|
||||||
|
return baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||||
|
storeActions.LOOKUP_VIN_BY_ADDRESS,
|
||||||
|
{
|
||||||
|
licenseLastName: lastName,
|
||||||
|
licenseStreetAddress: streetAddress,
|
||||||
|
licenseZip: zip,
|
||||||
|
licenseState: state
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue