rattail-demo/rattail_demo/web/views/corepos/employees.py

69 lines
1.7 KiB
Python
Raw Normal View History

2018-11-22 11:16:59 -06:00
# -*- coding: utf-8; -*-
"""
CORE-POS employee views
"""
from __future__ import unicode_literals, absolute_import
from corepos.db import model as corepos
from .master import CoreMasterView
class EmployeeView(CoreMasterView):
"""
Base class for employee views.
"""
model_class = corepos.Employee
model_title = "CORE-POS Employee"
url_prefix = '/core-pos/employees'
route_prefix = 'corepos.employees'
labels = {
'emp_no': "Number",
'CashierPassword': "Cashier Password",
'AdminPassword': "Admin Password",
'FirstName': "First Name",
'LastName': "Last Name",
'JobTitle': "Job Title",
'EmpActive': "Active",
'frontendsecurity': "Frontend Security",
'backendsecurity': "Backend Security",
'birthdate': "Birth Date",
}
grid_columns = [
'emp_no',
'FirstName',
'LastName',
'JobTitle',
'EmpActive',
'birthdate',
]
def configure_grid(self, g):
super(EmployeeView, self).configure_grid(g)
g.filters['EmpActive'].default_active = True
g.filters['EmpActive'].default_verb = 'is_true'
g.filters['FirstName'].default_active = True
g.filters['FirstName'].default_verb = 'contains'
g.filters['LastName'].default_active = True
g.filters['LastName'].default_verb = 'contains'
g.set_sort_defaults('emp_no')
g.set_link('emp_no')
g.set_link('FirstName')
g.set_link('LastName')
def grid_extra_class(self, employee, i):
if not employee.EmpActive:
return 'warning'
def includeme(config):
EmployeeView.defaults(config)