CSR-1012 | service zip and state now stored in parent
This commit is contained in:
parent
d0842d6713
commit
a8b20d48e6
4 changed files with 44 additions and 91 deletions
|
|
@ -59,7 +59,9 @@ export default {
|
||||||
setup() {
|
setup() {
|
||||||
const modalId = `modal-${crypto.randomUUID()}`;
|
const modalId = `modal-${crypto.randomUUID()}`;
|
||||||
|
|
||||||
return modalId;
|
return {
|
||||||
|
modalId,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async validateAndEmit() {
|
async validateAndEmit() {
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ export default {
|
||||||
isVehicleProtected: Boolean,
|
isVehicleProtected: Boolean,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
cmsWidgetName: String,
|
linkWidgetName: String,
|
||||||
modalWidgetName: String,
|
modalWidgetName: String,
|
||||||
mobileFeeDisclaimerWidgetName: String,
|
mobileFeeDisclaimerWidgetName: String,
|
||||||
workspaceRequirementsWidgetName: String,
|
workspaceRequirementsWidgetName: String,
|
||||||
|
|
@ -92,10 +92,10 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
mobileLocationLinkPromptText() {
|
mobileLocationLinkPromptText() {
|
||||||
return this.getCmsContent(this.cmsWidgetName, "HeaderText");
|
return this.getCmsContent(this.linkWidgetName, "HeaderText");
|
||||||
},
|
},
|
||||||
mobileLocationLinkText() {
|
mobileLocationLinkText() {
|
||||||
return this.getCmsContent(this.cmsWidgetName, "BodyText");
|
return this.getCmsContent(this.linkWidgetName, "BodyText");
|
||||||
},
|
},
|
||||||
getModalId() {
|
getModalId() {
|
||||||
return "#" + this.modalWidgetName;
|
return "#" + this.modalWidgetName;
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@ fmg
|
||||||
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
||||||
<serviceZipModalQuestion
|
<serviceZipModalQuestion
|
||||||
v-model="serviceZipQuestion"
|
v-model="serviceZipQuestion"
|
||||||
cmsWidgetName="ServiceZipModalWidget"
|
linkWidgetName="ServiceZipLinkWidget"
|
||||||
|
modalWidgetName="ServiceZipModalWidget"
|
||||||
textboxQuestionWidgetName="ServiceZipQuestionWidget"
|
textboxQuestionWidgetName="ServiceZipQuestionWidget"
|
||||||
alertNonServiceableZipWidgetName="AlertNonServiceableZipWidget"
|
|
||||||
alertInvalidZipWidgetName="AlertInvalidZipWidget" />
|
alertInvalidZipWidgetName="AlertInvalidZipWidget" />
|
||||||
<mobileLocationModalQuestions
|
<mobileLocationModalQuestions
|
||||||
v-model="mobileLocationQuestions"
|
v-model="mobileLocationQuestions"
|
||||||
cmsWidgetName="MobileLocationLinkWidget"
|
linkWidgetName="MobileLocationLinkWidget"
|
||||||
modalWidgetName="MobileLocationModalWidget"
|
modalWidgetName="MobileLocationModalWidget"
|
||||||
mobileFeeDisclaimerWidgetName="MobileFeeDisclaimerWidget"
|
mobileFeeDisclaimerWidgetName="MobileFeeDisclaimerWidget"
|
||||||
workspaceRequirementsWidgetName="WorkspaceRequirementsWidget" />
|
workspaceRequirementsWidgetName="WorkspaceRequirementsWidget" />
|
||||||
|
|
@ -45,6 +45,7 @@ export default {
|
||||||
serviceZipQuestion: {
|
serviceZipQuestion: {
|
||||||
serviceState: "",
|
serviceState: "",
|
||||||
serviceZipCode: "",
|
serviceZipCode: "",
|
||||||
|
isServiceable: null,
|
||||||
},
|
},
|
||||||
mobileLocationQuestions: {
|
mobileLocationQuestions: {
|
||||||
addressQuestions: {
|
addressQuestions: {
|
||||||
|
|
|
||||||
|
|
@ -5,30 +5,29 @@
|
||||||
:aria-label="serviceLocationLinkPromptText"
|
:aria-label="serviceLocationLinkPromptText"
|
||||||
class="form-label fw-bold w-100 ps-4 pe-4 pt-4"
|
class="form-label fw-bold w-100 ps-4 pe-4 pt-4"
|
||||||
:class="[questionAlignment === 'center' ? 'text-center w-100 mb-5' : '']"
|
:class="[questionAlignment === 'center' ? 'text-center w-100 mb-5' : '']"
|
||||||
v-html="serviceLocationLinkPromptText"></label>
|
v-html="serviceZipLinkText"></label>
|
||||||
<div class="update-zip-text-link">
|
<div class="update-zip-text-link">
|
||||||
<textLink
|
<textLink
|
||||||
id="serviceLocationLinkPromptId"
|
id="serviceLocationLinkPromptId"
|
||||||
linkType="text"
|
linkType="text"
|
||||||
:text="this.serviceZipLinkText"
|
:text="serviceZipDisplayText"
|
||||||
href="#!"
|
href="#!"
|
||||||
@click-event="openZipCodeModal"
|
@click-event="openModal"
|
||||||
aria-label="Modal window" />
|
aria-label="Modal window" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<modal
|
<modal
|
||||||
:ref="modalName"
|
:ref="modalName"
|
||||||
:modalId="modalName"
|
|
||||||
:onModalOpenedCallback="onModalOpened"
|
:onModalOpenedCallback="onModalOpened"
|
||||||
:footerButtonText="footerButtonText"
|
:footerButtonText="modalFooterText"
|
||||||
:headerText="textboxQuestionPrompt"
|
:headerText="textboxQuestionPrompt"
|
||||||
@footer-button-event="setZipCode"
|
@footer-button-event="setZipCode"
|
||||||
:modalForm="modalForm">
|
:modalForm="modalForm">
|
||||||
<textboxQuestion
|
<textboxQuestion
|
||||||
ref="zipInputTextQuestion"
|
ref="zipInputTextQuestion"
|
||||||
:cmsWidgetName="this.textboxQuestionWidgetName"
|
:cmsWidgetName="textboxQuestionWidgetName"
|
||||||
v-model="serviceZipCode"
|
v-model="serviceZipCodeInput"
|
||||||
inputId="serviceZipCode"
|
inputId="zipInputTextQuestionTextbox"
|
||||||
questionAlignment="center"
|
questionAlignment="center"
|
||||||
mask="#####"
|
mask="#####"
|
||||||
:displayQuestionText="false"
|
:displayQuestionText="false"
|
||||||
|
|
@ -39,15 +38,7 @@
|
||||||
ref="alertInvalidZip"
|
ref="alertInvalidZip"
|
||||||
v-if="displayInvalidZipAlert"
|
v-if="displayInvalidZipAlert"
|
||||||
class="my-4"
|
class="my-4"
|
||||||
:cmsWidgetName="this.alertInvalidZipWidgetName"
|
:cmsWidgetName="alertInvalidZipWidgetName"
|
||||||
alertClass="alert-danger"
|
|
||||||
v-bind:isDismissible="false" />
|
|
||||||
<alert
|
|
||||||
ref="alertNonServiceableZip"
|
|
||||||
v-if="displayNonServiceableZipAlert"
|
|
||||||
class="my-4"
|
|
||||||
:cmsWidgetName="this.alertNonServiceableZipWidgetName"
|
|
||||||
:manualHeadline="AlertNonServiceableZipHeader"
|
|
||||||
alertClass="alert-danger"
|
alertClass="alert-danger"
|
||||||
v-bind:isDismissible="false" />
|
v-bind:isDismissible="false" />
|
||||||
</modal>
|
</modal>
|
||||||
|
|
@ -73,11 +64,8 @@ export default {
|
||||||
name: "service-zip-modal-question",
|
name: "service-zip-modal-question",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
serviceZip: this.getZipFromStore(),
|
serviceZipCodeInput: null,
|
||||||
serviceZipState: this.getZipStateFromStore(),
|
|
||||||
serviceZipCodeInput: this.getZipFromStore(),
|
|
||||||
displayInvalidZipAlert: false,
|
displayInvalidZipAlert: false,
|
||||||
displayNonServiceableZipAlert: false,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -87,12 +75,13 @@ export default {
|
||||||
serviceZipQuestion: {
|
serviceZipQuestion: {
|
||||||
serviceState: "",
|
serviceState: "",
|
||||||
serviceZipCode: "",
|
serviceZipCode: "",
|
||||||
|
isServiceable: null,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
cmsWidgetName: String,
|
linkWidgetName: String,
|
||||||
|
modalWidgetName: String,
|
||||||
textboxQuestionWidgetName: String,
|
textboxQuestionWidgetName: String,
|
||||||
alertNonServiceableZipWidgetName: String,
|
|
||||||
alertInvalidZipWidgetName: String,
|
alertInvalidZipWidgetName: String,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
|
@ -104,23 +93,11 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
mobileLocationLinkPromptText() {
|
mobileLocationLinkPromptText() {
|
||||||
return this.getCmsContent(this.cmsWidgetName, "HeaderText");
|
return this.getCmsContent(this.linkWidgetName, "HeaderText");
|
||||||
},
|
|
||||||
|
|
||||||
openZipCodeModal() {
|
|
||||||
this.$refs[this.modalName].openModal();
|
|
||||||
},
|
|
||||||
getZipFromStore() {
|
|
||||||
return this.$store.getters.order.serviceLocation.zipCode;
|
|
||||||
},
|
|
||||||
|
|
||||||
getZipStateFromStore() {
|
|
||||||
return this.$store.getters.order.serviceLocation.state;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
resetAlerts() {
|
resetAlerts() {
|
||||||
this.displayInvalidZipAlert = false;
|
this.displayInvalidZipAlert = false;
|
||||||
this.displayNonServiceableZipAlert = false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
resetsOnZipInput() {
|
resetsOnZipInput() {
|
||||||
|
|
@ -130,21 +107,25 @@ export default {
|
||||||
|
|
||||||
focusOnZipInput() {
|
focusOnZipInput() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const input = this.$refs.zipInputTextQuestion.$refs.serviceZipCodeInput;
|
const input = this.$refs.zipInputTextQuestion.$refs.zipInputTextQuestionTextbox;
|
||||||
input.focus();
|
input.focus();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onModalOpened() {
|
openModal() {
|
||||||
this.serviceZipCodeInput = this.serviceZip;
|
this.$refs[this.modalName].openModal();
|
||||||
this.resetsOnZipInput();
|
|
||||||
this.focusOnZipInput();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.$refs[this.modalName].closeModal();
|
this.$refs[this.modalName].closeModal();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onModalOpened() {
|
||||||
|
this.serviceZipCodeInput = this.serviceZipModel.serviceZipCode;
|
||||||
|
this.resetsOnZipInput();
|
||||||
|
this.focusOnZipInput();
|
||||||
|
},
|
||||||
|
|
||||||
async setZipCode() {
|
async setZipCode() {
|
||||||
this.resetAlerts();
|
this.resetAlerts();
|
||||||
|
|
||||||
|
|
@ -152,11 +133,12 @@ export default {
|
||||||
|
|
||||||
if (!zipCodeData.isValid) {
|
if (!zipCodeData.isValid) {
|
||||||
this.displayInvalidZipAlert = true;
|
this.displayInvalidZipAlert = true;
|
||||||
} else if (!zipCodeData.isServiceable) {
|
|
||||||
this.displayNonServiceableZipAlert = true;
|
|
||||||
} else {
|
} else {
|
||||||
this.serviceZip = this.serviceZipCodeInput;
|
this.serviceZipModel = {
|
||||||
this.serviceZipState = zipCodeData.state;
|
serviceState: zipCodeData.state,
|
||||||
|
serviceZipCode: this.serviceZipCodeInput,
|
||||||
|
isServiceable: zipCodeData.isServiceable,
|
||||||
|
};
|
||||||
|
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
}
|
}
|
||||||
|
|
@ -164,52 +146,27 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
serviceZipLinkPromptText() {
|
serviceZipLinkPromptText() {
|
||||||
return this.getCmsContent(this.cmsWidgetName, "HeaderText");
|
return this.getCmsContent(this.linkWidgetName, "BodyText");
|
||||||
},
|
},
|
||||||
serviceZipLinkText() {
|
serviceZipLinkText() {
|
||||||
return this.getCmsContent(this.cmsWidgetName, "BodyText");
|
return this.getCmsContent(this.linkWidgetName, "HeaderText");
|
||||||
},
|
|
||||||
modalHeaderText() {
|
|
||||||
return this.getCmsContent(this.textboxQuestionWidgetName, "QuestionText");
|
|
||||||
},
|
},
|
||||||
modalFooterText() {
|
modalFooterText() {
|
||||||
return this.getCmsContent(this.modalWidgetName, "FooterText");
|
return this.getCmsContent(this.modalWidgetName, "FooterText");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
textboxQuestionPrompt() {
|
textboxQuestionPrompt() {
|
||||||
return this.getCmsContent(this.textboxQuestionWidgetName, "QuestionText");
|
return this.getCmsContent(this.textboxQuestionWidgetName, "QuestionText");
|
||||||
},
|
},
|
||||||
modalName() {
|
modalName() {
|
||||||
return this.cmsWidgetName;
|
return this.modalWidgetName;
|
||||||
},
|
|
||||||
questionText() {
|
|
||||||
return this.getCmsContent(this.cmsWidgetName, "HeaderText");
|
|
||||||
},
|
},
|
||||||
serviceZipDisplayText() {
|
serviceZipDisplayText() {
|
||||||
if (this.serviceZip && this.serviceZip != 0) {
|
if (this.modelValue.serviceZipCode.length > 0) {
|
||||||
return this.serviceZipState + ", " + this.serviceZip;
|
return this.modelValue.serviceState + ", " + this.modelValue.serviceZipCode;
|
||||||
}
|
}
|
||||||
return (
|
return this.serviceZipLinkPromptText || "Enter your service ZIP";
|
||||||
this.getCmsContent(this.cmsWidgetName, "SubheaderText") || "Enter your service ZIP"
|
|
||||||
);
|
|
||||||
},
|
|
||||||
footerButtonText() {
|
|
||||||
return this.getCmsContent(this.cmsWidgetName, "FooterText");
|
|
||||||
},
|
|
||||||
AlertNonServiceableZipHeader() {
|
|
||||||
const zipCode = this.serviceZipCodeInput;
|
|
||||||
const text = this.getCmsContent(
|
|
||||||
"AlertNonServiceableZipWidget",
|
|
||||||
"HeadlineText"
|
|
||||||
).replaceAll("{custom:serviceZipCodeInput}", zipCode);
|
|
||||||
return text;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
serviceZipModel: {
|
serviceZipModel: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
|
|
@ -219,13 +176,6 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
serviceZipModel: {
|
|
||||||
handler() {
|
|
||||||
this.displayNonServiceableZipAlert = false;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$watch(
|
this.$watch(
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue