From 44a7a762d480d47c667384fded600e35287af112 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 13 Sep 2023 16:24:08 -0500 Subject: [PATCH] Add views for CORE `CustomerNotifications` table --- tailbone_corepos/menus.py | 5 ++++ tailbone_corepos/views/corepos/customers.py | 31 +++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/tailbone_corepos/menus.py b/tailbone_corepos/menus.py index 8c0b11f..ad7d6fc 100644 --- a/tailbone_corepos/menus.py +++ b/tailbone_corepos/menus.py @@ -57,6 +57,11 @@ def make_corepos_menu(request): 'route': 'corepos.customer_accounts_new', 'perm': 'corepos.customer_accounts_new.list', }, + { + 'title': "Customer Notifications", + 'route': 'corepos.customer_notifications', + 'perm': 'corepos.customer_notifications.list', + }, { 'title': "Suspensions", 'route': 'corepos.suspensions', diff --git a/tailbone_corepos/views/corepos/customers.py b/tailbone_corepos/views/corepos/customers.py index cc3ea95..e2477e7 100644 --- a/tailbone_corepos/views/corepos/customers.py +++ b/tailbone_corepos/views/corepos/customers.py @@ -237,6 +237,34 @@ class CustomerView(CoreOfficeMasterView): g.set_sort_defaults('card_number') +class CustomerNotificationView(CoreOfficeMasterView): + """ + Master view for customers notifications + """ + model_class = corepos.CustomerNotification + model_title = "CORE-POS Customer Notification" + model_title_plural = "CORE-POS Customer Notifications" + url_prefix = '/core-pos/customer-notifications' + route_prefix = 'corepos.customer_notifications' + + labels = { + 'customer_id': "Customer ID", + } + + def configure_grid(self, g): + super().configure_grid(g) + + g.set_link('id') + g.set_sort_defaults('id', 'desc') + + g.set_link('card_number') + if 'card_number' in g.filters: + g.filters['card_number'].default_active = True + g.filters['card_number'].default_verb = 'equal' + + g.set_link('message') + + class SuspensionView(CoreOfficeMasterView): """ Master view for legacy customer suspensions. @@ -313,6 +341,9 @@ def defaults(config, **kwargs): CustomerView = kwargs.get('CustomerView', base['CustomerView']) CustomerView.defaults(config) + CustomerNotificationView = kwargs.get('CustomerNotificationView', base['CustomerNotificationView']) + CustomerNotificationView.defaults(config) + SuspensionView = kwargs.get('SuspensionView', base['SuspensionView']) SuspensionView.defaults(config)