From a34e2b61f5c56a0a350b79911a6575daa40cdf46 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 7 Sep 2023 17:50:17 -0500 Subject: [PATCH] Add CORE supplement for Member Equity Payments view --- tailbone_corepos/views/members.py | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tailbone_corepos/views/members.py b/tailbone_corepos/views/members.py index f9d4841..28848ef 100644 --- a/tailbone_corepos/views/members.py +++ b/tailbone_corepos/views/members.py @@ -85,6 +85,56 @@ class MemberViewSupplement(ViewSupplement): return [tags.link_to("View CORE-POS Member", url)] +class MemberEquityPaymentViewSupplement(ViewSupplement): + """ + Member view supplement for CORE integration + """ + route_prefix = 'member_equity_payments' + + labels = { + 'corepos_card_number': "CORE-POS Card Number", + 'corepos_transaction_number': "CORE-POS Transaction Number", + 'corepos_transaction_id': "CORE-POS Transaction ID", + 'corepos_department_number': "CORE-POS Department Number", + } + + def get_grid_query(self, query): + model = self.model + return query.outerjoin(model.CoreMemberEquityPayment) + + def configure_grid(self, g): + model = self.model + + g.set_filter('corepos_card_number', model.CoreMemberEquityPayment.corepos_card_number) + g.set_sorter('corepos_card_number', model.CoreMemberEquityPayment.corepos_card_number) + + g.set_filter('corepos_transaction_number', model.CoreMemberEquityPayment.corepos_transaction_number) + g.set_sorter('corepos_transaction_number', model.CoreMemberEquityPayment.corepos_transaction_number) + + g.set_filter('corepos_transaction_id', model.CoreMemberEquityPayment.corepos_transaction_id) + g.set_sorter('corepos_transaction_id', model.CoreMemberEquityPayment.corepos_transaction_id) + + g.set_filter('corepos_department_number', model.CoreMemberEquityPayment.corepos_department_number) + g.set_sorter('corepos_department_number', model.CoreMemberEquityPayment.corepos_department_number) + + g.append('corepos_transaction_number') + g.set_label('corepos_transaction_number', "CORE-POS Trans. No.") + if 'corepos_transaction_number' in g.filters: + g.filters['corepos_transaction_number'].label = self.labels['corepos_transaction_number'] + g.set_link('corepos_transaction_number') + + def configure_form(self, f): + f.append('corepos_card_number') + f.append('corepos_transaction_number') + f.append('corepos_transaction_id') + f.append('corepos_department_number') + + def get_version_child_classes(self): + model = self.model + return [model.CoreMemberEquityPayment] + + def includeme(config): MembershipTypeViewSupplement.defaults(config) MemberViewSupplement.defaults(config) + MemberEquityPaymentViewSupplement.defaults(config)