Allow customization for Customers tab of Profile view
more tabs to come, this was all i needed for now
This commit is contained in:
parent
907a356bea
commit
60157abd46
2 changed files with 112 additions and 109 deletions
|
@ -297,6 +297,8 @@ class PeopleView(MasterView):
|
|||
'instance': person,
|
||||
'instance_title': self.get_instance_title(person),
|
||||
'today': localtime(self.rattail_config).date(),
|
||||
'person_data': self.get_context_person(person),
|
||||
'customers_data': self.get_context_customers(person),
|
||||
'employee': employee,
|
||||
'employee_view_url': self.request.route_url('employees.view', uuid=employee.uuid) if employee else None,
|
||||
'employee_history': employee.get_current_history() if employee else None,
|
||||
|
@ -307,6 +309,33 @@ class PeopleView(MasterView):
|
|||
template = 'view_profile_buefy' if use_buefy else 'view_profile'
|
||||
return self.render_to_response(template, context)
|
||||
|
||||
def get_context_person(self, person):
|
||||
return {
|
||||
'uuid': person.uuid,
|
||||
'first_name': person.first_name,
|
||||
'last_name': person.last_name,
|
||||
'display_name': person.display_name,
|
||||
'view_url': self.get_action_url('view', person),
|
||||
'view_profile_url': self.get_action_url('view_profile', person),
|
||||
}
|
||||
|
||||
def get_context_customers(self, person):
|
||||
data = []
|
||||
for cp in person._customers:
|
||||
customer = cp.customer
|
||||
data.append({
|
||||
'uuid': customer.uuid,
|
||||
'ordinal': cp.ordinal,
|
||||
'id': customer.id,
|
||||
'number': customer.number,
|
||||
'name': customer.name,
|
||||
'view_url': self.request.route_url('customers.view',
|
||||
uuid=customer.uuid),
|
||||
'people': [self.get_context_person(p)
|
||||
for p in customer.people],
|
||||
})
|
||||
return data
|
||||
|
||||
def get_context_employee_history(self, employee):
|
||||
data = []
|
||||
if employee:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue