Improve "refresh contact", show new fields in green for custorder

only showing new "customer" fields in green so far
This commit is contained in:
Lance Edgar 2021-10-17 17:28:28 -04:00
parent 52fbe73893
commit ab33b49218
3 changed files with 42 additions and 9 deletions

View file

@ -139,8 +139,9 @@
 
<b-button @click="refreshContact"
icon-pack="fas"
icon-left="redo">
Refresh
icon-left="redo"
:disabled="refreshingContact">
{{ refreshingContact ? "Refreshig" : "Refresh" }}
</b-button>
</div>
</b-field>
@ -362,18 +363,26 @@
<div>
<b-field grouped>
<b-field label="First Name">
<span>{{ newCustomerFirstName }}</span>
<span class="has-text-success">
{{ newCustomerFirstName }}
</span>
</b-field>
<b-field label="Last Name">
<span>{{ newCustomerLastName }}</span>
<span class="has-text-success">
{{ newCustomerLastName }}
</span>
</b-field>
</b-field>
<b-field grouped>
<b-field label="Phone Number">
<span>{{ newCustomerPhone }}</span>
<span class="has-text-success">
{{ newCustomerPhone }}
</span>
</b-field>
<b-field label="Email Address">
<span>{{ newCustomerEmail }}</span>
<span class="has-text-success">
{{ newCustomerEmail }}
</span>
</b-field>
</b-field>
</div>
@ -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:

View file

@ -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):

View file

@ -63,6 +63,7 @@ class CustomerOrderBatchView(BatchMasterView):
'customer',
'person',
'pending_customer',
'contact_name',
'phone_number',
'email_address',
'params',