2024-12-11 13:03:37 -05:00
|
|
|
from django.urls import reverse
|
|
|
|
|
2023-04-14 01:24:36 -04:00
|
|
|
import dashboard
|
2024-02-06 00:41:01 -05:00
|
|
|
from dashboard import Link
|
2024-01-17 21:17:24 -05:00
|
|
|
|
2023-12-01 11:55:28 -05:00
|
|
|
from .views import REPORTS
|
2023-04-14 01:24:36 -04:00
|
|
|
|
|
|
|
|
|
|
|
@dashboard.register
|
2024-02-06 00:41:01 -05:00
|
|
|
class DoorControlDashboardFragment(dashboard.LinksCardDashboardFragment):
|
2023-04-14 01:24:36 -04:00
|
|
|
name = "Door Controls"
|
|
|
|
|
|
|
|
@property
|
2024-02-06 00:41:01 -05:00
|
|
|
def links(self) -> list[Link]:
|
|
|
|
return [
|
|
|
|
Link(name, link, permission="doorcontrol.view_hidevent")
|
|
|
|
for report in REPORTS
|
|
|
|
for name, link in report._report_types()
|
2024-12-11 13:03:37 -05:00
|
|
|
] + [
|
|
|
|
Link(
|
|
|
|
"Assign NFC Card ",
|
|
|
|
reverse("doorcontrol:assign-nfc-card-user-selector"),
|
|
|
|
permission="doorcontrol.assign_nfc_card",
|
|
|
|
)
|
2024-02-06 00:41:01 -05:00
|
|
|
]
|
2023-04-14 01:24:36 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def visible(self) -> bool:
|
|
|
|
return self.request.user.has_perm("doorcontrol.view_hidevent")
|