Properties rework, States, StatesDefinitions, DeviceLog, and Notes #37

Merged
pedro merged 119 commits from feature/states into main 2025-02-10 12:05:58 +00:00
Showing only changes of commit 455448aea2 - Show all commits

View file

@ -1,27 +1,26 @@
{% load i18n %} {% load i18n %}
<!-- Log Tab TODO: currently only displays states, change when log table is implemented-->
<div class="tab-pane fade" id="log"> <div class="tab-pane fade" id="log">
<h5 class="card-title mb-3">{% trans 'Log' %}</h5> <h5 class="card-title mb-3">{% trans 'Log' %}</h5>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-bordered"> <table class="table table-striped table-hover table-bordered bg-gradient">
<thead class="table"> <thead >
<tr> <tr>
<th scope="col">{% trans 'State' %}</th>
<th scope="col">{% trans 'User' %}</th>
<th scope="col">{% trans 'Date' %}</th> <th scope="col">{% trans 'Date' %}</th>
<th scope="col">{% trans 'Event' %}</th>
<th scope="col">{% trans 'User' %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for state_change in device_states %} {% for log in device_logs %}
<tr {% if forloop.first %}class="table-success"{% endif %}> <tr>
<td><strong>{{ state_change.state }}</strong></td> <td width="13%">{{ log.date|date:"M j, Y, H:i" }}</td>
<td>{{ state_change.user.responsable_person|default:state_change.user.username }}</td> <td class="fst-italic">{{ log.event }}</td>
<td>{{ state_change.date|date:"M j, Y, H:i" }}</td> <td>{{ log.user.get_full_name|default:log.user.username }}</td>
</tr> </tr>
{% empty %} {% empty %}
<tr> <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> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>