few frondend fixes #280

Merged
ismail merged 3 commits from frontend into main 2025-09-24 14:56:05 +03:00
2 changed files with 125 additions and 117 deletions

View File

@ -2,78 +2,71 @@
{% load i18n %}
{% load custom_filters %}
{% load render_table from django_tables2 %}
{% block title %}
{% trans "Groups" %}
{% 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">
<div class="table-responsive scrollbar mx-n1 px-1 mt-3">
<table class="table align-items-center table-hover mb-0">
<thead>
<tr class="">
<th scope="col" class=" text-uppercase fw-bold ps-4">{% trans 'name'|capfirst %}</th>
<th scope="col" class="text-uppercase fw-bold">{% trans 'total Users'|capfirst %}</th>
<th scope="col" class="text-uppercase fw-bold">{% trans 'total permission'|capfirst %}</th>
<th scope="col"
class="text-uppercase fw-bold text-end pe-4">
{% trans 'actions'|capfirst %}
</th>
</tr>
</thead>
<tbody>
{% for group in groups %}
<tr>
<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 %}
{% block content %}
<div class="container py-5">
{% if groups or request.GET.q %}
<div class="d-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-muted d-flex align-items-center">
<i class="fa-solid fa-user-group me-3 fs-2"></i>
{% trans "Groups" %}
</h1>
<div class="d-flex">
<a href="{% url 'group_create' request.dealer.slug %}"
class="btn btn-phoenix-primary me-2 shadow-sm">
<i class="fa-solid fa-plus me-2"></i>{% trans "Add New Group" %}
</a>
<a href="{% url 'user_list' request.dealer.slug %}"
class="btn btn-phoenix-secondary shadow-sm">
<i class="fa-solid fa-arrow-left me-2"></i>{% trans "Back to Staffs" %}
</a>
</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>
</main>
{% endblock %}
</div>
<div class="card border-0 shadow-sm rounded-lg">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover table-borderless mb-0">
<thead class="bg-light">
<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") }}
{% endblock title %}
{% block content %}
<div class="container-fluid py-5">
{% if invoices or request.GET.q %}
<div class="row mt-4">
<div class="row g-3 justify-content-between mb-4">
<div class="col-auto">
<div class="d-md-flex justify-content-between">
<h2 class="mb-3">
{% trans "Invoices" %}<i class="fa-solid fa-receipt ms-2 text-primary"></i>
</h2>
</div>
<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>
{% comment %} <div class="col-auto">
<div class="d-flex">{% include 'partials/search_box.html' %}</div>
</div> {% endcomment %}
</div>
<div class="table-responsive px-1 scrollbar">
<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 "Invoice Number" %}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Customer" %}</th>
<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>
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Created" %}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{% trans "Actions" %}</th>
{% 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 class="list">
<tbody>
{% for invoice in invoices %}
<tr class="hover-actions-trigger btn-reveal-trigger position-static">
<td class="align-middle product white-space-nowrap py-0 px-1">{{ invoice.invoice_number }}</td>
<td class="align-middle product white-space-nowrap">{{ invoice.customer }}</td>
<td class="align-middle product white-space-nowrap text-success">
<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 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 %}
<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 %}
<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 %}
<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 %}
<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 %}
<span class="badge badge-phoenix badge-phoenix-success">{% trans "Paid" %}</span>
<span class="badge rounded-pill text-bg-success">{% trans "Paid" %}</span>
{% endif %}
</td>
<td class="align-middle product white-space-nowrap">
<td class="align-middle text-body-tertiary">
{% 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" %}
{{ invoice.date_approved }}
{{ invoice.date_approved|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "canceled" %}
{{ invoice.date_canceled }}
{{ invoice.date_canceled|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "draft" %}
{{ invoice.date_draft }}
{{ invoice.date_draft|date:"M d, Y"|default:"N/A" }}
{% elif invoice.invoice_status == "paid" %}
{{ invoice.date_paid }}
{{ invoice.date_paid|date:"M d, Y"|default:"N/A" }}
{% endif %}
</td>
<td class="align-middle product white-space-nowrap">{{ invoice.created }}</td>
<td class="align-middle product white-space-nowrap">
<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-phoenix-success">
class="btn btn-sm btn-primary">
<i class="fa-regular fa-eye me-1"></i>
{% trans "View" %}
</a>
@ -74,20 +85,24 @@
</tr>
{% empty %}
<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>
{% 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 class="d-flex justify-content-end mt-4">
{% include 'partials/pagination.html' %}
</div>
{% endif %}
</div>
</div>
{% else %}
{% url 'estimate_create' request.dealer.slug as url %}
{% include "empty-illustration-page.html" with value=_("invoice") url=url %}
{% 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 %}
{% endblock %}
</div>
{% endblock %}