Skip to content

Commit

Permalink
show maintenance lockout on access permissions page
Browse files Browse the repository at this point in the history
  • Loading branch information
jabelone committed May 24, 2024
1 parent 07f4f1e commit edcc707
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 8 deletions.
36 changes: 32 additions & 4 deletions memberportal/profile/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,23 +571,51 @@ 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:
continue

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}
Expand Down
22 changes: 18 additions & 4 deletions src-frontend/src/components/AccessList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
<q-item-section avatar top>
<q-avatar
:icon="icons.doorOpen"
:color="door.access ? 'green' : 'red'"
:color="
door.locked_out ? 'orange' : door.access ? 'green' : 'red'
"
text-color="white"
/>
</q-item-section>
Expand All @@ -31,7 +33,10 @@
<q-item-label lines="1">
{{ door.name }}
</q-item-label>
<q-item-label v-if="door.access === true" caption>
<q-item-label v-if="door.locked_out === true" caption>
{{ $t('access.maintenance') }}
</q-item-label>
<q-item-label v-else-if="door.access === true" caption>
{{ $t('access.authorised') }}
</q-item-label>
<q-item-label v-else caption>
Expand Down Expand Up @@ -64,7 +69,13 @@
<q-item-section avatar top>
<q-avatar
:icon="icons.interlock"
:color="interlock.access ? 'green' : 'red'"
:color="
interlock.locked_out
? 'orange'
: interlock.access
? 'green'
: 'red'
"
text-color="white"
/>
</q-item-section>
Expand All @@ -73,7 +84,10 @@
<q-item-label lines="1">
{{ interlock.name }}
</q-item-label>
<q-item-label v-if="interlock.access === true" caption>
<q-item-label v-if="interlock.locked_out === true" caption>
{{ $t('access.maintenance') }}
</q-item-label>
<q-item-label v-else-if="interlock.access === true" caption>
{{ $t('access.authorised') }}
</q-item-label>
<q-item-label v-else caption>
Expand Down
1 change: 1 addition & 0 deletions src-frontend/src/i18n/en-AU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit edcc707

Please sign in to comment.