77 lines
2.6 KiB
HTML
77 lines
2.6 KiB
HTML
{% load cache %}
|
|
{% load cachalot cache %}
|
|
{% get_last_invalidation 'core.AssetRule' as last %}
|
|
{% include 'mixins/partials/notify.html' %}
|
|
{% cache 600 objects_assetrules request.user.id object_list type last %}
|
|
<table
|
|
class="table is-fullwidth is-hoverable"
|
|
hx-target="#{{ context_object_name }}-table"
|
|
id="{{ context_object_name }}-table"
|
|
hx-swap="outerHTML"
|
|
hx-trigger="{{ context_object_name_singular }}Event from:body"
|
|
hx-get="{{ list_url }}">
|
|
<thead>
|
|
<th>id</th>
|
|
<th>user</th>
|
|
<th>asset</th>
|
|
<th>group</th>
|
|
<th>aggregation</th>
|
|
<th>value</th>
|
|
<th>original status</th>
|
|
<th>status</th>
|
|
<th>trigger above</th>
|
|
<th>trigger below</th>
|
|
<th>actions</th>
|
|
</thead>
|
|
{% for item in object_list %}
|
|
<tr class="
|
|
{% if item.status == 2 %}has-background-success-light
|
|
{% elif item.status == 3 %}has-background-danger-light
|
|
{% elif item.status == 0 %}has-background-grey-light
|
|
{% endif %}">
|
|
<td>{{ item.id }}</td>
|
|
<td>{{ item.user }}</td>
|
|
<td>{{ item.asset }}</td>
|
|
<td>{{ item.group }}</td>
|
|
<td>{{ item.get_aggregation_display }}</td>
|
|
<td>{{ item.value }}</td>
|
|
<td>{{ item.get_original_status_display }}</td>
|
|
<td>{{ item.get_status_display }}</td>
|
|
<td>{{ item.trigger_above }}</td>
|
|
<td>{{ item.trigger_below }}</td>
|
|
<td>
|
|
<div class="buttons">
|
|
<button
|
|
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
|
hx-get="{% url 'assetrule_update' type=type group=item.group.id pk=item.id %}"
|
|
hx-trigger="click"
|
|
hx-target="#{{ type }}s-here"
|
|
hx-swap="innerHTML"
|
|
class="button">
|
|
<span class="icon-text">
|
|
<span class="icon">
|
|
<i class="fa-solid fa-pencil"></i>
|
|
</span>
|
|
</span>
|
|
</button>
|
|
<button
|
|
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
|
hx-delete="{% url 'assetrule_delete' type=type group=item.group.id pk=item.id %}"
|
|
hx-trigger="click"
|
|
hx-target="#modals-here"
|
|
hx-swap="innerHTML"
|
|
hx-confirm="Are you sure you wish to delete {{ item.name }}?"
|
|
class="button">
|
|
<span class="icon-text">
|
|
<span class="icon">
|
|
<i class="fa-solid fa-xmark"></i>
|
|
</span>
|
|
</span>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
|
|
</table>
|
|
{% endcache %} |