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

View file

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