Add user cards view
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful

This commit is contained in:
2023-08-14 04:35:27 +03:00
parent a2af2162f9
commit 83d72f355e
4 changed files with 69 additions and 3 deletions

View File

@@ -14,6 +14,9 @@
-->
</ul>
<p>Manage your keycards or keyfobs here:</p>
<a href="/m/doorboy/me" class="waves-effect waves-light btn"><i class="material-icons left">person</i>My cards</a>
<p>Recent door open requests via Slack or the buttons above</p>
<table>

View File

@@ -13,8 +13,10 @@
<ul class="collapsible-body collection collapsible-collection">
{% for u, t in last_seen.items() %}
<li class="collection-item">
<i class="material-icons tiny">person</i>
{{u | display_name}}
<a href="/m/doorboy/user/{{u}}/cards">
<i class="material-icons tiny">person</i>
{{u | display_name}}
</a>
<div class="secondary-content black-text">
<i class="material-icons tiny">access_time</i>
{{t | timeago}}

View File

@@ -0,0 +1,37 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<h4>Doorboy info for {{subject_user.username | display_name}}</h4>
<br/>
<h5>Users cards:</h5>
<table class="striped">
<thead>
<tr>
<th>Enabled</th>
<th>Comment</th>
<th>UID hash tail</th>
<th>Last seen</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for c in cards %}
<tr>
<td>{% if c.token.enabled %}<i class="material-icons">check_circle</i>{% else %}&nbsp;{% endif %}</td>
<td>{{ c.token.comment }}</td>
<td><a href="/m/doorboy/{{ c._id }}/events">{{ c.token.uid_hash[-6:] }}</a></td>
<td>{{ c.last_seen | timeago }}</td>
<td>
{% if is_self %}
<a href="/m/doorboy/{{ c._id }}/edit" class="waves-effect waves-light btn"><i class="material-icons left">edit</i>Edit</a>
{% else %}
&nbsp;
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}