Improve display, handling for "add contact info to customer record"

for new custorders page.  in particular, show this flag in main screen
This commit is contained in:
Lance Edgar 2021-10-10 20:43:27 -04:00
parent 3e796e9164
commit 66bc775e14
2 changed files with 47 additions and 27 deletions

View file

@ -153,13 +153,19 @@
<div class="level"> <div class="level">
<div class="level-left"> <div class="level-left">
<div class="level-item"> <div class="level-item">
<span v-if="orderPhoneNumber"> <div v-if="orderPhoneNumber">
<p>
{{ orderPhoneNumber }} {{ orderPhoneNumber }}
</span> </p>
<span v-if="!orderPhoneNumber" <p v-if="addOtherPhoneNumber"
class="is-size-7 is-italic">
will be added to customer record
</p>
</div>
<p v-if="!orderPhoneNumber"
class="has-text-danger"> class="has-text-danger">
(no valid phone number on file) (no valid phone number on file)
</span> </p>
</div> </div>
% if allow_contact_info_choice: % if allow_contact_info_choice:
<div class="level-item" <div class="level-item"
@ -206,9 +212,9 @@
<b-field v-if="!existingPhoneUUID" <b-field v-if="!existingPhoneUUID"
grouped> grouped>
<b-input v-model="otherPhoneNumber"> <b-input v-model="editPhoneNumberOther">
</b-input> </b-input>
<b-checkbox v-model="addOtherPhoneNumber"> <b-checkbox v-model="editPhoneNumberAddOther">
add this phone number to customer record add this phone number to customer record
</b-checkbox> </b-checkbox>
</b-field> </b-field>
@ -241,9 +247,15 @@
<div class="level"> <div class="level">
<div class="level-left"> <div class="level-left">
<div class="level-item"> <div class="level-item">
<span v-if="orderEmailAddress"> <div v-if="orderEmailAddress">
<p>
{{ orderEmailAddress }} {{ orderEmailAddress }}
</span> </p>
<p v-if="addOtherEmailAddress"
class="is-size-7 is-italic">
will be added to customer record
</p>
</div>
<span v-if="!orderEmailAddress" <span v-if="!orderEmailAddress"
class="has-text-danger"> class="has-text-danger">
(no valid email address on file) (no valid email address on file)
@ -293,9 +305,9 @@
<b-field v-if="!existingEmailUUID" <b-field v-if="!existingEmailUUID"
grouped> grouped>
<b-input v-model="otherEmailAddress"> <b-input v-model="editEmailAddressOther">
</b-input> </b-input>
<b-checkbox v-model="addOtherEmailAddress"> <b-checkbox v-model="editEmailAddressAddOther">
add this email address to customer record add this email address to customer record
</b-checkbox> </b-checkbox>
</b-field> </b-field>
@ -671,22 +683,25 @@
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},
addOtherPhoneNumber: ${json.dumps(add_phone_number)|n},
orderEmailAddress: ${json.dumps(batch.email_address)|n}, orderEmailAddress: ${json.dumps(batch.email_address)|n},
contactEmails: ${json.dumps(contact_emails)|n}, contactEmails: ${json.dumps(contact_emails)|n},
addOtherEmailAddress: ${json.dumps(add_email_address)|n},
% if allow_contact_info_choice: % if allow_contact_info_choice:
existingPhoneUUID: null,
otherPhoneNumber: null,
addOtherPhoneNumber: ${json.dumps(add_phone_number)|n},
editPhoneNumberShowDialog: false, editPhoneNumberShowDialog: false,
editPhoneNumberOther: null,
editPhoneNumberAddOther: false,
existingPhoneUUID: null,
editPhoneNumberSaving: false, editPhoneNumberSaving: false,
existingEmailUUID: null,
otherEmailAddress: null,
addOtherEmailAddress: ${json.dumps(add_email_address)|n},
editEmailAddressShowDialog: false, editEmailAddressShowDialog: false,
editEmailAddressOther: null,
editEmailAddressAddOther: false,
existingEmailUUID: null,
editEmailAddressOther: null,
editEmailAddressSaving: false, editEmailAddressSaving: false,
% endif % endif
@ -833,7 +848,7 @@
if (this.editPhoneNumberSaving) { if (this.editPhoneNumberSaving) {
return true return true
} }
if (!this.existingPhoneUUID && !this.otherPhoneNumber) { if (!this.existingPhoneUUID && !this.editPhoneNumberOther) {
return true return true
} }
return false return false
@ -850,7 +865,7 @@
if (this.editEmailAddressSaving) { if (this.editEmailAddressSaving) {
return true return true
} }
if (!this.existingEmailUUID && !this.otherEmailAddress) { if (!this.existingEmailUUID && !this.editEmailAddressOther) {
return true return true
} }
return false return false
@ -1065,7 +1080,8 @@
break break
} }
} }
this.otherPhoneNumber = this.existingPhoneUUID ? null : this.orderPhoneNumber this.editPhoneNumberOther = this.existingPhoneUUID ? null : this.orderPhoneNumber
this.editPhoneNumberAddOther = this.addOtherPhoneNumber
this.editPhoneNumberShowDialog = true this.editPhoneNumberShowDialog = true
}, },
@ -1089,13 +1105,14 @@
if (params.phone_number) { if (params.phone_number) {
params.add_phone_number = false params.add_phone_number = false
} else { } else {
params.phone_number = this.otherPhoneNumber params.phone_number = this.editPhoneNumberOther
params.add_phone_number = this.addOtherPhoneNumber params.add_phone_number = this.editPhoneNumberAddOther
} }
this.submitBatchData(params, response => { this.submitBatchData(params, response => {
if (response.data.success) { if (response.data.success) {
this.orderPhoneNumber = response.data.phone_number this.orderPhoneNumber = response.data.phone_number
this.addOtherPhoneNumber = response.data.add_phone_number
this.editPhoneNumberShowDialog = false this.editPhoneNumberShowDialog = false
} else { } else {
this.$buefy.toast.open({ this.$buefy.toast.open({
@ -1119,9 +1136,9 @@
break break
} }
} }
this.otherEmailAddress = this.existingEmailUUID ? null : this.orderEmailAddress this.editEmailAddressOther = this.existingEmailUUID ? null : this.orderEmailAddress
this.editEmailAddressAddOther = this.addOtherEmailAddress
this.editEmailAddressShowDialog = true this.editEmailAddressShowDialog = true
}, },
editEmailAddressSave() { editEmailAddressSave() {
@ -1144,13 +1161,14 @@
if (params.email_address) { if (params.email_address) {
params.add_email_address = false params.add_email_address = false
} else { } else {
params.email_address = this.otherEmailAddress params.email_address = this.editEmailAddressOther
params.add_email_address = this.addOtherEmailAddress params.add_email_address = this.editEmailAddressAddOther
} }
this.submitBatchData(params, response => { this.submitBatchData(params, response => {
if (response.data.success) { if (response.data.success) {
this.orderEmailAddress = response.data.email_address this.orderEmailAddress = response.data.email_address
this.addOtherEmailAddress = response.data.add_email_address
this.editEmailAddressShowDialog = false this.editEmailAddressShowDialog = false
} else { } else {
this.$buefy.toast.open({ this.$buefy.toast.open({

View file

@ -484,6 +484,7 @@ class CustomerOrderView(MasterView):
return { return {
'success': True, 'success': True,
'phone_number': batch.phone_number, 'phone_number': batch.phone_number,
'add_phone_number': bool(batch.get_param('add_phone_number')),
} }
def update_email_address(self, batch, data): def update_email_address(self, batch, data):
@ -499,6 +500,7 @@ class CustomerOrderView(MasterView):
return { return {
'success': True, 'success': True,
'email_address': batch.email_address, 'email_address': batch.email_address,
'add_email_address': bool(batch.get_param('add_email_address')),
} }
def update_pending_customer(self, batch, data): def update_pending_customer(self, batch, data):