Some basic view tweaks, esp. get time zones right

This commit is contained in:
Lance Edgar 2020-04-08 21:11:28 -05:00
parent 524b92e21a
commit d06895e697
4 changed files with 26 additions and 0 deletions

View file

@ -86,6 +86,8 @@ class CustomerView(CoreOfficeMasterView):
f.remove_field('member_info') f.remove_field('member_info')
f.remove_field('member_type') f.remove_field('member_type')
f.remove_field('last_change') f.remove_field('last_change')
else:
f.set_type('last_change', 'datetime_local')
def core_office_object_url(self, office_url, customer): def core_office_object_url(self, office_url, customer):
return core_office_customer_account_url(self.rattail_config, return core_office_customer_account_url(self.rattail_config,

View file

@ -79,6 +79,10 @@ class DepartmentView(CoreOfficeMasterView):
g.set_link('number') g.set_link('number')
g.set_link('name') g.set_link('name')
def configure_form(self, f):
super(DepartmentView, self).configure_form(f)
f.set_type('modified', 'datetime_local')
def core_office_object_url(self, office_url, department): def core_office_object_url(self, office_url, department):
return '{}/item/departments/DepartmentEditor.php?did={}'.format( return '{}/item/departments/DepartmentEditor.php?did={}'.format(
office_url, department.number) office_url, department.number)

View file

@ -59,6 +59,8 @@ class EmployeeView(CoreOfficeMasterView):
g.filters['last_name'].default_active = True g.filters['last_name'].default_active = True
g.filters['last_name'].default_verb = 'contains' g.filters['last_name'].default_verb = 'contains'
g.set_type('birth_date', 'datetime_local')
g.set_sort_defaults('number') g.set_sort_defaults('number')
g.set_link('number') g.set_link('number')
@ -69,6 +71,10 @@ class EmployeeView(CoreOfficeMasterView):
if not employee.active: if not employee.active:
return 'warning' return 'warning'
def configure_form(self, f):
super(EmployeeView, self).configure_form(f)
f.set_type('birth_date', 'datetime_local')
def core_office_object_url(self, office_url, employee): def core_office_object_url(self, office_url, employee):
return '{}/admin/Cashiers/CashierEditor.php?emp_no={}'.format( return '{}/admin/Cashiers/CashierEditor.php?emp_no={}'.format(
office_url, employee.number) office_url, employee.number)

View file

@ -44,6 +44,20 @@ class SubdepartmentView(CoreOfficeMasterView):
'department', 'department',
] ]
def configure_grid(self, g):
super(SubdepartmentView, self).configure_grid(g)
g.filters['number'].default_active = True
g.filters['number'].default_verb = 'equal'
g.filters['name'].default_active = True
g.filters['name'].default_verb = 'contains'
g.set_sort_defaults('number')
g.set_link('number')
g.set_link('name')
def includeme(config): def includeme(config):
SubdepartmentView.defaults(config) SubdepartmentView.defaults(config)