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

View file

@ -7,7 +7,10 @@ const navigationScenarios = {
SELECTED_PARTS: "SELECTED_PARTS", SELECTED_PARTS: "SELECTED_PARTS",
SELECTED_DAMAGE_WITH_SINGLE_PART: "SELECTED_DAMAGE_WITH_SINGLE_PART", SELECTED_DAMAGE_WITH_SINGLE_PART: "SELECTED_DAMAGE_WITH_SINGLE_PART",
SELECTED_DAMAGE_WITH_MULTIPLE_PARTS: "SELECTED_DAMAGE_WITH_MULTIPLE_PARTS", 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 }; export { navigationScenarios };

View file

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