From 1453d33123ff88cff282b2680dd719fc3d8c9aaf Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 25 Jan 2018 17:02:53 -0600 Subject: [PATCH] Add support for extra column(s) in timesheet view table --- tailbone/helpers.py | 2 +- tailbone/subscribers.py | 2 ++ tailbone/templates/shifts/base.mako | 13 +++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tailbone/helpers.py b/tailbone/helpers.py index 83c79518..67e90fb5 100644 --- a/tailbone/helpers.py +++ b/tailbone/helpers.py @@ -30,7 +30,7 @@ import datetime from decimal import Decimal from rattail.time import localtime, make_utc -from rattail.util import pretty_quantity +from rattail.util import pretty_quantity, pretty_hours from webhelpers2.html import * from webhelpers2.html.tags import * diff --git a/tailbone/subscribers.py b/tailbone/subscribers.py index df9e3078..a6a62ffa 100644 --- a/tailbone/subscribers.py +++ b/tailbone/subscribers.py @@ -28,6 +28,7 @@ from __future__ import unicode_literals, absolute_import import six import json +import datetime import rattail from rattail.db import model @@ -84,6 +85,7 @@ def before_render(event): renderer_globals['enum'] = request.rattail_config.get_enum() renderer_globals['six'] = six renderer_globals['json'] = json + renderer_globals['datetime'] = datetime def add_inbox_count(event): diff --git a/tailbone/templates/shifts/base.mako b/tailbone/templates/shifts/base.mako index 051e57db..fd608d86 100644 --- a/tailbone/templates/shifts/base.mako +++ b/tailbone/templates/shifts/base.mako @@ -218,10 +218,10 @@ -<%def name="timesheet(render_day=None)"> +<%def name="timesheet(render_day=None, extra_columns=0)"> @@ -233,6 +233,7 @@ ${day.strftime('%A')}
${day.strftime('%b %d')} % endfor Total
Hours + ${self.render_extra_headers()} @@ -254,6 +255,7 @@ ${self.render_employee_total(emp)} + ${self.render_extra_cells(employee)} % endfor % if employee is Undefined: @@ -275,6 +277,7 @@ ${self.render_employee_total(employee)} + ${self.render_extra_totals(employee)} % endif @@ -291,5 +294,11 @@ <%def name="render_employee_day_total(day)"> +<%def name="render_extra_headers()"> + +<%def name="render_extra_cells(employee)"> + +<%def name="render_extra_totals(employee)"> + ${self.timesheet_wrapper()}