Add xref buttons for Customer, Member tabs in profile view
This commit is contained in:
parent
cb6c25f829
commit
f8f6b76657
|
@ -579,6 +579,9 @@
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="render_member_panel_buttons(member)">
|
<%def name="render_member_panel_buttons(member)">
|
||||||
|
% for button in member_xref_buttons:
|
||||||
|
${button}
|
||||||
|
% endfor
|
||||||
% if request.has_perm('members.view'):
|
% if request.has_perm('members.view'):
|
||||||
<b-button tag="a" :href="member.view_url">
|
<b-button tag="a" :href="member.view_url">
|
||||||
View Member
|
View Member
|
||||||
|
@ -665,6 +668,9 @@
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="render_customer_panel_buttons(customer)">
|
<%def name="render_customer_panel_buttons(customer)">
|
||||||
|
% for button in customer_xref_buttons:
|
||||||
|
${button}
|
||||||
|
% endfor
|
||||||
% if request.has_perm('customers.view'):
|
% if request.has_perm('customers.view'):
|
||||||
<b-button tag="a" :href="customer.view_url">
|
<b-button tag="a" :href="customer.view_url">
|
||||||
View Customer
|
View Customer
|
||||||
|
|
|
@ -5107,6 +5107,7 @@ class ViewSupplement(object):
|
||||||
self.request = master.request
|
self.request = master.request
|
||||||
self.model = master.model
|
self.model = master.model
|
||||||
self.rattail_config = master.rattail_config
|
self.rattail_config = master.rattail_config
|
||||||
|
self.Session = master.Session
|
||||||
|
|
||||||
def get_grid_query(self, query):
|
def get_grid_query(self, query):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -417,7 +417,9 @@ class PersonView(MasterView):
|
||||||
'email_type_options': self.get_email_type_options(),
|
'email_type_options': self.get_email_type_options(),
|
||||||
'max_lengths': self.get_max_lengths(),
|
'max_lengths': self.get_max_lengths(),
|
||||||
'customers_data': self.get_context_customers(person),
|
'customers_data': self.get_context_customers(person),
|
||||||
|
'customer_xref_buttons': self.get_customer_xref_buttons(person),
|
||||||
'members_data': self.get_context_members(person),
|
'members_data': self.get_context_members(person),
|
||||||
|
'member_xref_buttons': self.get_member_xref_buttons(person),
|
||||||
'employee': employee,
|
'employee': employee,
|
||||||
'employee_data': self.get_context_employee(employee) if employee else {},
|
'employee_data': self.get_context_employee(employee) if employee else {},
|
||||||
'employee_view_url': self.request.route_url('employees.view', uuid=employee.uuid) if employee else None,
|
'employee_view_url': self.request.route_url('employees.view', uuid=employee.uuid) if employee else None,
|
||||||
|
@ -430,6 +432,22 @@ class PersonView(MasterView):
|
||||||
template = 'view_profile_buefy' if use_buefy else 'view_profile'
|
template = 'view_profile_buefy' if use_buefy else 'view_profile'
|
||||||
return self.render_to_response(template, context)
|
return self.render_to_response(template, context)
|
||||||
|
|
||||||
|
def get_customer_xref_buttons(self, person):
|
||||||
|
buttons = []
|
||||||
|
for supp in self.iter_view_supplements():
|
||||||
|
if hasattr(supp, 'get_customer_xref_buttons'):
|
||||||
|
buttons.extend(supp.get_customer_xref_buttons(person) or [])
|
||||||
|
buttons = self.normalize_xref_buttons(buttons)
|
||||||
|
return buttons
|
||||||
|
|
||||||
|
def get_member_xref_buttons(self, person):
|
||||||
|
buttons = []
|
||||||
|
for supp in self.iter_view_supplements():
|
||||||
|
if hasattr(supp, 'get_member_xref_buttons'):
|
||||||
|
buttons.extend(supp.get_member_xref_buttons(person) or [])
|
||||||
|
buttons = self.normalize_xref_buttons(buttons)
|
||||||
|
return buttons
|
||||||
|
|
||||||
def template_kwargs_view_profile(self, **kwargs):
|
def template_kwargs_view_profile(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
Stub method so subclass can call `super()` for it.
|
Stub method so subclass can call `super()` for it.
|
||||||
|
|
Loading…
Reference in a new issue