More lpl features

This commit is contained in:
Max 2022-03-22 15:19:04 -04:00
parent ebc30c7776
commit 52d58bb2ea
3 changed files with 58 additions and 21 deletions

View file

@ -3,7 +3,30 @@
<funnelHeader ref="funnelHeader" />
<vehicleBanner ref="vehicleBanner" :displayGenericVehicleImage="false" />
<funnelSubHeader ref="funnelSubHeader" />
<textboxQuestion />
<input type="text" id="license_plate" v-model="licensePlate">
<input type="text" id="zip" v-model="zip">
<input type="text" id="email" v-model="email">
<alert
class="my-3"
v-if="newServiceZipRequired"
alertClass="alert-danger"
:alertHeadline="noServiceZipWidget.headline"
:alertCopy="noServiceZipWidget.copy"
/>
<alert
class="my-3"
v-if="vinNotValid"
alertClass="alert-danger"
:alertHeadline="noMatchAlertWidget.headline"
:alertCopy="noMatchAlertWidget.copy"
/>
<alert
class="my-3"
v-if="vinDoesNotMatchCarId"
alertClass="alert-danger"
:alertHeadline="matchedDifferentVehicleAlertWidget.headline"
:alertCopy="matchedDifferentVehicleAlertWidget.copy"
/>
<funnelFooter
ref="funnelFooter"
@back-clicked="backButtonAction"
@ -18,7 +41,7 @@ import funnelHeader from "@/common-components/funnel-header/funnel-header";
import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
import textboxQuestion from "@/common-components/textbox-question/textbox-question";
import alert from "@/ux-components/alert/alert";
// Supporting files
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
@ -58,10 +81,18 @@ export default {
vm.$refs.funnelFooter.initializeComponent(
resultMap.cmsContent.FunnelFooterWidget
);
// vm.$refs.licensePlateNumber.initializeComponent(
// resultMap.cmsContent.LicensePlateNumber
// );
console.log(resultMap);
vm.noServiceZipWidget = {
headline: resultMap.cmsContent.NoServiceZipWidget.HeadlineText,
copy: resultMap.cmsContent.NoServiceZipWidget.BodyText
};
vm.noMatchAlertWidget = {
headline: resultMap.cmsContent.NoMatchAlertWidget.HeadlineText,
copy: resultMap.cmsContent.NoMatchAlertWidget.BodyText
};
vm.matchedDifferentVehicleAlertWidget = {
headline: resultMap.cmsContent.MatchedDifferentVehicleAlertWidget.HeadlineText,
copy: resultMap.cmsContent.MatchedDifferentVehicleAlertWidget.BodyText
};
});
},
data() {
@ -69,6 +100,9 @@ export default {
newServiceZipRequired: false,
vinNotValid: false,
vinDoesNotMatchCarId: false,
licensePlate: 'HWV4445',
zip: '43224',
email: 'maxjdempsey@gmail.com',
};
},
methods: {
@ -86,18 +120,18 @@ export default {
// route to move backwards
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
},
async forwardButtonAction(zip, plate) {
const zipValidation = await this.validateZip(zip);
const vinLookup = await this.lookupVin(plate);
if (!zipValidation.isServiceable) {
async forwardButtonAction() {
const zipValidation = await this.validateZip(this.zip);
if (!zipValidation.data.isServiceable) {
this.newServiceZipRequired = true;
return;
}
if (!vinLookup.vin) {
const vinLookup = await this.lookupVin(this.licensePlate, zipValidation.data.state);
if (!vinLookup.data.vin) {
this.vinNotValid = true;
return;
}
if (vinLookup.vehicle.carId !== store.getters.vehicle.carId) {
if (vinLookup.data.vehicle.carId !== store.getters.vehicle.carId) {
this.vinDoesNotMatchCarId = true;
return;
}
@ -107,19 +141,18 @@ export default {
{
carId: store.getters.vehicle.carId,
glassArray: store.getters.damage.glassToReplace,
zipCode: zip,
zipCode: this.zip,
vin: vinLookup.vin
},
false
);
this.navigateForward(partsData);
},
navigateForward(partsData){
if(partsData.data.partsOrQuestions.partQuestions.length){
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.partQuestions.length && partsData.data.partsOrQuestions.parts.length > 1) {
} 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 {
@ -135,7 +168,7 @@ export default {
lookupVin(plate, state) {
return baseMixin.methods.dispatchNonBlockingStoreAction(
storeActions.LOOKUP_VIN_BY_PLATE,
{ plate, state }
{ licensePlate: plate, licenseState: state }
);
},
updateStore() {
@ -163,7 +196,7 @@ export default {
funnelHeader,
funnelFooter,
vehicleBanner,
textboxQuestion,
alert,
funnelSubHeader,
},
};

View file

@ -7,7 +7,10 @@ const navigationScenarios = {
SELECTED_PARTS: "SELECTED_PARTS",
SELECTED_DAMAGE_WITH_SINGLE_PART: "SELECTED_DAMAGE_WITH_SINGLE_PART",
SELECTED_DAMAGE_WITH_MULTIPLE_PARTS: "SELECTED_DAMAGE_WITH_MULTIPLE_PARTS",
SELECTED_DAMAGE_WITH_PART_QUESTIONS: "SELECTED_DAMAGE_WITH_PART_QUESTIONS"
SELECTED_DAMAGE_WITH_PART_QUESTIONS: "SELECTED_DAMAGE_WITH_PART_QUESTIONS",
CONTINUING_WITH_PARTS_QUESTION: "CONTINUING_WITH_PARTS_QUESTION",
CONTINUING_WITH_MULTIPLE_PARTS: "CONTINUING_WITH_MULTIPLE_PARTS",
CONTINUING_WITH_SINGLE_PART: "CONTINUING_WITH_SINGLE_PART"
};
export { navigationScenarios };

View file

@ -220,12 +220,13 @@ export const actions = {
},
});
},
lookupVinByPlate(context, { plate }) {
lookupVinByPlate(context, { licensePlate, licenseState }) {
return globalMethods.callHttpClient({
method: endpoints.LookupVinByPlate.method,
endpoint: endpoints.LookupVinByPlate.url,
payload: {
plate: plate,
licensePlate: licensePlate,
licenseState: licenseState
},
});
},