Overhaul the autocomplete component, for sake of new custorder

turns out we had some issues with our understanding of how that all
was supposed to work.  this seems to be much cleaner and even
semi-documented :)
This commit is contained in:
Lance Edgar 2021-10-16 15:37:23 -04:00
parent 232a02b944
commit 52fbe73893
3 changed files with 166 additions and 86 deletions
tailbone/templates/custorders

View file

@ -113,7 +113,7 @@
<div :style="{'flex-grow': contactNotes.length ? 0 : 1}">
<b-field label="Customer" grouped>
<b-field style="margin-left: 1rem;""
<b-field style="margin-left: 1rem;"
:expanded="!contactUUID">
<tailbone-autocomplete ref="contactAutocomplete"
v-model="contactUUID"
@ -927,12 +927,17 @@
}
},
watch: {
contactIsKnown: function(val) {
// if user has already specified a proper contact, then
// clicks the "contact is unknown" button, then we want
// to *clear out* the existing contact
if (!val && this.contactUUID) {
this.contactChanged(null)
// 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) {
this.$refs.contactAutocomplete.clearSelection()
}
},
},
@ -1053,6 +1058,7 @@
% else:
that.contactUUID = response.data.person_uuid
% endif
that.contactDisplay = response.data.contact_display
that.orderPhoneNumber = response.data.phone_number
that.orderEmailAddress = response.data.email_address
that.addOtherPhoneNumber = response.data.add_phone_number