54 lines
2.5 KiB
HTML
54 lines
2.5 KiB
HTML
{% if page_object %}
|
|
{% for department in page_object %}
|
|
<tr>
|
|
<td>
|
|
{% if page_object.start_index %}
|
|
{{page_object.start_index|add:forloop.counter0}}
|
|
{% else %}
|
|
{{forloop.counter}}
|
|
{% endif %}
|
|
</td>
|
|
<td>{{department.name}}</td>
|
|
<td>{{department.contact_person_name}}</td>
|
|
<td>{{department.contact_person_email}}</td>
|
|
<td>{{department.contact_person_phone}}</td>
|
|
<td>
|
|
{% if request.user.is_superuser %}
|
|
<div class="form-check form-switch">
|
|
<input
|
|
class="form-check-input"
|
|
hx-post="{% url 'dashboard:department_status' department.id %}"
|
|
hx-headers='{"X-CSRFToken":"{{ csrf_token }}"}'
|
|
type="checkbox" {% if department.status %} checked {% endif %}
|
|
style="cursor: pointer;"
|
|
>
|
|
</div>
|
|
{% else %}
|
|
{% if department.status %} Active {% else %} Inactive {% endif %}
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<div class="btn-group btn-group-sm" role="group" aria-label="Basic example">
|
|
{% if request.user.is_superuser %}
|
|
<a href="{% url 'dashboard:department_details' department.id %}" class="btn btn-success"><i class="bi bi-eye-fill"></i></a>
|
|
{% endif %}
|
|
{% if perms.authentication.edit_department %}
|
|
<button type="button" class="btn btn-info"
|
|
hx-get="{% url 'dashboard:update_department' department.id %}" hx-target="#update-department-modal-content"
|
|
data-bs-toggle="modal" data-bs-target="#update-department-modal"
|
|
><i class="bi bi-pencil-square"></i></button>
|
|
{% endif %}
|
|
{% if perms.authentication.delete_department %}
|
|
<form action="{% url 'dashboard:delete_department' department.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="8" class="text-center"> No record found related to your search keyword</td>
|
|
{% endif %}
|