haikal/templates/sales/invoices/invoice_list.html
2025-09-24 13:13:59 +03:00

108 lines
6.1 KiB
HTML

{% extends "base.html" %}
{% load i18n static %}
{% block title %}
{{ _("Invoices") }}
{% endblock title %}
{% block content %}
<div class="container-fluid py-5">
{% if invoices or request.GET.q %}
<div class="card shadow-lg border-0 rounded-4">
<div class="card-body p-4 p-md-5">
<div class="d-flex flex-column flex-md-row justify-content-between align-items-md-center mb-4">
<div class="mb-3 mb-md-0">
<h1 class="display-5 fw-bolder mb-0">
{% trans "Invoices" %}
<i class="fa-solid fa-receipt ms-2 text-primary"></i>
</h1>
<p class="text-secondary mt-1 mb-0">
{% trans "Manage and track all your customer invoices." %}
</p>
</div>
</div>
{% comment %}
<div class="d-flex justify-content-end mb-4">
{% include 'partials/search_box.html' %}
</div>
{% endcomment %}
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead class="bg-light">
<tr class="text-uppercase text-secondary fw-bold small">
<th scope="col" style="width:20%">{% trans "Invoice Number" %}</th>
<th scope="col" style="width:20%">{% trans "Customer" %}</th>
<th scope="col" style="width:15%">{% trans "Status" %}</th>
<th scope="col" style="width:20%">{% trans "Status Date" %}</th>
<th scope="col" style="width:15%">{% trans "Created" %}</th>
<th scope="col" style="width:10%" class="text-end">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
{% for invoice in invoices %}
<tr class="hover-shadow">
<td class="align-middle fw-semibold ">{{ invoice.invoice_number }}</td>
<td class="align-middle text-body-tertiary">{{ invoice.customer }}</td>
<td class="align-middle">
{% if invoice.is_past_due %}
<span class="badge rounded-pill text-bg-danger">{% trans "Past Due" %}</span>
{% elif invoice.is_approved %}
<span class="badge rounded-pill text-bg-success">{% trans "Approved" %}</span>
{% elif invoice.is_canceled %}
<span class="badge rounded-pill text-bg-secondary">{% trans "Canceled" %}</span>
{% elif invoice.is_draft %}
<span class="badge rounded-pill text-bg-warning">{% trans "Draft" %}</span>
{% elif invoice.is_review %}
<span class="badge rounded-pill text-bg-info">{% trans "In Review" %}</span>
{% elif invoice.is_paid %}
<span class="badge rounded-pill text-bg-success">{% trans "Paid" %}</span>
{% endif %}
</td>
<td class="align-middle text-body-tertiary">
{% if invoice.invoice_status == "in_review" %}
{{ invoice.date_in_review|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "approved" %}
{{ invoice.date_approved|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "canceled" %}
{{ invoice.date_canceled|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "draft" %}
{{ invoice.date_draft|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "paid" %}
{{ invoice.date_paid|date:"M d, Y"|default:"N/A" }}
{% endif %}
</td>
<td class="align-middle text-body-tertiary">
{{ invoice.created|date:"M d, Y" }}
</td>
<td class="align-middle text-end">
<a href="{% url 'invoice_detail' request.dealer.slug request.entity.slug invoice.pk %}"
class="btn btn-sm btn-primary">
<i class="fa-regular fa-eye me-1"></i>
{% trans "View" %}
</a>
</td>
</tr>
{% empty %}
<tr>
<td colspan="6" class="text-center py-5 text-muted">{% trans "No invoices found." %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-4">
{% include 'partials/pagination.html' %}
</div>
{% endif %}
</div>
</div>
{% else %}
{% url 'estimate_create' request.dealer.slug as create_url %}
{% include "empty-illustration-page.html" with title=_("No Invoices Yet") subtitle=_("Looks like you haven't created any invoices. Start by creating a new invoice or quotation.") url=create_url button_text=_("Create First Invoice") %}
{% endif %}
</div>
{% endblock %}