Clean up
This commit is contained in:
parent
0a78965a37
commit
80d5f95970
2 changed files with 6 additions and 79 deletions
|
|
@ -22,9 +22,6 @@
|
||||||
cmsWidgetName="MobileFeeDisclaimerWidget"
|
cmsWidgetName="MobileFeeDisclaimerWidget"
|
||||||
typeStyle="caption" />
|
typeStyle="caption" />
|
||||||
</div>
|
</div>
|
||||||
<div v-show="errorMessage" class="row my-1 form-test-error">
|
|
||||||
<span class="small mt-0" role="alert">{{ errorMessage }}</span>
|
|
||||||
</div>
|
|
||||||
<modal
|
<modal
|
||||||
:ref="modalName"
|
:ref="modalName"
|
||||||
:headerText="modalHeaderText"
|
:headerText="modalHeaderText"
|
||||||
|
|
@ -60,7 +57,6 @@ import alert from "@/ux-components/alert/alert";
|
||||||
import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions";
|
import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions";
|
||||||
import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question";
|
import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import { useField } from "vee-validate";
|
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import { deepClone } from "@/layouts/service-location/helpers/object-cloning-helper/object-cloning-helper";
|
import { deepClone } from "@/layouts/service-location/helpers/object-cloning-helper/object-cloning-helper";
|
||||||
|
|
@ -75,36 +71,6 @@ export default {
|
||||||
displayInvalidZipAlert: false,
|
displayInvalidZipAlert: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
setup(props) {
|
|
||||||
const inputId = `component-${crypto.randomUUID()}`;
|
|
||||||
|
|
||||||
const propsClone = Object.assign({}, props);
|
|
||||||
const modelValue = propsClone.modelValue;
|
|
||||||
|
|
||||||
const initialValue = modelValue;
|
|
||||||
|
|
||||||
const fieldOptions = {
|
|
||||||
type: "object",
|
|
||||||
value: modelValue,
|
|
||||||
initialValue: initialValue,
|
|
||||||
};
|
|
||||||
|
|
||||||
const { errorMessage, handleBlur, handleChange, meta, validate, errors } = useField(
|
|
||||||
inputId,
|
|
||||||
props.validationRules,
|
|
||||||
fieldOptions
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
inputId,
|
|
||||||
errorMessage,
|
|
||||||
handleBlur,
|
|
||||||
handleChange,
|
|
||||||
validate,
|
|
||||||
meta,
|
|
||||||
errors,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -127,7 +93,6 @@ export default {
|
||||||
modalWidgetName: String,
|
modalWidgetName: String,
|
||||||
alertNonServiceableZipWidgetName: String,
|
alertNonServiceableZipWidgetName: String,
|
||||||
alertInvalidZipWidgetName: String,
|
alertInvalidZipWidgetName: String,
|
||||||
validationRules: String
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
mobileLocationLinkPromptText() {
|
mobileLocationLinkPromptText() {
|
||||||
|
|
@ -193,8 +158,6 @@ export default {
|
||||||
// on the service-zip-modal-question component
|
// on the service-zip-modal-question component
|
||||||
this.$refs[this.modalName].form.resetForm({
|
this.$refs[this.modalName].form.resetForm({
|
||||||
values: {
|
values: {
|
||||||
autocomplete: updatedServiceZipCodeInfo.streetAddress,
|
|
||||||
city: updatedServiceZipCodeInfo.city,
|
|
||||||
state: updatedServiceZipCodeInfo.state,
|
state: updatedServiceZipCodeInfo.state,
|
||||||
zipCode: updatedServiceZipCodeInfo.zipCode,
|
zipCode: updatedServiceZipCodeInfo.zipCode,
|
||||||
isVehicleProtected: updatedServiceZipCodeInfo.isVehicleProtected,
|
isVehicleProtected: updatedServiceZipCodeInfo.isVehicleProtected,
|
||||||
|
|
@ -234,13 +197,10 @@ export default {
|
||||||
this.internalModel = deepClone(newValue);
|
this.internalModel = deepClone(newValue);
|
||||||
|
|
||||||
this.resetComponent({
|
this.resetComponent({
|
||||||
streetAddress: newValue.addressQuestions.streetAddress,
|
|
||||||
city: newValue.addressQuestions.city,
|
|
||||||
state: newValue.addressQuestions.state,
|
state: newValue.addressQuestions.state,
|
||||||
zipCode: newValue.addressQuestions.zipCode,
|
zipCode: newValue.addressQuestions.zipCode,
|
||||||
isVehicleProtected: newValue.isVehicleProtected,
|
isVehicleProtected: newValue.isVehicleProtected,
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,11 @@
|
||||||
@updated-mobile-fee-part="setMobileFeePart"
|
@updated-mobile-fee-part="setMobileFeePart"
|
||||||
ref="mobileLocationModalQuestions"
|
ref="mobileLocationModalQuestions"
|
||||||
linkWidgetName="MobileLocationLinkWidget"
|
linkWidgetName="MobileLocationLinkWidget"
|
||||||
modalWidgetName="MobileLocationModalWidget"
|
modalWidgetName="MobileLocationModalWidget" />
|
||||||
validationRules="service-address-required"/>
|
|
||||||
<funnel-footer
|
<funnel-footer
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
ref="funnelFooter"
|
ref="funnelFooter"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid || shouldDisableForwardAction"
|
||||||
@back-clicked="backButtonAction"
|
@back-clicked="backButtonAction"
|
||||||
@ForwardClicked="forwardButtonAction" />
|
@ForwardClicked="forwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -43,7 +42,7 @@ import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
|
||||||
import funnelFooter from "@/fmg-components/funnel-footer/funnel-footer";
|
import funnelFooter from "@/fmg-components/funnel-footer/funnel-footer";
|
||||||
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
||||||
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||||
import { Form, defineRule } from "vee-validate";
|
import { Form } from "vee-validate";
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
|
@ -51,24 +50,8 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
|
import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
|
||||||
defineRule("service-address-required", (value) => {
|
|
||||||
const isValid =
|
|
||||||
value.addressQuestions.streetAddress !== "" &&
|
|
||||||
value.addressQuestions.city !== "" &&
|
|
||||||
value.addressQuestions.state !== "" &&
|
|
||||||
value.addressQuestions.zipCode !== "" &&
|
|
||||||
value.isVehicleProtected !== null;
|
|
||||||
|
|
||||||
if (!isValid) {
|
|
||||||
return errorMessages.SERVICE_ADDRESS_REQUIRED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return isValid;
|
|
||||||
});
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "service-location",
|
name: "service-location",
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -156,12 +139,6 @@ export default {
|
||||||
this.state = newValue.addressQuestions.state;
|
this.state = newValue.addressQuestions.state;
|
||||||
this.zipCode = newValue.addressQuestions.zipCode;
|
this.zipCode = newValue.addressQuestions.zipCode;
|
||||||
this.isVehicleProtected = newValue.isVehicleProtected;
|
this.isVehicleProtected = newValue.isVehicleProtected;
|
||||||
|
|
||||||
// setErrors({
|
|
||||||
// mobileLocationQuestions: ""
|
|
||||||
// });
|
|
||||||
|
|
||||||
//this.$refs.theForm.setTouched({});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
shouldDisableForwardAction() {
|
shouldDisableForwardAction() {
|
||||||
|
|
@ -170,7 +147,6 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
store.getters.lineItems.supportingItems !== null &&
|
store.getters.lineItems.supportingItems !== null &&
|
||||||
store.getters.order.serviceLocation.zipCode !== null &&
|
store.getters.order.serviceLocation.zipCode !== null &&
|
||||||
|
|
@ -212,9 +188,9 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
zipCode(newValue, oldValue) {
|
zipCode(current, previous) {
|
||||||
if (newValue !== oldValue) {
|
if (current !== previous) {
|
||||||
baseMixin.methods.getZipCodeData(newValue).then((r) => {
|
baseMixin.methods.getZipCodeData(current).then((r) => {
|
||||||
this.zipContainsMilitaryBase = r.containsMilitaryBase;
|
this.zipContainsMilitaryBase = r.containsMilitaryBase;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -232,12 +208,3 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.form-test-error {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue