haikal/templates/organizations/organization_list.html

193 lines
12 KiB
HTML

{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% block title %}
{% trans 'Organizations' %}
{% endblock %}
{% block organizations %}
<a class="nav-link active">{% trans 'Organizations' %}</a>
{% endblock %}
{% block content %}
{% if organizations%}
<section class="pt-5 pb-9 ">
<div class="row overflow-x-auto whitespace-nowrap -mx-2 sm:mx-0">
<h2 class="mb-4">
{% trans 'Organizations' %}
<li class="fas fa-city text-primary ms-2"></li>
</h2>
<div class="row g-3 justify-content-between mb-4">
<div class="col-auto">
<div class="d-md-flex justify-content-between">
{% if perms.inventory.add_organization %}
<div>
<a href="{% url 'organization_create' request.dealer.slug %}"
class="btn btn-sm btn-phoenix-primary"><span class="fas fa-plus me-2"></span>{% trans 'add organization'|capfirst %}</a>
</div>
{% endif %}
</div>
</div>
<div class="col-auto">
<div class="d-flex">{% include 'partials/search_box.html' %}</div>
</div>
</div>
<div class="table-responsive scrollbar mx-n1 px-1">
<table class="table align-items-center table-flush table-hover">
<thead>
<tr class="bg-body-highlight">
<th class="sort white-space-nowrap align-middle text-uppercase ps-0 px-1"
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="name"
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="fs-7 text-success-dark far fa-file-alt"></span>
</div>
<span>{% trans 'CRN' %}</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="fs-7 text-primary-dark fas fa-money-check-alt"></span>
</div>
<span>{% trans 'VRN' %}</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="phone"></span>
</div>
<span>{% trans 'Phone' %}</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>{% trans 'Address' %}</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 org in organizations %}
<!-- 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 Organization' %}
<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 Organization?' %}</p>
<button type="button"
class="btn btn-phoenix-secondary btn-sm"
data-bs-dismiss="modal">{% trans 'No' %}</button>
<a type="button"
class="btn btn-phoenix-danger btn-sm"
href="{% url 'organization_delete' request.dealer.slug org.slug %}">{% trans 'Yes' %}</a>
</div>
</div>
</div>
</div>
<tr class="hover-actions-trigger btn-reveal-trigger position-static">
<td class="name align-middle white-space-nowrap ps-0 px-1">
<div class="d-flex align-items-center">
<div>
<a class="fs-8 fw-bold"
href="{% url 'organization_detail' request.dealer.slug org.slug %}">{{ org.name }}</a>
</div>
</div>
</td>
<td class="email align-middle white-space-nowrap fw-semibold ps-4 border-end border-translucent">{{ org.crn }}</td>
<td class="phone align-middle white-space-nowrap fw-semibold ps-4 border-end border-translucent">{{ org.vrn }}</td>
<td class="phone align-middle white-space-nowrap ps-4 border-end border-translucent fw-semibold text-body-highlight">
<a class="text-body-highlight" href="tel:{{ org.phone }}">{{ org.phone_number }}</a>
</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">
{{ org.address }}
</td>
<td class="date align-middle white-space-nowrap text-body-tertiary text-opacity-85 ps-4 text-body-tertiary">
{{ org.created|date }}
</td>
<td class="align-middle white-space-nowrap text-end pe-0 ps-4">
{% if perms.inventory.change_organization or perms.inventory.delete_organization %}
<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">
{% if perms.inventory.change_organization %}
<a href="{% url 'organization_update' request.dealer.slug org.slug %}"
class="dropdown-item text-success-dark">{% trans 'Edit' %}</a>
{% endif %}
{% if perms.inventory.delete_organization %}
<div class="dropdown-divider"></div>
<button class="dropdown-item text-danger"
data-bs-toggle="modal"
data-bs-target="#deleteModal">{% trans 'Delete' %}</button>
{% endif %}
</div>
</div>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">{% include 'partials/pagination.html' %}</div>
</div>
{% endif %}
</div>
</section>
{% else %}
{% url 'organization_create' request.dealer.slug as create_organization_url %}
{% include "empty-illustration-page.html" with value="organization" url=create_organization_url %}
{% endif %}
{% endblock %}