Populate fields and detect changes on submit.
This commit is contained in:
parent
17f149af43
commit
54d155be4d
2 changed files with 29 additions and 4 deletions
|
|
@ -68,11 +68,22 @@ export default {
|
||||||
isSmsOptIn: false,
|
isSmsOptIn: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {},
|
props: {
|
||||||
|
previousCustomerValues: Object,
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
modal() {
|
modal() {
|
||||||
return this.$refs.CustomerDetailsModal;
|
return this.$refs.CustomerDetailsModal;
|
||||||
},
|
},
|
||||||
|
haveCustomerDetailsChanged() {
|
||||||
|
return (
|
||||||
|
this.firstName !== this.previousCustomerValues?.firstName ||
|
||||||
|
this.lastName !== this.previousCustomerValues?.lastName ||
|
||||||
|
this.emailAddress !== this.previousCustomerValues?.emailAddress ||
|
||||||
|
this.phoneNumber !== this.previousCustomerValues?.phoneNumber ||
|
||||||
|
this.isSmsOptIn !== this.previousCustomerValues?.isSmsOptIn
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openModal() {
|
openModal() {
|
||||||
|
|
@ -81,12 +92,24 @@ export default {
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.modal.closeModal();
|
this.modal.closeModal();
|
||||||
},
|
},
|
||||||
onModalOpened() {},
|
onModalOpened() {
|
||||||
|
this.firstName = this.previousCustomerValues?.firstName ?? "";
|
||||||
|
this.lastName = this.previousCustomerValues?.lastName ?? "";
|
||||||
|
this.emailAddress = this.previousCustomerValues?.emailAddress ?? "";
|
||||||
|
this.phoneNumber = this.previousCustomerValues?.phoneNumber ?? "";
|
||||||
|
this.isSmsOptIn = this.previousCustomerValues?.isSmsOptIn ?? false;
|
||||||
|
},
|
||||||
onModalClosed() {},
|
onModalClosed() {},
|
||||||
setModalStatus(isOpened) {
|
setModalStatus(isOpened) {
|
||||||
this.isModalOpened = isOpened;
|
this.isModalOpened = isOpened;
|
||||||
},
|
},
|
||||||
setContactDetails() {},
|
async setContactDetails() {
|
||||||
|
if (this.haveCustomerDetailsChanged) {
|
||||||
|
console.log("change detected");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.closeModal();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
modal,
|
modal,
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,9 @@
|
||||||
<hr class="my-0" />
|
<hr class="my-0" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<customerDetailsModalQuestion ref="customerDetailsModalQuestion" />
|
<customerDetailsModalQuestion
|
||||||
|
ref="customerDetailsModalQuestion"
|
||||||
|
:previousCustomerValues="customerInfo" />
|
||||||
|
|
||||||
<funnelFooter
|
<funnelFooter
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue