from django.urls import reverse import dashboard from dashboard import Link from .views import REPORTS @dashboard.register class DoorControlDashboardFragment(dashboard.LinksCardDashboardFragment): name = "Door Controls" @property def links(self) -> list[Link]: return [ Link(name, link, permission="doorcontrol.view_hidevent") for report in REPORTS for name, link in report._report_types() ] + [ Link( "Assign NFC Card ", reverse("doorcontrol:assign-nfc-card-user-selector"), permission="doorcontrol.assign_nfc_card", ) ] @property def visible(self) -> bool: return self.request.user.has_perm("doorcontrol.view_hidevent")