116 lines
4.1 KiB
HTML
116 lines
4.1 KiB
HTML
{% extends "base.html" %}
|
|
{% load i18n %}
|
|
{% load render_table from django_tables2 %}
|
|
|
|
{% block title %}{% trans "users" %}{% endblock title %}
|
|
{% block users %}<a class="nav-link active">{% trans "users"|capfirst %}</a>{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="d-flex flex-column min-vh-100">
|
|
<div class="d-flex flex-column flex-sm-grow-1 ms-sm-14 p-4">
|
|
<main class="d-grid gap-4 p-1">
|
|
<div class="row g-4">
|
|
<div class="col-lg-6 col-xl-12">
|
|
|
|
<div class="container-fluid p-2">
|
|
<form method="get">
|
|
<div class="input-group input-group-sm">
|
|
<button id="inputGroup-sizing-sm"
|
|
class="btn btn-sm btn-secondary rounded-start" type="submit">
|
|
{% trans 'search'|capfirst %}
|
|
</button>
|
|
<input type="text"
|
|
name="q"
|
|
class="form-control form-control-sm rounded-end"
|
|
value="{{ request.GET.q }}"
|
|
aria-describedby="inputGroup-sizing-sm"/>
|
|
<!-- Clear Button -->
|
|
{% if request.GET.q %}
|
|
<a href="{% url request.resolver_match.view_name %}"
|
|
class="btn btn-sm btn-outline-danger ms-1 rounded">
|
|
<i class="bi bi-x-lg"></i>
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
|
|
<table class="table table-hover table-responsive-sm">
|
|
<thead>
|
|
<tr>
|
|
<th>{% trans 'name'|capfirst %}</th>
|
|
<th>{% trans 'arabic name'|capfirst %}</th>
|
|
<th>{% trans 'phone number'|capfirst %}</th>
|
|
<th>{% trans 'address'|capfirst %}</th>
|
|
<th>{% trans 'role'|capfirst %}</th>
|
|
<th>{% trans 'actions'|capfirst %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for user in users %}
|
|
<tr>
|
|
<td>{{ user.name }}</td>
|
|
<td>{{ user.arabic_name }}</td>
|
|
<td>{{ user.phone_number }}</td>
|
|
<td>{{ user.address }}</td>
|
|
<td>{% trans user.dealer_type %}</td>
|
|
<td>
|
|
<a class="btn btn-sm btn-success"
|
|
href="{% url 'user_detail' user.id %}">
|
|
{% trans 'view'|capfirst %}
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
</table>
|
|
<!-- Optional: Pagination -->
|
|
{% if is_paginated %}
|
|
<nav aria-label="Page navigation">
|
|
<ul class="pagination pagination-sm justify-content-center">
|
|
{% if page_obj.has_previous %}
|
|
<li class="page-item py-0">
|
|
<a class="page-link" href="?page={{ page_obj.previous_page_number }}" aria-label="Previous">
|
|
<span aria-hidden="true">«</span>
|
|
</a>
|
|
</li>
|
|
{% else %}
|
|
<li class="page-item disabled">
|
|
<a class="page-link" href="#" aria-label="Previous">
|
|
<span aria-hidden="true">«</span>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
{% for num in page_obj.paginator.page_range %}
|
|
{% if page_obj.number == num %}
|
|
<li class="page-item active"><a class="page-link" href="?page={{ num }}">{{ num }}</a></li>
|
|
{% else %}
|
|
<li class="page-item"><a class="page-link" href="?page={{ num }}">{{ num }}</a></li>
|
|
{% endif %}
|
|
{% endfor %} {% if page_obj.has_next %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.next_page_number }}" aria-label="Next">
|
|
<span aria-hidden="true">»</span>
|
|
</a>
|
|
</li>
|
|
{% else %}
|
|
<li class="page-item disabled">
|
|
<a class="page-link" href="#" aria-label="Next">
|
|
<span aria-hidden="true">»</span>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|
|
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|