diff --git a/membershipworks/tables.py b/membershipworks/tables.py index 9371dd7..1d8120d 100644 --- a/membershipworks/tables.py +++ b/membershipworks/tables.py @@ -65,6 +65,30 @@ class EventTable(tables.Table): } +class EventRegistrationsTable(tables.Table): + ticket_count = tables.Column(empty_values=()) + name = tables.Column(accessor="Full name") + email = tables.EmailColumn(accessor="Email") + phone = tables.Column(accessor="Phone") + emergency_contact_name = tables.Column(accessor="Emergency Contact Name:") + emergency_contact_phone_number = tables.Column( + accessor="Emergency Contact Phone Number:" + ) + emergency_contact_relation = tables.Column(accessor="Emergency Contact Relation:") + + def render_ticket_count(self, record): + return sum(int(v) for k, v in record.items() if k.startswith("Ticket: ")) + + class Meta: + row_attrs = { + "class": lambda table, record: ( + "" + if table.render_ticket_count(record) > 0 + else "text-decoration-line-through table-danger" + ) + } + + class EventSummaryTable(tables.Table): event_count = tables.Column("Events") canceled_event_count = tables.Column("Canceled Events") diff --git a/membershipworks/templates/membershipworks/event_detail.dj.html b/membershipworks/templates/membershipworks/event_detail.dj.html index b51e546..dab8429 100644 --- a/membershipworks/templates/membershipworks/event_detail.dj.html +++ b/membershipworks/templates/membershipworks/event_detail.dj.html @@ -13,6 +13,10 @@ {% endblock %} {% block content %}
Data last updated {{ event.details_timestamp }}
+