CSR-1012 | reset modal on text input
added prop to textbox-question to fire custom function on text updates
This commit is contained in:
parent
651a4fa0c3
commit
a6e3c47aa9
2 changed files with 18 additions and 7 deletions
|
|
@ -70,6 +70,7 @@ export default {
|
||||||
questionAlignment: String, // Left or center. Left is default.
|
questionAlignment: String, // Left or center. Left is default.
|
||||||
cornerStyle: String, // Rounded or square. Square is default.
|
cornerStyle: String, // Rounded or square. Square is default.
|
||||||
includeSearchIcon: Boolean,
|
includeSearchIcon: Boolean,
|
||||||
|
customOnChange: Function,
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const propsClone = Object.assign({}, props);
|
const propsClone = Object.assign({}, props);
|
||||||
|
|
@ -145,6 +146,7 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
async value(newValue) {
|
async value(newValue) {
|
||||||
|
this.customOnChange();
|
||||||
const result = await validate(newValue, this.validationRules); // do a test validation check, without triggering full validation
|
const result = await validate(newValue, this.validationRules); // do a test validation check, without triggering full validation
|
||||||
if (result.valid) {
|
if (result.valid) {
|
||||||
this.handleChange(newValue); // trigger full validation on this field only
|
this.handleChange(newValue); // trigger full validation on this field only
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,8 @@
|
||||||
mask="#####"
|
mask="#####"
|
||||||
isRequired
|
isRequired
|
||||||
disableAutoFill
|
disableAutoFill
|
||||||
validationRules="zip-required|zip-format" />
|
validationRules="zip-required|zip-format"
|
||||||
|
:customOnChange="this.resetsOnZipInput" />
|
||||||
<alert
|
<alert
|
||||||
ref="alertInvalidZip"
|
ref="alertInvalidZip"
|
||||||
v-if="displayInvalidZipAlert"
|
v-if="displayInvalidZipAlert"
|
||||||
|
|
@ -39,7 +40,7 @@
|
||||||
v-if="displayNonServiceableZipAlert"
|
v-if="displayNonServiceableZipAlert"
|
||||||
class="my-4"
|
class="my-4"
|
||||||
:cmsWidgetName="this.alertNonServiceableZipWidgetName"
|
:cmsWidgetName="this.alertNonServiceableZipWidgetName"
|
||||||
:manualHeadline="this.invalidAlertHeader"
|
:manualHeadline="AlertNonServiceableZipHeader"
|
||||||
alertClass="alert-danger"
|
alertClass="alert-danger"
|
||||||
v-bind:isDismissible="false" />
|
v-bind:isDismissible="false" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -71,7 +72,6 @@ export default {
|
||||||
serviceZipCodeInput: this.getZipFromStore(),
|
serviceZipCodeInput: this.getZipFromStore(),
|
||||||
displayInvalidZipAlert: false,
|
displayInvalidZipAlert: false,
|
||||||
displayNonServiceableZipAlert: false,
|
displayNonServiceableZipAlert: false,
|
||||||
invalidAlertHeader: null,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -95,6 +95,11 @@ export default {
|
||||||
this.displayNonServiceableZipAlert = false;
|
this.displayNonServiceableZipAlert = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetsOnZipInput() {
|
||||||
|
this.resetAlerts();
|
||||||
|
this.$refs.zipCodeInputModal.resetButtonStyle();
|
||||||
|
},
|
||||||
|
|
||||||
async setZip() {
|
async setZip() {
|
||||||
this.resetAlerts();
|
this.resetAlerts();
|
||||||
|
|
||||||
|
|
@ -109,10 +114,6 @@ export default {
|
||||||
if (!zipCodeData.isValid) {
|
if (!zipCodeData.isValid) {
|
||||||
this.displayInvalidZipAlert = true;
|
this.displayInvalidZipAlert = true;
|
||||||
} else if (!zipCodeData.isServiceable) {
|
} else if (!zipCodeData.isServiceable) {
|
||||||
this.invalidAlertHeader = this.getCmsContent(
|
|
||||||
this.alertNonServiceableZipWidgetName,
|
|
||||||
"HeadlineText"
|
|
||||||
).replaceAll("{custom:serviceZipCodeInput}", this.serviceZipCodeInput);
|
|
||||||
this.displayNonServiceableZipAlert = true;
|
this.displayNonServiceableZipAlert = true;
|
||||||
} else {
|
} else {
|
||||||
this.serviceZip = this.serviceZipCodeInput;
|
this.serviceZip = this.serviceZipCodeInput;
|
||||||
|
|
@ -135,6 +136,14 @@ export default {
|
||||||
}
|
}
|
||||||
return this.getCmsContent(this.cmsWidgetName, "FooterText");
|
return this.getCmsContent(this.cmsWidgetName, "FooterText");
|
||||||
},
|
},
|
||||||
|
AlertNonServiceableZipHeader() {
|
||||||
|
const zipCode = this.serviceZipCodeInput;
|
||||||
|
const text = this.getCmsContent(
|
||||||
|
"AlertNonServiceableZipWidget",
|
||||||
|
"HeadlineText"
|
||||||
|
).replaceAll("{custom:serviceZipCodeInput}", zipCode);
|
||||||
|
return text;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
textLink,
|
textLink,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue