From 66bc775e148f2383d77b52f66ebd61cce18b16b8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 10 Oct 2021 20:43:27 -0400 Subject: [PATCH] Improve display, handling for "add contact info to customer record" for new custorders page. in particular, show this flag in main screen --- tailbone/templates/custorders/create.mako | 72 ++++++++++++++--------- tailbone/views/custorders/orders.py | 2 + 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/tailbone/templates/custorders/create.mako b/tailbone/templates/custorders/create.mako index 5aed3c7b..f353c8fc 100644 --- a/tailbone/templates/custorders/create.mako +++ b/tailbone/templates/custorders/create.mako @@ -153,13 +153,19 @@
- - {{ orderPhoneNumber }} - - +

+ {{ orderPhoneNumber }} +

+

+ will be added to customer record +

+
+

(no valid phone number on file) - +

% if allow_contact_info_choice:
- + - + add this phone number to customer record @@ -241,9 +247,15 @@
- - {{ orderEmailAddress }} - +
+

+ {{ orderEmailAddress }} +

+

+ will be added to customer record +

+
(no valid email address on file) @@ -293,9 +305,9 @@ - + - + add this email address to customer record @@ -671,22 +683,25 @@ orderPhoneNumber: ${json.dumps(batch.phone_number)|n}, contactPhones: ${json.dumps(contact_phones)|n}, + addOtherPhoneNumber: ${json.dumps(add_phone_number)|n}, orderEmailAddress: ${json.dumps(batch.email_address)|n}, contactEmails: ${json.dumps(contact_emails)|n}, + addOtherEmailAddress: ${json.dumps(add_email_address)|n}, % if allow_contact_info_choice: - existingPhoneUUID: null, - otherPhoneNumber: null, - addOtherPhoneNumber: ${json.dumps(add_phone_number)|n}, editPhoneNumberShowDialog: false, + editPhoneNumberOther: null, + editPhoneNumberAddOther: false, + existingPhoneUUID: null, editPhoneNumberSaving: false, - existingEmailUUID: null, - otherEmailAddress: null, - addOtherEmailAddress: ${json.dumps(add_email_address)|n}, editEmailAddressShowDialog: false, + editEmailAddressOther: null, + editEmailAddressAddOther: false, + existingEmailUUID: null, + editEmailAddressOther: null, editEmailAddressSaving: false, % endif @@ -833,7 +848,7 @@ if (this.editPhoneNumberSaving) { return true } - if (!this.existingPhoneUUID && !this.otherPhoneNumber) { + if (!this.existingPhoneUUID && !this.editPhoneNumberOther) { return true } return false @@ -850,7 +865,7 @@ if (this.editEmailAddressSaving) { return true } - if (!this.existingEmailUUID && !this.otherEmailAddress) { + if (!this.existingEmailUUID && !this.editEmailAddressOther) { return true } return false @@ -1065,7 +1080,8 @@ break } } - this.otherPhoneNumber = this.existingPhoneUUID ? null : this.orderPhoneNumber + this.editPhoneNumberOther = this.existingPhoneUUID ? null : this.orderPhoneNumber + this.editPhoneNumberAddOther = this.addOtherPhoneNumber this.editPhoneNumberShowDialog = true }, @@ -1089,13 +1105,14 @@ if (params.phone_number) { params.add_phone_number = false } else { - params.phone_number = this.otherPhoneNumber - params.add_phone_number = this.addOtherPhoneNumber + params.phone_number = this.editPhoneNumberOther + params.add_phone_number = this.editPhoneNumberAddOther } this.submitBatchData(params, response => { if (response.data.success) { this.orderPhoneNumber = response.data.phone_number + this.addOtherPhoneNumber = response.data.add_phone_number this.editPhoneNumberShowDialog = false } else { this.$buefy.toast.open({ @@ -1119,9 +1136,9 @@ break } } - this.otherEmailAddress = this.existingEmailUUID ? null : this.orderEmailAddress + this.editEmailAddressOther = this.existingEmailUUID ? null : this.orderEmailAddress + this.editEmailAddressAddOther = this.addOtherEmailAddress this.editEmailAddressShowDialog = true - }, editEmailAddressSave() { @@ -1144,13 +1161,14 @@ if (params.email_address) { params.add_email_address = false } else { - params.email_address = this.otherEmailAddress - params.add_email_address = this.addOtherEmailAddress + params.email_address = this.editEmailAddressOther + params.add_email_address = this.editEmailAddressAddOther } this.submitBatchData(params, response => { if (response.data.success) { this.orderEmailAddress = response.data.email_address + this.addOtherEmailAddress = response.data.add_email_address this.editEmailAddressShowDialog = false } else { this.$buefy.toast.open({ diff --git a/tailbone/views/custorders/orders.py b/tailbone/views/custorders/orders.py index a718486f..a7129d68 100644 --- a/tailbone/views/custorders/orders.py +++ b/tailbone/views/custorders/orders.py @@ -484,6 +484,7 @@ class CustomerOrderView(MasterView): return { 'success': True, 'phone_number': batch.phone_number, + 'add_phone_number': bool(batch.get_param('add_phone_number')), } def update_email_address(self, batch, data): @@ -499,6 +500,7 @@ class CustomerOrderView(MasterView): return { 'success': True, 'email_address': batch.email_address, + 'add_email_address': bool(batch.get_param('add_email_address')), } def update_pending_customer(self, batch, data):