Add "allow contact info choice" support for new custorder batch

This commit is contained in:
Lance Edgar 2021-10-06 12:43:38 -04:00
parent 0237d8c31a
commit 2fa7857daf
2 changed files with 254 additions and 235 deletions

View file

@ -155,6 +155,7 @@
<div class="level-item">
{{ orderPhoneNumber }}
</div>
% if allow_contact_info_choice:
<div class="level-item"
v-if="contactPhones.length &gt; 1">
<b-button type="is-primary"
@ -223,6 +224,7 @@
</b-modal>
</div>
% endif
</div>
</div>
</b-field>
@ -239,6 +241,7 @@
(no valid email on file)
</span>
</div>
% if allow_contact_info_choice:
<div class="level-item"
v-if="contactEmails.length &gt; 1">
<b-button type="is-primary"
@ -305,6 +308,7 @@
</div>
</b-modal>
</div>
% endif
</div>
</div>
</b-field>
@ -581,20 +585,26 @@
orderPhoneNumber: ${json.dumps(batch.phone_number)|n},
contactPhones: ${json.dumps(contact_phones)|n},
orderEmailAddress: ${json.dumps(batch.email_address)|n},
contactEmails: ${json.dumps(contact_emails)|n},
% if allow_contact_info_choice:
existingPhoneUUID: null,
otherPhoneNumber: null,
addOtherPhoneNumber: false,
editPhoneNumberShowDialog: false,
editPhoneNumberSaving: false,
orderEmailAddress: ${json.dumps(batch.email_address)|n},
contactEmails: ${json.dumps(contact_emails)|n},
existingEmailUUID: null,
otherEmailAddress: null,
addOtherEmailAddress: false,
editEmailAddressShowDialog: false,
editEmailAddressSaving: false,
% endif
customerName: null,
phoneNumber: null,
contactNotes: ${json.dumps(contact_notes)|n},
@ -722,6 +732,8 @@
}
},
% if allow_contact_info_choice:
editPhoneNumberSaveDisabled() {
if (this.editPhoneNumberSaving) {
return true
@ -756,6 +768,8 @@
return "Save"
},
% endif
itemsPanelHeader() {
let text = "Items"
@ -912,6 +926,8 @@
this.contactChanged(this.contactUUID)
},
% if allow_contact_info_choice:
editPhoneNumberInit() {
this.existingPhoneUUID = null
let normalOrderPhone = this.orderPhoneNumber.replace(/\D/g, '')
@ -1016,6 +1032,8 @@
})
},
% endif
showAddItemDialog() {
this.customerPanelOpen = false
this.editingItem = null

View file

@ -255,6 +255,7 @@ class CustomerOrderView(MasterView):
context = {'batch': batch,
'normalized_batch': self.normalize_batch(batch),
'new_order_requires_customer': self.handler.new_order_requires_customer(),
'allow_contact_info_choice': self.handler.allow_contact_info_choice(),
'restrict_contact_info': self.handler.should_restrict_contact_info(),
'contact_display': self.handler.get_contact_display(batch),
'contact_phones': self.handler.get_contact_phones(batch),