haikal/templates/ledger/ledger/ledger_list.html

131 lines
9.1 KiB
HTML

{% extends "base.html" %}
{% load i18n static %}
{% block title %}
{{ _("Ledger") }}
{% endblock title %}
{% block content %}
<div class="row mt-4">
<div class="d-flex justify-content-between mb-2">
<h3 class="">{% trans "Ledger" %}</h3>
{% if perms.django_ledger.add_ledgermodel %}
<a href="{% url 'ledger_create' request.dealer.slug request.dealer.entity.slug %}"
class="btn btn-md btn-phoenix-primary"><i class="fa fa-plus me-2"></i>{% trans 'Create Ledger' %}</a>
{% endif %}
</div>
<div class="table-responsive px-1 scrollbar mt-3">
<table class="table align-items-center table-flush">
<thead>
<tr class="bg-body-highlight">
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Ledger Name" %}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Journal Entries" %}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Created Date" %}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Posted" %}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Locked" %}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Action" %}</th>
</tr>
</thead>
<tbody class="list">
{% for ledger in ledgers %}
<tr class="hover-actions-trigger btn-reveal-trigger position-static">
<td class="align-middle product white-space-nowrap px-1">
{% if ledger.invoicemodel %}
{% if perms.django_ledger.view_invoicemodel %}
<a href="{% url 'invoice_detail' request.dealer.slug request.entity.slug ledger.invoicemodel.pk %}">{{ ledger.get_wrapped_model_instance }}</a>
{% endif %}
{% elif ledger.billmodel %}
{% if perms.django_ledger.view_billmodel %}
<a href="{% url 'bill-detail' request.dealer.slug request.dealer.entity.slug ledger.billmodel.pk %}">{{ ledger.get_wrapped_model_instance }}</a>
{% endif %}
{% else %}
<a href="#">{{ ledger.name }}</a>
{% endif %}
</td>
<td class="align-middle product white-space-nowrap">
{% if perms.django_ledger.view_journalentrymodel %}
<a class="btn btn-sm btn-phoenix-primary"
href="{% url 'journalentry_list' request.dealer.slug ledger.pk %}">
<i class="fa-solid fa-right-left"></i>
<span>
<span class="has-text-weight-bold">{{ ledger.journal_entries__count }}</span>
<span>{{ _("Journal Entries") }}</span>
</span>
</a>
{% endif %}
</td>
<td class="align-middle product white-space-nowrap">{{ ledger.created |date }}</td>
<td class="align-middle product white-space-nowrap">
{% if ledger.is_posted %}
<i class="fa-solid fa-square-check text-success"></i>
{% else %}
<i class="fa-solid fa-circle-xmark text-danger"></i>
{% endif %}
</td>
<td class="align-middle product white-space-nowrap">
{% if ledger.is_locked %}
<i class="fa-solid fa-lock text-success"></i>
{% else %}
<i class="fa-solid fa-unlock text-danger"></i>
{% endif %}
</td>
<td class="align-middle white-space-nowrap text-start">
<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.django_ledger.change_ledgermodel %}
{% if ledger.can_lock %}
<a href="{% url 'ledger-action-lock' dealer_slug=request.dealer.slug entity_slug=entity_slug ledger_pk=ledger.uuid %}"
class="dropdown-item has-text-info has-text-weight-bold">{% trans 'Lock' %}</a>
{% endif %}
{% if ledger.can_unlock %}
<a href="{% url 'ledger-action-unlock' dealer_slug=request.dealer.slug entity_slug=entity_slug ledger_pk=ledger.uuid %}"
class="dropdown-item has-text-warning has-text-weight-bold">{% trans 'UnLock' %}</a>
{% endif %}
{% if ledger.can_post %}
<a href="{% url 'ledger-action-post' dealer_slug=request.dealer.slug entity_slug=entity_slug ledger_pk=ledger.uuid %}"
class="dropdown-item has-text-info has-text-weight-bold text-success">{% trans 'Post' %}</a>
{% endif %}
{% if ledger.can_unpost %}
<a href="{% url 'ledger-action-unpost' dealer_slug=request.dealer.slug entity_slug=entity_slug ledger_pk=ledger.uuid %}"
class="dropdown-item has-text-warning has-text-weight-bold text-info">{% trans 'UnPost' %}</a>
{% endif %}
{% if ledger.can_hide %}
<a href="{% url 'ledger-action-hide' dealer_slug=request.dealer.slug entity_slug=entity_slug ledger_pk=ledger.uuid %}"
class="dropdown-item has-text-warning has-text-weight-bold text-danger">{% trans 'Hide' %}</a>
{% endif %}
{% if ledger.can_unhide %}
<a href="{% url 'ledger-action-unhide' dealer_slug=request.dealer.slug entity_slug=entity_slug ledger_pk=ledger.uuid %}"
class="dropdown-item has-text-danger has-text-weight-bold">{% trans 'UnHide' %}</a>
{% endif %}
{% if ledger.can_delete %}
<a href="{% url 'ledger-delete' dealer_slug=request.dealer.slug entity_slug=entity_slug ledger_pk=ledger.uuid %}"
class="dropdown-item has-text-danger has-text-weight-bold text-danger">{% trans 'Delete' %}</a>
{% endif %}
{% endif %}
</div>
</div>
</td>
</tr>
{% empty %}
<tr>
<td colspan="6" class="text-center">{% trans "No Entries found" %}</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>
{% endblock %}