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

View file

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