From ab33b49218471b2b851730fa11240cd7f35b894f Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 17 Oct 2021 17:28:28 -0400 Subject: [PATCH] Improve "refresh contact", show new fields in green for custorder only showing new "customer" fields in green so far --- tailbone/templates/custorders/create.mako | 46 ++++++++++++++++++----- tailbone/views/customers.py | 4 ++ tailbone/views/custorders/batch.py | 1 + 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/tailbone/templates/custorders/create.mako b/tailbone/templates/custorders/create.mako index c342e318..2e89783c 100644 --- a/tailbone/templates/custorders/create.mako +++ b/tailbone/templates/custorders/create.mako @@ -139,8 +139,9 @@   - Refresh + icon-left="redo" + :disabled="refreshingContact"> + {{ refreshingContact ? "Refreshig" : "Refresh" }} @@ -362,18 +363,26 @@
- {{ newCustomerFirstName }} + + {{ newCustomerFirstName }} + - {{ newCustomerLastName }} + + {{ newCustomerLastName }} + - {{ newCustomerPhone }} + + {{ newCustomerPhone }} + - {{ newCustomerEmail }} + + {{ newCustomerEmail }} +
@@ -680,6 +689,7 @@ contactDisplay: ${json.dumps(contact_display)|n}, customerEntry: null, contactProfileURL: ${json.dumps(contact_profile_url)|n}, + refreshingContact: false, orderPhoneNumber: ${json.dumps(batch.phone_number)|n}, contactPhones: ${json.dumps(contact_phones)|n}, @@ -930,13 +940,20 @@ contactIsKnown: function(val) { + // when user clicks "contact is known" then we want to + // set focus to the autocomplete component + if (val) { + this.$nextTick(() => { + this.$refs.contactAutocomplete.focus() + }) + // if user has already specified a proper contact, // i.e. `contactUUID` is not null, *and* user has // clicked the "contact is not yet in the system" // button, i.e. `val` is false, then we want to *clear // out* the existing contact selection. this is // primarily to avoid any ambiguity. - if (this.contactUUID && !val) { + } else if (this.contactUUID) { this.$refs.contactAutocomplete.clearSelection() } }, @@ -1039,7 +1056,7 @@ }) }, - contactChanged(uuid) { + contactChanged(uuid, callback) { let params if (!uuid) { params = { @@ -1067,11 +1084,22 @@ that.contactPhones = response.data.contact_phones that.contactEmails = response.data.contact_emails that.contactNotes = response.data.contact_notes + if (callback) { + callback() + } }) }, refreshContact() { - this.contactChanged(this.contactUUID) + this.refreshingContact = true + this.contactChanged(this.contactUUID, () => { + this.refreshingContact = false + this.$buefy.toast.open({ + message: "Contact info has been refreshed.", + type: 'is-success', + duration: 3000, // 3 seconds + }) + }) }, % if allow_contact_info_choice: diff --git a/tailbone/views/customers.py b/tailbone/views/customers.py index 65618c1a..d29d69f2 100644 --- a/tailbone/views/customers.py +++ b/tailbone/views/customers.py @@ -490,6 +490,8 @@ class PendingCustomerView(MasterView): 'address_zipcode', 'address_type', 'status_code', + 'created', + 'user', ] def configure_grid(self, g): @@ -506,6 +508,8 @@ class PendingCustomerView(MasterView): f.set_enum('status_code', self.enum.PENDING_CUSTOMER_STATUS) + f.set_renderer('user', self.render_user) + # # TODO: this is referenced by some custom apps, but should be moved?? # def unique_id(value, field): diff --git a/tailbone/views/custorders/batch.py b/tailbone/views/custorders/batch.py index d70e5e77..ccbf492e 100644 --- a/tailbone/views/custorders/batch.py +++ b/tailbone/views/custorders/batch.py @@ -63,6 +63,7 @@ class CustomerOrderBatchView(BatchMasterView): 'customer', 'person', 'pending_customer', + 'contact_name', 'phone_number', 'email_address', 'params',