Files
eam-project/templates/dashboard/locations/locations-data.html
T
2025-05-23 14:44:12 +08:00

52 lines
2.3 KiB
HTML

{% if page_object %}
{% for location in page_object %}
<tr>
<td>
{% if page_object.start_index %}
{{page_object.start_index|add:forloop.counter0}}
{% else %}
{{forloop.counter}}
{% endif %}
</td>
<td>{{location.office_name}}</td>
<td>{{location.contact_person_name}}</td>
<td>{{location.address.state}}</td>
<td>{{location.address.city}}</td>
<td>{{location.address.pin_code}}</td>
<td>
{% if request.user.is_superuser %}
<div class="form-check form-switch">
<input
class="form-check-input"
hx-post="{% url 'dashboard:location_status' location.id %}"
hx-headers='{"X-CSRFToken":"{{ csrf_token }}"}'
type="checkbox" {% if location.status %} checked {% endif %}
style="cursor: pointer;"
>
</div>
{% else %}
{% if location.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_location %}
<a href="{% url 'dashboard:location_details' location.id %}" class="btn btn-success"><i class="bi bi-eye-fill"></i></a>
{% endif %}
{% if perms.authentication.edit_location %}
<a href="{% url 'dashboard:update_location' location.id %}" class="btn btn-info"><i class="bi bi-pencil-square"></i></a>
{% endif %}
{% if perms.authentication.delete_location %}
<form action="{% url 'dashboard:delete_location' location.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 %}