From edcc707367cebc6ddfef5139fa460dc1701cd029 Mon Sep 17 00:00:00 2001 From: Jaimyn Mayer Date: Sat, 25 May 2024 00:28:55 +1000 Subject: [PATCH] show maintenance lockout on access permissions page --- memberportal/profile/models.py | 36 +++++++++++++++++++--- src-frontend/src/components/AccessList.vue | 22 ++++++++++--- src-frontend/src/i18n/en-AU/index.ts | 1 + 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/memberportal/profile/models.py b/memberportal/profile/models.py index 83d91eab..3207a256 100644 --- a/memberportal/profile/models.py +++ b/memberportal/profile/models.py @@ -571,10 +571,26 @@ def get_access_permissions(self): continue if door in self.doors.all() and user_active: - doors.append({"name": door.name, "access": True, "id": door.id}) + doors.append( + { + "name": door.name, + "access": True, + "id": door.id, + "locked_out": door.locked_out, + "offline": door.get_unavailable(), + } + ) else: - doors.append({"name": door.name, "access": False, "id": door.id}) + doors.append( + { + "name": door.name, + "access": False, + "id": door.id, + "locked_out": door.locked_out, + "offline": door.get_unavailable(), + } + ) for interlock in Interlock.objects.all(): if interlock.hidden: @@ -582,12 +598,24 @@ def get_access_permissions(self): if interlock in self.interlocks.all() and user_active: interlocks.append( - {"name": interlock.name, "access": True, "id": interlock.id} + { + "name": interlock.name, + "access": True, + "id": interlock.id, + "locked_out": interlock.locked_out, + "offline": interlock.get_unavailable(), + } ) else: interlocks.append( - {"name": interlock.name, "access": False, "id": interlock.id} + { + "name": interlock.name, + "access": False, + "id": interlock.id, + "locked_out": interlock.locked_out, + "offline": interlock.get_unavailable(), + } ) return {"doors": doors, "interlocks": interlocks} diff --git a/src-frontend/src/components/AccessList.vue b/src-frontend/src/components/AccessList.vue index 864ab9f8..bc1ad84a 100644 --- a/src-frontend/src/components/AccessList.vue +++ b/src-frontend/src/components/AccessList.vue @@ -22,7 +22,9 @@ @@ -31,7 +33,10 @@ {{ door.name }} - + + {{ $t('access.maintenance') }} + + {{ $t('access.authorised') }} @@ -64,7 +69,13 @@ @@ -73,7 +84,10 @@ {{ interlock.name }} - + + {{ $t('access.maintenance') }} + + {{ $t('access.authorised') }} diff --git a/src-frontend/src/i18n/en-AU/index.ts b/src-frontend/src/i18n/en-AU/index.ts index a39f014f..3e757581 100644 --- a/src-frontend/src/i18n/en-AU/index.ts +++ b/src-frontend/src/i18n/en-AU/index.ts @@ -181,6 +181,7 @@ export default { 'Your membership is currently inactive. This may affect your access.', authorised: 'Authorised', unauthorised: 'Unauthorised', + maintenance: 'Maintenance Lockout', door: 'Door', doors: 'Doors', interlock: 'Interlock',