Revert "Revert "Clean up""

This reverts commit 1bc00e31e7.
This commit is contained in:
Leah Schumann 2023-03-20 09:50:05 -04:00
parent 1bc00e31e7
commit be31530bfa
2 changed files with 6 additions and 79 deletions

View file

@ -22,9 +22,6 @@
cmsWidgetName="MobileFeeDisclaimerWidget"
typeStyle="caption" />
</div>
<div v-show="errorMessage" class="row my-1 form-test-error">
<span class="small mt-0" role="alert">{{ errorMessage }}</span>
</div>
<modal
:ref="modalName"
: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 vehicleProtectedQuestion from "@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question";
import store from "@/store";
import { useField } from "vee-validate";
// Helpers
import { deepClone } from "@/layouts/service-location/helpers/object-cloning-helper/object-cloning-helper";
@ -75,36 +71,6 @@ export default {
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: {
modelValue: {
type: Object,
@ -127,7 +93,6 @@ export default {
modalWidgetName: String,
alertNonServiceableZipWidgetName: String,
alertInvalidZipWidgetName: String,
validationRules: String
},
computed: {
mobileLocationLinkPromptText() {
@ -193,8 +158,6 @@ export default {
// on the service-zip-modal-question component
this.$refs[this.modalName].form.resetForm({
values: {
autocomplete: updatedServiceZipCodeInfo.streetAddress,
city: updatedServiceZipCodeInfo.city,
state: updatedServiceZipCodeInfo.state,
zipCode: updatedServiceZipCodeInfo.zipCode,
isVehicleProtected: updatedServiceZipCodeInfo.isVehicleProtected,
@ -234,13 +197,10 @@ export default {
this.internalModel = deepClone(newValue);
this.resetComponent({
streetAddress: newValue.addressQuestions.streetAddress,
city: newValue.addressQuestions.city,
state: newValue.addressQuestions.state,
zipCode: newValue.addressQuestions.zipCode,
isVehicleProtected: newValue.isVehicleProtected,
});
},
deep: true,
},

View file

@ -22,12 +22,11 @@
@updated-mobile-fee-part="setMobileFeePart"
ref="mobileLocationModalQuestions"
linkWidgetName="MobileLocationLinkWidget"
modalWidgetName="MobileLocationModalWidget"
validationRules="service-address-required"/>
modalWidgetName="MobileLocationModalWidget" />
<funnel-footer
cmsWidgetName="FunnelFooterWidget"
ref="funnelFooter"
:isForwardActionDisabled="!meta.valid"
:isForwardActionDisabled="!meta.valid || shouldDisableForwardAction"
@back-clicked="backButtonAction"
@ForwardClicked="forwardButtonAction" />
</div>
@ -43,7 +42,7 @@ import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
import funnelFooter from "@/fmg-components/funnel-footer/funnel-footer";
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
import { Form, defineRule } from "vee-validate";
import { Form } from "vee-validate";
// Supporting files
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 { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
import { errorMessages } from "@/constants/error-messages";
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 {
name: "service-location",
data() {
@ -156,12 +139,6 @@ export default {
this.state = newValue.addressQuestions.state;
this.zipCode = newValue.addressQuestions.zipCode;
this.isVehicleProtected = newValue.isVehicleProtected;
// setErrors({
// mobileLocationQuestions: ""
// });
//this.$refs.theForm.setTouched({});
},
},
shouldDisableForwardAction() {
@ -170,7 +147,6 @@ export default {
},
methods: {
arePagePrerequisitesValid() {
return (
store.getters.lineItems.supportingItems !== null &&
store.getters.order.serviceLocation.zipCode !== null &&
@ -212,9 +188,9 @@ export default {
},
},
watch: {
zipCode(newValue, oldValue) {
if (newValue !== oldValue) {
baseMixin.methods.getZipCodeData(newValue).then((r) => {
zipCode(current, previous) {
if (current !== previous) {
baseMixin.methods.getZipCodeData(current).then((r) => {
this.zipContainsMilitaryBase = r.containsMilitaryBase;
});
}
@ -232,12 +208,3 @@ export default {
},
};
</script>
<style lang="scss">
.form-test-error {
text-align: center;
}
</style>