Merge pull request 'few frondend fixes' (#280) from frontend into main

Reviewed-on: #280
This commit is contained in:
ismail 2025-09-24 14:56:05 +03:00
commit 9c52e29a87
2 changed files with 125 additions and 117 deletions

View File

@ -2,78 +2,71 @@
{% load i18n %} {% load i18n %}
{% load custom_filters %} {% load custom_filters %}
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% block title %} {% block title %}
{% trans "Groups" %} {% trans "Groups" %}
{% endblock title %} {% endblock title %}
{% block content %}
<main class="py-5">
<div class="container">
{% if groups or request.GET.q %}
<div class=" d-flex flex-column flex-md-row justify-content-between align-items-md-center p-4">
<h5 class="card-title mb-2 mb-md-0 me-md-4 fw-bold">
<i class="fa-solid fa-user-group fs-3 me-1 "></i>{% trans "Groups" %}
</h5>
<div class="d-flex gap-2">
<a href="{% url 'group_create' request.dealer.slug %}"
class="btn btn-phoenix-primary">
<i class="fa-solid fa-user-group fs-9 me-1"></i>
<span class="fas fa-plus me-2"></span>{% trans "Add Group" %}
</a>
<a href="{% url 'user_list' request.dealer.slug %}"
class="btn btn-phoenix-secondary">
<span class="fas fas fa-arrow-left me-2"></span>{% trans "Back to Staffs" %}
</a>
</div>
</div>
<div class="card border-0 rounded-4 animate__animated animate__fadeInUp">
<div class="card-body p-0"> {% block content %}
<div class="table-responsive scrollbar mx-n1 px-1 mt-3"> <div class="container py-5">
<table class="table align-items-center table-hover mb-0"> {% if groups or request.GET.q %}
<thead> <div class="d-flex align-items-center justify-content-between mb-4">
<tr class=""> <h1 class="h3 mb-0 text-muted d-flex align-items-center">
<th scope="col" class=" text-uppercase fw-bold ps-4">{% trans 'name'|capfirst %}</th> <i class="fa-solid fa-user-group me-3 fs-2"></i>
<th scope="col" class="text-uppercase fw-bold">{% trans 'total Users'|capfirst %}</th> {% trans "Groups" %}
<th scope="col" class="text-uppercase fw-bold">{% trans 'total permission'|capfirst %}</th> </h1>
<th scope="col" <div class="d-flex">
class="text-uppercase fw-bold text-end pe-4"> <a href="{% url 'group_create' request.dealer.slug %}"
{% trans 'actions'|capfirst %} class="btn btn-phoenix-primary me-2 shadow-sm">
</th> <i class="fa-solid fa-plus me-2"></i>{% trans "Add New Group" %}
</tr> </a>
</thead> <a href="{% url 'user_list' request.dealer.slug %}"
<tbody> class="btn btn-phoenix-secondary shadow-sm">
{% for group in groups %} <i class="fa-solid fa-arrow-left me-2"></i>{% trans "Back to Staffs" %}
<tr> </a>
<td class="align-middle white-space-nowrap ps-4">{{ group.name }}</td>
<td class="align-middle white-space-nowrap">
<i class="fa-solid fa-users me-1"></i> {{ group.users.count }}
</td>
<td class="align-middle white-space-nowrap">
<i class="fa-solid fa-unlock me-1"></i> {{ group.permissions.count }}
</td>
<td class="align-middle white-space-nowrap text-end pe-4">
<a class="btn btn-phoenix-secondary btn-sm"
href="{% url 'group_detail' request.dealer.slug group.id %}">
<i class="fa-solid fa-eye me-1"></i>
{% trans 'view Permissions'|capfirst %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="card-footer bg-light border-top">
<div class="d-flex justify-content-end">{% include 'partials/pagination.html' %}</div>
</div>
{% endif %}
</div> </div>
{% else %} </div>
{% url "group_create" request.dealer.slug as create_group_url %} <div class="card border-0 shadow-sm rounded-lg">
{% include "empty-illustration-page.html" with value="group" url=create_group_url %} <div class="card-body p-0">
{% endif %} <div class="table-responsive">
</div> <table class="table table-hover table-borderless mb-0">
</main> <thead class="bg-light">
{% endblock %} <tr>
<th class="py-3 px-4">{% trans 'Name'|capfirst %}</th>
<th class="py-3 px-4">{% trans 'Total Users'|capfirst %}</th>
<th class="py-3 px-4">{% trans 'Total Permissions'|capfirst %}</th>
<th class="py-3 px-4 text-center">{% trans 'Actions'|capfirst %}</th>
</tr>
</thead>
<tbody>
{% for group in groups %}
<tr class="border-bottom">
<td class="align-middle py-3 px-4">{{ group.name }}</td>
<td class="align-middle py-3 px-4 text-muted">
<i class="fa-solid fa-users me-1"></i> {{ group.users.count }}
</td>
<td class="align-middle py-3 px-4 text-muted">
<i class="fa-solid fa-unlock me-1"></i> {{ group.permissions.count }}
</td>
<td class="align-middle py-3 px-4 text-center">
<a class="btn btn-sm btn-phoenix-secondary"
href="{% url 'group_detail' request.dealer.slug group.id %}">
<i class="fa-solid fa-eye me-1"></i>{% trans 'View Permissions' %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-center mt-4">{% include 'partials/pagination.html' %}</div>
{% endif %}
</div>
{% else %}
{% url "group_create" request.dealer.slug as create_group_url %}
{% include "empty-illustration-page.html" with value="group" url=create_group_url %}
{% endif %}
</div>
{% endblock %}

View File

@ -4,69 +4,80 @@
{{ _("Invoices") }} {{ _("Invoices") }}
{% endblock title %} {% endblock title %}
{% block content %} {% block content %}
<div class="container-fluid py-5">
{% if invoices or request.GET.q %} {% if invoices or request.GET.q %}
<div class="row mt-4"> <div class="card shadow-lg border-0 rounded-4">
<div class="row g-3 justify-content-between mb-4"> <div class="card-body p-4 p-md-5">
<div class="col-auto">
<div class="d-md-flex justify-content-between"> <div class="d-flex flex-column flex-md-row justify-content-between align-items-md-center mb-4">
<h2 class="mb-3"> <div class="mb-3 mb-md-0">
{% trans "Invoices" %}<i class="fa-solid fa-receipt ms-2 text-primary"></i> <h1 class="display-5 fw-bolder mb-0">
</h2> {% trans "Invoices" %}
</div> <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="col-auto">
<div class="d-flex">{% include 'partials/search_box.html' %}</div>
</div> {% endcomment %}
</div> </div>
<div class="table-responsive px-1 scrollbar">
<table class="table align-items-center table-flush"> {% comment %}
<thead> <div class="d-flex justify-content-end mb-4">
<tr class="bg-body-highlight"> {% include 'partials/search_box.html' %}
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Invoice Number" %}</th> </div>
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Customer" %}</th> {% endcomment %}
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Status" %}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Status Date" %}</th> <div class="table-responsive">
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Created" %}</th> <table class="table table-hover align-middle">
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Actions" %}</th> <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> </tr>
</thead> </thead>
<tbody class="list"> <tbody>
{% for invoice in invoices %} {% for invoice in invoices %}
<tr class="hover-actions-trigger btn-reveal-trigger position-static"> <tr class="hover-shadow">
<td class="align-middle product white-space-nowrap py-0 px-1">{{ invoice.invoice_number }}</td> <td class="align-middle fw-semibold ">{{ invoice.invoice_number }}</td>
<td class="align-middle product white-space-nowrap">{{ invoice.customer }}</td> <td class="align-middle text-body-tertiary">{{ invoice.customer }}</td>
<td class="align-middle product white-space-nowrap text-success"> <td class="align-middle">
{% if invoice.is_past_due %} {% if invoice.is_past_due %}
<span class="badge badge-phoenix badge-phoenix-danger">{% trans "Past Due" %}</span> <span class="badge rounded-pill text-bg-danger">{% trans "Past Due" %}</span>
{% elif invoice.is_approved %} {% elif invoice.is_approved %}
<span class="badge badge-phoenix badge-phoenix-success">{% trans "Approved" %}</span> <span class="badge rounded-pill text-bg-success">{% trans "Approved" %}</span>
{% elif invoice.is_canceled %} {% elif invoice.is_canceled %}
<span class="badge badge-phoenix badge-phoenix-secondary">{% trans "Canceled" %}</span> <span class="badge rounded-pill text-bg-secondary">{% trans "Canceled" %}</span>
{% elif invoice.is_draft %} {% elif invoice.is_draft %}
<span class="badge badge-phoenix badge-phoenix-warning">{% trans "Draft" %}</span> <span class="badge rounded-pill text-bg-warning">{% trans "Draft" %}</span>
{% elif invoice.is_review %} {% elif invoice.is_review %}
<span class="badge badge-phoenix badge-phoenix-info">{% trans "In Review" %}</span> <span class="badge rounded-pill text-bg-info">{% trans "In Review" %}</span>
{% elif invoice.is_paid %} {% elif invoice.is_paid %}
<span class="badge badge-phoenix badge-phoenix-success">{% trans "Paid" %}</span> <span class="badge rounded-pill text-bg-success">{% trans "Paid" %}</span>
{% endif %} {% endif %}
</td> </td>
<td class="align-middle product white-space-nowrap"> <td class="align-middle text-body-tertiary">
{% if invoice.invoice_status == "in_review" %} {% if invoice.invoice_status == "in_review" %}
{{ invoice.date_in_review }} {{ invoice.date_in_review|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "approved" %} {% elif invoice.invoice_status == "approved" %}
{{ invoice.date_approved }} {{ invoice.date_approved|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "canceled" %} {% elif invoice.invoice_status == "canceled" %}
{{ invoice.date_canceled }} {{ invoice.date_canceled|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "draft" %} {% elif invoice.invoice_status == "draft" %}
{{ invoice.date_draft }} {{ invoice.date_draft|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "paid" %} {% elif invoice.invoice_status == "paid" %}
{{ invoice.date_paid }} {{ invoice.date_paid|date:"M d, Y"|default:"N/A" }}
{% endif %} {% endif %}
</td> </td>
<td class="align-middle product white-space-nowrap">{{ invoice.created }}</td> <td class="align-middle text-body-tertiary">
<td class="align-middle product white-space-nowrap"> {{ 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 %}" <a href="{% url 'invoice_detail' request.dealer.slug request.entity.slug invoice.pk %}"
class="btn btn-sm btn-phoenix-success"> class="btn btn-sm btn-primary">
<i class="fa-regular fa-eye me-1"></i> <i class="fa-regular fa-eye me-1"></i>
{% trans "View" %} {% trans "View" %}
</a> </a>
@ -74,20 +85,24 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<td colspan="6" class="text-center">{% trans "No Invoice Found" %}</td> <td colspan="6" class="text-center py-5 text-muted">{% trans "No invoices found." %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
{% if page_obj.paginator.num_pages > 1 %} {% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3"> <div class="d-flex justify-content-end mt-4">
<div class="d-flex">{% include 'partials/pagination.html' %}</div> {% include 'partials/pagination.html' %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div>
{% else %} {% else %}
{% url 'estimate_create' request.dealer.slug as url %} {% url 'estimate_create' request.dealer.slug as create_url %}
{% include "empty-illustration-page.html" with value=_("invoice") url=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 %} {% endif %}
{% endblock %} </div>
{% endblock %}