Show start/end date as separte fields for CORE Member view

This commit is contained in:
Lance Edgar 2023-10-17 14:29:42 -05:00
parent efab515880
commit 7a50a03d14

View file

@ -50,7 +50,7 @@ class MemberTypeView(CoreOfficeMasterView):
} }
def configure_grid(self, g): def configure_grid(self, g):
super(MemberTypeView, self).configure_grid(g) super().configure_grid(g)
g.set_link('id') g.set_link('id')
g.set_link('description') g.set_link('description')
@ -99,7 +99,8 @@ class MemberView(CoreOfficeMasterView):
'email', 'email',
'email2', 'email2',
'ads_ok', 'ads_ok',
'dates', 'start_date',
'end_date',
'barcodes', 'barcodes',
'suspension', 'suspension',
'equity_live_balance', 'equity_live_balance',
@ -122,7 +123,7 @@ class MemberView(CoreOfficeMasterView):
] ]
def configure_grid(self, g): def configure_grid(self, g):
super(MemberView, self).configure_grid(g) super().configure_grid(g)
g.set_sort_defaults('card_number') g.set_sort_defaults('card_number')
@ -134,9 +135,11 @@ class MemberView(CoreOfficeMasterView):
g.set_link('last_name') g.set_link('last_name')
def configure_form(self, f): def configure_form(self, f):
super(MemberView, self).configure_form(f) super().configure_form(f)
f.set_renderer('dates', self.render_member_dates) # dates
f.set_renderer('start_date', self.render_member_date)
f.set_renderer('end_date', self.render_member_date)
f.set_renderer('barcodes', self.render_barcodes) f.set_renderer('barcodes', self.render_barcodes)
@ -147,14 +150,10 @@ class MemberView(CoreOfficeMasterView):
f.set_renderer('equity_live_balance', self.render_equity_live_balance) f.set_renderer('equity_live_balance', self.render_equity_live_balance)
def render_member_dates(self, member, field): def render_member_date(self, member, field):
if not member.dates: date = getattr(member.dates, field)
return "" if date:
return str(date.date())
items = []
for dates in member.dates:
items.append(HTML.tag('li', c=str(dates)))
return HTML.tag('ul', c=items)
def render_barcodes(self, member, field): def render_barcodes(self, member, field):
barcodes = member.barcodes barcodes = member.barcodes