Add "contact update request" workflow for new custorder batch
if user checks "please add phone to customer record" etc. then this preference is stored in the batch params, and when batch is executed that will "happen" (which may just mean someone gets email about it)
This commit is contained in:
parent
2fa7857daf
commit
9b40096bb7
|
@ -127,8 +127,7 @@
|
||||||
@input="contactChanged">
|
@input="contactChanged">
|
||||||
</tailbone-autocomplete>
|
</tailbone-autocomplete>
|
||||||
</b-field>
|
</b-field>
|
||||||
<div v-if="contactUUID"
|
<div v-if="contactUUID">
|
||||||
class="buttons">
|
|
||||||
<b-button v-if="contactProfileURL"
|
<b-button v-if="contactProfileURL"
|
||||||
type="is-primary"
|
type="is-primary"
|
||||||
tag="a" target="_blank"
|
tag="a" target="_blank"
|
||||||
|
@ -137,6 +136,7 @@
|
||||||
icon-left="external-link-alt">
|
icon-left="external-link-alt">
|
||||||
View Profile
|
View Profile
|
||||||
</b-button>
|
</b-button>
|
||||||
|
|
||||||
<b-button @click="refreshContact"
|
<b-button @click="refreshContact"
|
||||||
icon-pack="fas"
|
icon-pack="fas"
|
||||||
icon-left="redo">
|
icon-left="redo">
|
||||||
|
@ -157,7 +157,10 @@
|
||||||
</div>
|
</div>
|
||||||
% if allow_contact_info_choice:
|
% if allow_contact_info_choice:
|
||||||
<div class="level-item"
|
<div class="level-item"
|
||||||
v-if="contactPhones.length > 1">
|
% if restrict_contact_info:
|
||||||
|
v-if="contactPhones.length > 1"
|
||||||
|
% endif
|
||||||
|
>
|
||||||
<b-button type="is-primary"
|
<b-button type="is-primary"
|
||||||
@click="editPhoneNumberInit()"
|
@click="editPhoneNumberInit()"
|
||||||
icon-pack="fas"
|
icon-pack="fas"
|
||||||
|
@ -199,8 +202,7 @@
|
||||||
grouped>
|
grouped>
|
||||||
<b-input v-model="otherPhoneNumber">
|
<b-input v-model="otherPhoneNumber">
|
||||||
</b-input>
|
</b-input>
|
||||||
<b-checkbox v-model="addOtherPhoneNumber"
|
<b-checkbox v-model="addOtherPhoneNumber">
|
||||||
disabled>
|
|
||||||
add this phone number to customer record
|
add this phone number to customer record
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
@ -243,7 +245,10 @@
|
||||||
</div>
|
</div>
|
||||||
% if allow_contact_info_choice:
|
% if allow_contact_info_choice:
|
||||||
<div class="level-item"
|
<div class="level-item"
|
||||||
v-if="contactEmails.length > 1">
|
% if restrict_contact_info:
|
||||||
|
v-if="contactEmails.length > 1"
|
||||||
|
% endif
|
||||||
|
>
|
||||||
<b-button type="is-primary"
|
<b-button type="is-primary"
|
||||||
@click="editEmailAddressInit()"
|
@click="editEmailAddressInit()"
|
||||||
icon-pack="fas"
|
icon-pack="fas"
|
||||||
|
@ -284,8 +289,7 @@
|
||||||
grouped>
|
grouped>
|
||||||
<b-input v-model="otherEmailAddress">
|
<b-input v-model="otherEmailAddress">
|
||||||
</b-input>
|
</b-input>
|
||||||
<b-checkbox v-model="addOtherEmailAddress"
|
<b-checkbox v-model="addOtherEmailAddress">
|
||||||
disabled>
|
|
||||||
add this email address to customer record
|
add this email address to customer record
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
@ -593,13 +597,13 @@
|
||||||
|
|
||||||
existingPhoneUUID: null,
|
existingPhoneUUID: null,
|
||||||
otherPhoneNumber: null,
|
otherPhoneNumber: null,
|
||||||
addOtherPhoneNumber: false,
|
addOtherPhoneNumber: ${json.dumps(add_phone_number)|n},
|
||||||
editPhoneNumberShowDialog: false,
|
editPhoneNumberShowDialog: false,
|
||||||
editPhoneNumberSaving: false,
|
editPhoneNumberSaving: false,
|
||||||
|
|
||||||
existingEmailUUID: null,
|
existingEmailUUID: null,
|
||||||
otherEmailAddress: null,
|
otherEmailAddress: null,
|
||||||
addOtherEmailAddress: false,
|
addOtherEmailAddress: ${json.dumps(add_email_address)|n},
|
||||||
editEmailAddressShowDialog: false,
|
editEmailAddressShowDialog: false,
|
||||||
editEmailAddressSaving: false,
|
editEmailAddressSaving: false,
|
||||||
|
|
||||||
|
@ -915,6 +919,8 @@
|
||||||
% endif
|
% endif
|
||||||
that.orderPhoneNumber = response.data.phone_number
|
that.orderPhoneNumber = response.data.phone_number
|
||||||
that.orderEmailAddress = response.data.email_address
|
that.orderEmailAddress = response.data.email_address
|
||||||
|
that.addOtherPhoneNumber = response.data.add_phone_number
|
||||||
|
that.addOtherEmailAddres = response.data.add_email_address
|
||||||
that.contactProfileURL = response.data.contact_profile_url
|
that.contactProfileURL = response.data.contact_profile_url
|
||||||
that.contactPhones = response.data.contact_phones
|
that.contactPhones = response.data.contact_phones
|
||||||
that.contactEmails = response.data.contact_emails
|
that.contactEmails = response.data.contact_emails
|
||||||
|
@ -959,9 +965,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.phone_number) {
|
if (params.phone_number) {
|
||||||
|
params.add_phone_number = false
|
||||||
|
} else {
|
||||||
params.phone_number = this.otherPhoneNumber
|
params.phone_number = this.otherPhoneNumber
|
||||||
// params.add_phone_number = this.addOtherPhoneNumber
|
params.add_phone_number = this.addOtherPhoneNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
this.submitBatchData(params, response => {
|
this.submitBatchData(params, response => {
|
||||||
|
@ -1012,9 +1020,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.email_address) {
|
if (params.email_address) {
|
||||||
|
params.add_email_address = false
|
||||||
|
} else {
|
||||||
params.email_address = this.otherEmailAddress
|
params.email_address = this.otherEmailAddress
|
||||||
// params.add_email_address = this.addOtherEmailAddress
|
params.add_email_address = this.addOtherEmailAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
this.submitBatchData(params, response => {
|
this.submitBatchData(params, response => {
|
||||||
|
|
|
@ -63,6 +63,7 @@ class CustomerOrderBatchView(BatchMasterView):
|
||||||
'person',
|
'person',
|
||||||
'phone_number',
|
'phone_number',
|
||||||
'email_address',
|
'email_address',
|
||||||
|
'params',
|
||||||
'created',
|
'created',
|
||||||
'created_by',
|
'created_by',
|
||||||
'rowcount',
|
'rowcount',
|
||||||
|
|
|
@ -260,6 +260,8 @@ class CustomerOrderView(MasterView):
|
||||||
'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),
|
||||||
'contact_emails': self.handler.get_contact_emails(batch),
|
'contact_emails': self.handler.get_contact_emails(batch),
|
||||||
|
'add_phone_number': bool(batch.get_param('add_phone_number')),
|
||||||
|
'add_email_address': bool(batch.get_param('add_email_address')),
|
||||||
'contact_profile_url': None,
|
'contact_profile_url': None,
|
||||||
'contact_notes': self.handler.get_contact_notes(batch),
|
'contact_notes': self.handler.get_contact_notes(batch),
|
||||||
'order_items': items,
|
'order_items': items,
|
||||||
|
@ -405,6 +407,8 @@ class CustomerOrderView(MasterView):
|
||||||
'contact_phones': self.handler.get_contact_phones(batch),
|
'contact_phones': self.handler.get_contact_phones(batch),
|
||||||
'contact_emails': self.handler.get_contact_emails(batch),
|
'contact_emails': self.handler.get_contact_emails(batch),
|
||||||
'contact_notes': self.handler.get_contact_notes(batch),
|
'contact_notes': self.handler.get_contact_notes(batch),
|
||||||
|
'add_phone_number': bool(batch.get_param('add_phone_number')),
|
||||||
|
'add_email_address': bool(batch.get_param('add_email_address')),
|
||||||
}
|
}
|
||||||
|
|
||||||
# maybe add profile URL
|
# maybe add profile URL
|
||||||
|
@ -426,9 +430,13 @@ class CustomerOrderView(MasterView):
|
||||||
app = self.get_rattail_app()
|
app = self.get_rattail_app()
|
||||||
|
|
||||||
batch.phone_number = app.format_phone_number(data['phone_number'])
|
batch.phone_number = app.format_phone_number(data['phone_number'])
|
||||||
self.Session.flush()
|
|
||||||
self.Session.refresh(batch)
|
|
||||||
|
|
||||||
|
if data.get('add_phone_number'):
|
||||||
|
batch.set_param('add_phone_number', True)
|
||||||
|
else:
|
||||||
|
batch.clear_param('add_phone_number')
|
||||||
|
|
||||||
|
self.Session.flush()
|
||||||
return {
|
return {
|
||||||
'success': True,
|
'success': True,
|
||||||
'phone_number': batch.phone_number,
|
'phone_number': batch.phone_number,
|
||||||
|
@ -437,9 +445,13 @@ class CustomerOrderView(MasterView):
|
||||||
def update_email_address(self, batch, data):
|
def update_email_address(self, batch, data):
|
||||||
|
|
||||||
batch.email_address = data['email_address']
|
batch.email_address = data['email_address']
|
||||||
self.Session.flush()
|
|
||||||
self.Session.refresh(batch)
|
|
||||||
|
|
||||||
|
if data.get('add_email_address'):
|
||||||
|
batch.set_param('add_email_address', True)
|
||||||
|
else:
|
||||||
|
batch.clear_param('add_email_address')
|
||||||
|
|
||||||
|
self.Session.flush()
|
||||||
return {
|
return {
|
||||||
'success': True,
|
'success': True,
|
||||||
'email_address': batch.email_address,
|
'email_address': batch.email_address,
|
||||||
|
|
Loading…
Reference in a new issue