2024-01-15 21:31:06 -05:00
|
|
|
from django.urls import reverse
|
|
|
|
|
|
|
|
import dashboard
|
2024-02-06 00:41:01 -05:00
|
|
|
from dashboard import Link
|
2024-04-14 01:21:32 -04:00
|
|
|
from membershipworks.models import EventExt, Member
|
2024-01-15 21:31:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
@dashboard.register
|
2024-02-06 00:41:01 -05:00
|
|
|
class MembershipworksDashboardFragment(dashboard.LinksCardDashboardFragment):
|
2024-01-15 21:31:06 -05:00
|
|
|
name = "MembershipWorks"
|
|
|
|
|
2024-04-14 01:21:32 -04:00
|
|
|
@property
|
|
|
|
def links(self):
|
|
|
|
links = [
|
|
|
|
Link(
|
|
|
|
"Upcoming Events",
|
|
|
|
reverse("membershipworks:upcoming-events"),
|
|
|
|
permission="membershipworks.view_event",
|
|
|
|
tooltip="Generator for Wordpress posts",
|
|
|
|
),
|
|
|
|
Link(
|
|
|
|
"Event Report",
|
|
|
|
reverse("membershipworks:event-index-report"),
|
|
|
|
permission="membershipworks.view_event",
|
|
|
|
),
|
|
|
|
Link(
|
|
|
|
"Event Attendees",
|
|
|
|
reverse("membershipworks:event-attendees"),
|
|
|
|
permission="membershipworks.view_event",
|
|
|
|
),
|
|
|
|
Link(
|
|
|
|
"Missing Paperwork",
|
|
|
|
reverse("membershipworks:missing-paperwork-report"),
|
|
|
|
permission="membershipworks.view_member",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
|
|
|
|
member = Member.from_user(self.request.user)
|
|
|
|
if (
|
|
|
|
member is not None
|
|
|
|
and EventExt.objects.filter(instructor__member=member).exists()
|
|
|
|
):
|
|
|
|
links.append(
|
|
|
|
Link(
|
|
|
|
"My Events", reverse("membershipworks:user-events"), permission=None
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
return links
|