cmsmanage/doorcontrol/dashboard.py

31 lines
859 B
Python
Raw Normal View History

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",
),
Link(
"Assigned NFC Cards",
reverse("doorcontrol:assigned-nfc-cards"),
permission="doorcontrol.assign_nfc_card",
),
]