From 4c4cefde6dfdd412f2c0a0b9bbb388afe963703a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 4 May 2019 03:19:40 -0500 Subject: [PATCH] Add basic Buefy support for full "profile" view for Person --- .../templates/people/view_profile_buefy.mako | 413 ++++++++++++++++++ tailbone/views/people.py | 4 +- 2 files changed, 416 insertions(+), 1 deletion(-) create mode 100644 tailbone/templates/people/view_profile_buefy.mako diff --git a/tailbone/templates/people/view_profile_buefy.mako b/tailbone/templates/people/view_profile_buefy.mako new file mode 100644 index 00000000..6c3bf351 --- /dev/null +++ b/tailbone/templates/people/view_profile_buefy.mako @@ -0,0 +1,413 @@ +## -*- coding: utf-8; -*- +<%inherit file="/master/view.mako" /> + +
+ + + +
+ +
+ +
+
+ +
+ ${person.first_name} +
+
+
+ +
+
+ +
+ ${person.middle_name} +
+
+
+ +
+
+ +
+ ${person.last_name} +
+
+
+ +
+
+ +
+ ${person.address.street if person.address else ''} +
+
+
+ +
+
+ +
+ ${person.address.street2 if person.address else ''} +
+
+
+ +
+
+ +
+ ${person.address.city if person.address else ''} +
+
+
+ +
+
+ +
+ ${person.address.state if person.address else ''} +
+
+
+ +
+
+ +
+ ${person.address.zipcode if person.address else ''} +
+
+
+ + % if person.phones: + % for phone in person.phones: +
+
+ +
+ ${phone.number} (type: ${phone.type}) +
+
+
+ % endfor + % else: +
+
+ +
+ (none on file) +
+
+
+ % endif + + % if person.emails: + % for email in person.emails: +
+
+ +
+ ${email.address} (type: ${email.type}) +
+
+
+ % endfor + % else: +
+
+ +
+ (none on file) +
+
+
+ % endif + +
+ +
+ % if request.has_perm('people.view'): + ${h.link_to("View Person", url('people.view', uuid=person.uuid), class_='button')} + % endif +
+ +
+
+ + + % if person.customers: +

${person} is associated with ${len(person.customers)} customer account(s)

+
+
+ % for customer in person.customers: + + + +
+ ${customer.id} - ${customer.name} +
+ +
+ +
+ +
+ +
+
+ +
+ ${customer.id or ''} +
+
+
+ +
+
+ +
+ ${customer.name} +
+
+
+ + % if customer.phones: + % for phone in customer.phones: +
+
+ +
+ ${phone.number} (type: ${phone.type}) +
+
+
+ % endfor + % else: +
+
+ +
+ (none on file) +
+
+
+ % endif + + % if customer.emails: + % for email in customer.emails: +
+
+ +
+ ${email.address} (type: ${email.type}) +
+
+
+ % endfor + % else: +
+
+ +
+ (none on file) +
+
+
+ % endif + +
+ +
+ % if request.has_perm('customers.view'): + ${h.link_to("View Customer", url('customers.view', uuid=customer.uuid), class_='button')} + % endif +
+ +
+ +
+
+ % endfor +
+ + % else: +

${person} has never been a customer.

+ % endif +
+ + + + % if employee: +
+ +
+ +
+
+ +
+ ${employee.id or ''} +
+
+
+ +
+
+ +
+ ${employee.display_name or ''} +
+
+
+ +
+
+ +
+ ${enum.EMPLOYEE_STATUS.get(employee.status, '')} +
+
+
+ + % if employee.phones: + % for phone in employee.phones: +
+
+ +
+ ${phone.number} (type: ${phone.type}) +
+
+
+ % endfor + % else: +
+
+ +
+ (none on file) +
+
+
+ % endif + + % if employee.emails: + % for email in employee.emails: +
+
+ +
+ ${email.address} (type: ${email.type}) +
+
+
+ % endfor + % else: +
+
+ +
+ (none on file) +
+
+
+ % endif + +
+ +
+ % if request.has_perm('employees.view'): + ${h.link_to("View Employee", url('employees.view', uuid=employee.uuid), class_='button')} + % endif +
+ +
+ + % else: +

${person} has never been an employee.

+ % endif +
+ + + % if person.users: +

${person} is associated with ${len(person.users)} user account(s)

+
+
+ % for user in person.users: + + + +
+ ${user.username} +
+ +
+ +
+ +
+ +
+
+ +
+ ${user.username} +
+
+
+ +
+ +
+ % if request.has_perm('users.view'): + ${h.link_to("View User", url('users.view', uuid=user.uuid), class_='button')} + % endif +
+ +
+ +
+
+ % endfor +
+ + % else: +

${person} has never been a user.

+ % endif +
+ +
+
+ + diff --git a/tailbone/views/people.py b/tailbone/views/people.py index 36539e07..584ed51f 100644 --- a/tailbone/views/people.py +++ b/tailbone/views/people.py @@ -240,7 +240,9 @@ class PeopleView(MasterView): 'employee': employee, 'employee_history': employee.get_current_history() if employee else None, } - return self.render_to_response('view_profile', context) + use_buefy = self.get_use_buefy() + template = 'view_profile_buefy' if use_buefy else 'view_profile' + return self.render_to_response(template, context) def make_user(self): uuid = self.request.POST['person_uuid']