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" <b-button @click="refreshContact"
icon-pack="fas" icon-pack="fas"
icon-left="redo"> icon-left="redo"
Refresh :disabled="refreshingContact">
{{ refreshingContact ? "Refreshig" : "Refresh" }}
</b-button> </b-button>
</div> </div>
</b-field> </b-field>
@ -362,18 +363,26 @@
<div> <div>
<b-field grouped> <b-field grouped>
<b-field label="First Name"> <b-field label="First Name">
<span>{{ newCustomerFirstName }}</span> <span class="has-text-success">
{{ newCustomerFirstName }}
</span>
</b-field> </b-field>
<b-field label="Last Name"> <b-field label="Last Name">
<span>{{ newCustomerLastName }}</span> <span class="has-text-success">
{{ newCustomerLastName }}
</span>
</b-field> </b-field>
</b-field> </b-field>
<b-field grouped> <b-field grouped>
<b-field label="Phone Number"> <b-field label="Phone Number">
<span>{{ newCustomerPhone }}</span> <span class="has-text-success">
{{ newCustomerPhone }}
</span>
</b-field> </b-field>
<b-field label="Email Address"> <b-field label="Email Address">
<span>{{ newCustomerEmail }}</span> <span class="has-text-success">
{{ newCustomerEmail }}
</span>
</b-field> </b-field>
</b-field> </b-field>
</div> </div>
@ -680,6 +689,7 @@
contactDisplay: ${json.dumps(contact_display)|n}, contactDisplay: ${json.dumps(contact_display)|n},
customerEntry: null, customerEntry: null,
contactProfileURL: ${json.dumps(contact_profile_url)|n}, contactProfileURL: ${json.dumps(contact_profile_url)|n},
refreshingContact: false,
orderPhoneNumber: ${json.dumps(batch.phone_number)|n}, orderPhoneNumber: ${json.dumps(batch.phone_number)|n},
contactPhones: ${json.dumps(contact_phones)|n}, contactPhones: ${json.dumps(contact_phones)|n},
@ -930,13 +940,20 @@
contactIsKnown: function(val) { 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, // if user has already specified a proper contact,
// i.e. `contactUUID` is not null, *and* user has // i.e. `contactUUID` is not null, *and* user has
// clicked the "contact is not yet in the system" // clicked the "contact is not yet in the system"
// button, i.e. `val` is false, then we want to *clear // button, i.e. `val` is false, then we want to *clear
// out* the existing contact selection. this is // out* the existing contact selection. this is
// primarily to avoid any ambiguity. // primarily to avoid any ambiguity.
if (this.contactUUID && !val) { } else if (this.contactUUID) {
this.$refs.contactAutocomplete.clearSelection() this.$refs.contactAutocomplete.clearSelection()
} }
}, },
@ -1039,7 +1056,7 @@
}) })
}, },
contactChanged(uuid) { contactChanged(uuid, callback) {
let params let params
if (!uuid) { if (!uuid) {
params = { params = {
@ -1067,11 +1084,22 @@
that.contactPhones = response.data.contact_phones that.contactPhones = response.data.contact_phones
that.contactEmails = response.data.contact_emails that.contactEmails = response.data.contact_emails
that.contactNotes = response.data.contact_notes that.contactNotes = response.data.contact_notes
if (callback) {
callback()
}
}) })
}, },
refreshContact() { 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: % if allow_contact_info_choice:

View file

@ -490,6 +490,8 @@ class PendingCustomerView(MasterView):
'address_zipcode', 'address_zipcode',
'address_type', 'address_type',
'status_code', 'status_code',
'created',
'user',
] ]
def configure_grid(self, g): def configure_grid(self, g):
@ -506,6 +508,8 @@ class PendingCustomerView(MasterView):
f.set_enum('status_code', self.enum.PENDING_CUSTOMER_STATUS) 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?? # # TODO: this is referenced by some custom apps, but should be moved??
# def unique_id(value, field): # def unique_id(value, field):

View file

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