69 lines
2.8 KiB
HTML
69 lines
2.8 KiB
HTML
{% if page_object %}
|
|
{% for asset in page_object %}
|
|
<tr>
|
|
<td>
|
|
{% if page_object.start_index %}
|
|
{{page_object.start_index|add:forloop.counter0}}
|
|
{% else %}
|
|
{{forloop.counter}}
|
|
{% endif %}
|
|
</td>
|
|
<td>{{asset.name}}</td>
|
|
<td>{{asset.serial_no}}</td>
|
|
<td>{{asset.product.product_type}}</td>
|
|
<td>
|
|
{{asset.product}}
|
|
{% if asset.product.is_deleted %}
|
|
<i class="bi bi-exclamation-triangle text-warning" title="Product is deleted, please update or restore."></i>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{{asset.vendor}}
|
|
{% if asset.vendor.is_deleted %}
|
|
<i class="bi bi-exclamation-triangle text-warning" title="Vendor is deleted, please update or restore."></i>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if asset.is_assigned %}
|
|
In Use
|
|
{% else %}
|
|
In Store
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if request.user.is_superuser %}
|
|
<div class="form-check form-switch">
|
|
<input
|
|
class="form-check-input"
|
|
hx-post="{% url 'assets:status' asset.id %}"
|
|
hx-headers='{"X-CSRFToken":"{{ csrf_token }}"}'
|
|
type="checkbox" {% if asset.status %} checked {% endif %}
|
|
style="cursor: pointer;"
|
|
>
|
|
</div>
|
|
{% else %}
|
|
{% if products.status %} Active {% else %} Inactive {% endif %}
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<div class="btn-group btn-group-sm" role="group" aria-label="Basic example">
|
|
{% if perms.authentication.view_asset %}
|
|
<a href="{% url 'assets:details' asset.id %}" class="btn btn-success"><i class="bi bi-eye-fill"></i></a>
|
|
{% endif %}
|
|
{% if perms.authentication.edit_asset %}
|
|
<a href="{% url 'assets:update' asset.id %}"type="button" class="btn btn-info"><i class="bi bi-pencil-square"></i></a>
|
|
{% endif %}
|
|
{% if perms.authentication.delete_asset %}
|
|
<form action="{% url 'assets:delete' asset.id %}" method="post" onsubmit="return confirm('Are you sure you want to delete this?')">
|
|
{% csrf_token %}
|
|
<button type="submit" value="Delete" class="btn btn-sm btn-danger"><i class="bi bi-trash3-fill"></i></button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
{% else %}
|
|
<td colspan="9" class="text-center"> No record found related to your search keyword</td>
|
|
{% endif %}
|