191 lines
10 KiB
HTML
191 lines
10 KiB
HTML
{% extends 'base.html' %}
|
|
{% load i18n %}
|
|
{% load static %}
|
|
{% block title %}{{ _('Customers')|capfirst }}{% endblock title %}
|
|
{% block vendors %}<a class="nav-link active">{{ _("Customers")|capfirst }}</a>{% endblock %}
|
|
|
|
{% block content %}
|
|
<section class="pt-5 pb-9">
|
|
<div class="container">
|
|
<h2 class="mb-4">{{ _("Customers")|capfirst }}</h2>
|
|
<div class="row g-3 justify-content-between mb-4">
|
|
<div class="col-auto">
|
|
<div class="d-md-flex justify-content-between">
|
|
<div>
|
|
<a href="{% url 'customer_create' %}" class="btn btn-primary me-4"><span class="fas fa-plus me-2"></span>{{ _("Add Customer") }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-auto">
|
|
<div class="d-flex">
|
|
<div class="search-box me-2">
|
|
<form method="get" class="d-inline-block position-relative">
|
|
<div class="input-group">
|
|
<button type="submit" class="btn btn-phoenix-primary"><span class="fas fa-search search-box-icon"></span></button>
|
|
<input name="q" class="form-control search-input search" type="search" placeholder="{{ _('Enter customer name') }}" value="{{ request.GET.q }}"/>
|
|
{% if request.GET.q %}
|
|
<a href="{% url request.resolver_match.view_name %}" class="btn btn-close"></a>
|
|
</div>
|
|
{% endif %}
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% if page_obj.object_list %}
|
|
<div class="table-responsive scrollbar mx-n1 px-1">
|
|
|
|
<table class="table fs-9 mb-0 border-top border-translucent">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th class="sort white-space-nowrap align-middle text-uppercase ps-0" scope="col" data-sort="name" style="width:25%;">{{ _("Name")|capfirst }}</th>
|
|
<th class="sort align-middle ps-4 pe-5 text-uppercase border-end border-translucent" scope="col" data-sort="email" style="width:15%;">
|
|
<div class="d-inline-flex flex-center">
|
|
<div class="d-flex align-items-center px-1 py-1 bg-success-subtle rounded me-2"><span class="text-success-dark" data-feather="mail"></span></div><span>{{ _("email")|capfirst }}</span>
|
|
</div>
|
|
</th>
|
|
<th class="sort align-middle ps-4 pe-5 text-uppercase border-end border-translucent" scope="col" data-sort="phone" style="width:15%; min-width: 180px;">
|
|
<div class="d-inline-flex flex-center">
|
|
<div class="d-flex align-items-center px-1 py-1 bg-primary-subtle rounded me-2"><span class="text-primary-dark" data-feather="phone"></span></div><span>{{ _("Phone Number") }}</span>
|
|
</div>
|
|
</th>
|
|
<th class="sort align-middle ps-4 pe-5 text-uppercase border-end border-translucent" scope="col" data-sort="contact" style="width:15%;">
|
|
<div class="d-inline-flex flex-center">
|
|
<div class="d-flex align-items-center px-1 py-1 bg-info-subtle rounded me-2"><span class="text-info-dark" data-feather="user"></span></div><span>{{ _("National ID")|capfirst }}</span>
|
|
</div>
|
|
</th>
|
|
<th class="sort align-middle ps-4 pe-5 text-uppercase border-end border-translucent" scope="col" data-sort="company" style="width:15%;">
|
|
<div class="d-inline-flex flex-center">
|
|
<div class="d-flex align-items-center px-1 py-1 bg-warning-subtle rounded me-2"><span class="text-warning-dark" data-feather="grid"></span></div><span>{{ _("Address")|capfirst }}</span>
|
|
</div>
|
|
</th>
|
|
<th class="sort align-middle ps-4 pe-5 text-uppercase" scope="col" data-sort="date" style="width:15%;">
|
|
{{ _("Create date") }}</th>
|
|
<th class="sort text-end align-middle pe-0 ps-4" scope="col"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="list" id="leal-tables-body">
|
|
|
|
{% for customer in customers %}
|
|
<!-- Delete Modal -->
|
|
<div class="modal fade" id="deleteModal"
|
|
data-bs-backdrop="static"
|
|
data-bs-keyboard="false"
|
|
tabindex="-1"
|
|
aria-labelledby="deleteModalLabel"
|
|
aria-hidden="true">
|
|
<div class="modal-dialog modal-sm">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="deleteModalLabel">
|
|
|
|
{% trans "Delete Customer" %}
|
|
<span data-feather="alert-circle"></span>
|
|
</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body text-center">
|
|
<p class="mb-0 text-danger fw-bold">
|
|
{% trans "Are you sure you want to delete this customer?" %}
|
|
</p>
|
|
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">
|
|
{% trans "No" %}
|
|
</button>
|
|
<a type="button" class="btn btn-danger btn-sm" href="{% url 'customer_delete' customer.id %}">
|
|
{% trans "Yes" %}
|
|
</a>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<tr class="hover-actions-trigger btn-reveal-trigger position-static">
|
|
<td>
|
|
{% if customer.is_lead %}
|
|
<span class="badge badge-phoenix fs-10 badge-phoenix-success">
|
|
<span class="badge-label">{{ _("Lead") }}</span>
|
|
<span class="ms-1" data-feather="check" style="height:13px;width:13px;"></span>
|
|
</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="name align-middle white-space-nowrap ps-0">
|
|
<div class="d-flex align-items-center">
|
|
<div><a class="fs-8 fw-bold" href="{% url 'customer_detail' customer.id %}">{{ customer.first_name }} {{ customer.middle_name }} {{ customer.last_name }}</a>
|
|
<div class="d-flex align-items-center">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td class="email align-middle white-space-nowrap fw-semibold ps-4 border-end border-translucent"><a class="text-body-highlight" href="">{{ customer.email }}</a></td>
|
|
<td class="phone align-middle white-space-nowrap fw-semibold ps-4 border-end border-translucent"><a class="text-body-highlight" href="tel:{{ customer.phone_number }}">{{ customer.phone_number }}</a></td>
|
|
<td class="contact align-middle white-space-nowrap ps-4 border-end border-translucent fw-semibold text-body-highlight">{{ customer.national_id }}</td>
|
|
<td class="company align-middle white-space-nowrap text-body-tertiary text-opacity-85 ps-4 border-end border-translucent fw-semibold text-body-highlight">
|
|
{{ customer.address }}</td>
|
|
<td class="date align-middle white-space-nowrap text-body-tertiary text-opacity-85 ps-4 text-body-tertiary">{{ customer.created|date }}</td>
|
|
<td class="align-middle white-space-nowrap text-end pe-0 ps-4">
|
|
<div class="btn-reveal-trigger position-static">
|
|
<button class="btn btn-sm dropdown-toggle dropdown-caret-none transition-none btn-reveal fs-10" type="button" data-bs-toggle="dropdown" data-boundary="window" aria-haspopup="true" aria-expanded="false" data-bs-reference="parent"><span class="fas fa-ellipsis-h fs-10"></span></button>
|
|
<div class="dropdown-menu dropdown-menu-end py-2">
|
|
<a href="{% url 'customer_update' customer.id %}" class="dropdown-item text-success-dark">{% trans "Edit" %}</a>
|
|
{% if customer.is_lead %}
|
|
<a href="{% url 'create_opportunity' customer.pk %}" class="dropdown-item text-warning-dark">{{_("Opportunity")}}</a>
|
|
{% else %}
|
|
<a href="{% url 'create_lead' customer.pk %}" class="dropdown-item text-success-dark">{{ _("Mark as Lead")}}</a>
|
|
{% endif %}
|
|
<div class="dropdown-divider"></div><button class="dropdown-item text-danger" data-bs-toggle="modal" data-bs-target="#deleteModal">{% trans "Delete" %}</button>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
{% endif %}
|
|
</table>
|
|
</div>
|
|
<div class="row align-items-center justify-content-end py-4 pe-0 fs-9">
|
|
<!-- 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>
|
|
</section>
|
|
|
|
{% endblock %} |