log list now shows log table
This commit is contained in:
parent
7d3b448d2a
commit
5972417422
|
@ -1,30 +1,29 @@
|
|||
{% load i18n %}
|
||||
<!-- Log Tab TODO: currently only displays states, change when log table is implemented-->
|
||||
|
||||
<div class="tab-pane fade" id="log">
|
||||
<h5 class="card-title mb-3">{% trans 'Log' %}</h5>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead class="table">
|
||||
<tr>
|
||||
<th scope="col">{% trans 'State' %}</th>
|
||||
<th scope="col">{% trans 'User' %}</th>
|
||||
<th scope="col">{% trans 'Date' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for state_change in device_states %}
|
||||
<tr {% if forloop.first %}class="table-success"{% endif %}>
|
||||
<td><strong>{{ state_change.state }}</strong></td>
|
||||
<td>{{ state_change.user.responsable_person|default:state_change.user.username }}</td>
|
||||
<td>{{ state_change.date|date:"M j, Y, H:i" }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">{% trans 'No state changes recorded.' %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="log">
|
||||
<h5 class="card-title mb-3">{% trans 'Log' %}</h5>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-bordered bg-gradient">
|
||||
<thead >
|
||||
<tr>
|
||||
<th scope="col">{% trans 'Date' %}</th>
|
||||
<th scope="col">{% trans 'Event' %}</th>
|
||||
<th scope="col">{% trans 'User' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for log in device_logs %}
|
||||
<tr>
|
||||
<td width="13%">{{ log.date|date:"M j, Y, H:i" }}</td>
|
||||
<td class="fst-italic">{{ log.event }}</td>
|
||||
<td>{{ log.user.get_full_name|default:log.user.username }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">{% trans 'No logs recorded.' %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue