log list now shows log table

This commit is contained in:
Thomas Nahuel Rusiecki 2024-12-19 20:17:33 -03:00
parent 7d3b448d2a
commit 5972417422

View file

@ -1,27 +1,26 @@
{% 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">
<table class="table table-striped table-hover table-bordered bg-gradient">
<thead >
<tr>
<th scope="col">{% trans 'State' %}</th>
<th scope="col">{% trans 'User' %}</th>
<th scope="col">{% trans 'Date' %}</th>
<th scope="col">{% trans 'Event' %}</th>
<th scope="col">{% trans 'User' %}</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>
{% 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="4" class="text-center">{% trans 'No state changes recorded.' %}</td>
<td colspan="3" class="text-center">{% trans 'No logs recorded.' %}</td>
</tr>
{% endfor %}
</tbody>