Add initial support for employee schedule views

This commit is contained in:
Lance Edgar 2016-12-10 16:04:34 -06:00
parent 7a22b11e2e
commit fcb21b9671
3 changed files with 52 additions and 1 deletions

View file

@ -2,6 +2,26 @@
<%def name="main_menu_items()">
% if request.has_any_perm('schedule.view', 'schedule.viewall', 'schedule.edit', 'scheduledshifts.list'):
<li>
<a>Time Clock</a>
<ul>
% if request.has_perm('schedule.view'):
<li>${h.link_to("Personal Schedule", url('schedule.employee'))}</li>
% endif
% if request.has_perm('schedule.viewall'):
<li>${h.link_to("Full Schedule", url('schedule'))}</li>
% endif
% if request.has_perm('schedule.edit'):
<li>${h.link_to("Edit Schedule", url('schedule.edit'))}</li>
% endif
% if request.has_perm('scheduledshifts.list'):
<li>${h.link_to("Raw Scheduled Shifts", url('scheduledshifts'))}</li>
% endif
</ul>
</li>
% endif
% if request.has_any_perm('products.list', 'vendors.list', 'brands.list', 'families.list', 'reportcodes.list'):
<li>
<a>Products</a>

View file

@ -34,7 +34,7 @@ def includeme(config):
config.include('tailbone.views.customers')
config.include('tailbone.views.departments')
config.include('rattail_demo.web.views.email')
config.include('tailbone.views.employees')
config.include('rattail_demo.web.views.employees')
config.include('tailbone.views.families')
config.include('tailbone.views.messages')
config.include('rattail_demo.web.views.people')
@ -42,6 +42,7 @@ def includeme(config):
config.include('tailbone.views.reportcodes')
config.include('tailbone.views.roles')
config.include('rattail_demo.web.views.settings')
config.include('tailbone.views.shifts')
config.include('tailbone.views.stores')
config.include('tailbone.views.subdepartments')
config.include('rattail_demo.web.views.tempmon')

View file

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
"""
Employee views
"""
from __future__ import unicode_literals, absolute_import
from tailbone.views import employees as base
class EmployeesView(base.EmployeesView):
"""
Prevent edit/delete for Chuck Norris
"""
def editable_instance(self, employee):
return employee.person_uuid != '30d1fe06bcf411e6a7c23ca9f40bc550'
def deletable_instance(self, employee):
return employee.person_uuid != '30d1fe06bcf411e6a7c23ca9f40bc550'
def includeme(config):
# autocomplete
config.add_route('employees.autocomplete', '/employees/autocomplete')
config.add_view(base.EmployeesAutocomplete, route_name='employees.autocomplete',
renderer='json', permission='employees.list')
EmployeesView.defaults(config)