Merge pull request 'Ui changes to User Profile' (#43) from frontend into main

Reviewed-on: #43
This commit is contained in:
ismail 2025-05-22 18:08:37 +03:00
commit f3d95e6486
15 changed files with 92 additions and 66 deletions

View File

@ -4755,7 +4755,7 @@ def lead_create(request):
instance.staff = form.cleaned_data.get("staff")
if instance.lead_type == "customer":
customer = models.Customer.objects.filter(email=instance.email)
customer = models.Customer.objects.filter(email=instance.email).first()
if not customer:
customer = models.Customer(
dealer=dealer,
@ -4773,7 +4773,7 @@ def lead_create(request):
if instance.lead_type == "organization":
organization = models.Organization.objects.filter(
email=instance.email
)
).first()
if not organization:
organization = models.Organization(
dealer=dealer,
@ -4794,6 +4794,7 @@ def lead_create(request):
messages.error(
request, f"Lead was not created ... : {str(form.errors)}"
)
print(form.errors)
except Exception as e:
messages.error(request, f"Lead was not created ... : {str(e)}")
@ -4805,7 +4806,15 @@ def lead_create(request):
id_car_make=int(make)
)
else:
if first_make := form.fields["id_car_make"].queryset.first():
dealer_make_list = models.DealersMake.objects.filter(dealer=dealer).values_list("car_make",flat=True)
qs = form.fields["id_car_make"].queryset
form.fields["id_car_make"].queryset = qs.filter(is_sa_import=True,pk__in=dealer_make_list)
form.fields["id_car_make"].choices = [
(obj.id_car_make, obj.get_local_name()) for obj in qs
]
print(qs)
if first_make := qs.first():
form.fields["id_car_model"].queryset = models.CarModel.objects.filter(
id_car_make=first_make.id_car_make
)

View File

@ -42,7 +42,7 @@
<div class="text-start mb-6">
<div>
<button type="submit" class="btn btn-phoenix-primary">Update</button>
<button type="submit" class="btn btn-primary">Update</button>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block content %}
<h1><i class="fas fa-tools me-2"></i>Admin Management</h1>
<h1 class="mt-4"><i class="fas fa-tools me-2"></i>Admin Management</h1>
<div class="row row-cols-1 row-cols-md-4 g-4 mt-10">
<div class="col">
<a href="{% url 'user_management' %}">

View File

@ -53,8 +53,8 @@
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ _("Close") }}</button>
<button type="submit" class="btn btn-primary">{{ _("Save Changes") }}</button>
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">{{ _("Close") }}</button>
<button type="submit" class="btn btn-success">{{ _("Save Changes") }}</button>
</div>
</form>
</div>
@ -81,9 +81,9 @@
<div class="col-12">
{% if page_obj.object_list %}
<div class="table-responsive scrollbar mx-n1 px-1">
<table class="table fs-9 mb-0 border-top border-translucent">
<table class="table align-items-center table-flush table-hover">
<thead>
<tr>
<tr class="bg-body-highlight">
<th class="align-middle white-space-nowrap text-uppercase" scope="col" style="width: 20%;">{{ _("Lead Name")|capfirst }}</th>
<th class="align-middle white-space-nowrap text-uppercase" scope="col" style="width: 15%;">
<div class="d-inline-flex flex-center">
@ -132,7 +132,7 @@
{{ _("Action") }}
</th>
<th class="text-end white-space-nowrap align-middle" scope="col"></th>
</tr>image
</tr>
{% for lead in leads %}
<!-- Delete Modal -->
<div class="modal fade" id="deleteModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
@ -154,6 +154,7 @@
</div>
</div>
</div>
<tbody>
<tr class="hover-actions-trigger btn-reveal-trigger position-static">
<td class="name align-middle white-space-nowrap ps-0">
<div class="d-flex align-items-center">

View File

@ -26,9 +26,9 @@
{% if page_obj.object_list %}
<div class="table-responsive scrollbar transition">
<table class="table table-sm fs-9 mb-0 border-translucent">
<table class="table align-items-center table-flush table-hover">
<thead>
<tr>
<tr class="bg-body-highlight">
<th></th>
<th class="sort white-space-nowrap align-middle text-uppercase ps-0" 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="email" style="width:15%;">

View File

@ -15,11 +15,11 @@
{% csrf_token %}
{{ form|crispy }}
<div class="gap-2 mt-3">
<button type="submit" class="btn btn-phoenix-primary btn-sm">
<button type="submit" class="btn btn-success btn-sm">
<i class="fa fa-save"></i> {{ _("Save") }}
</button>
<a href="{% url 'dealer_detail' dealer.pk %}" class="btn btn-sm btn-phoenix-secondary">
<i class="fas fa-times"></i> {{ _("Cancel") }}</a>
<a href="{{request.META.HTTP_REFERER}}" class="btn btn-sm btn-danger"><i class="fa-solid fa-ban me-1"></i>{% trans "Cancel" %}</a>
</div>
</form>

View File

@ -6,7 +6,7 @@
{% block content %}
<div class="row">
<div class="row mt-4">
<div class="row">
<div class="col-sm-9">
<div class="d-sm-flex justify-content-between">
@ -32,9 +32,9 @@
<div class="text-danger">{{ error }}</div>
{% endfor %}
<div class="d-flex mb-3">
<a href="{{request.META.HTTP_REFERER}}" class="btn btn-phoenix-primary me-2 px-6"><i class="fa-solid fa-ban"></i> {% trans "Cancel"|capfirst %}</a>
<button class="btn btn-primary" type="submit">
<i class="fa-solid fa-floppy-disk"></i>
<a href="{{request.META.HTTP_REFERER}}" class="btn btn-danger me-2 "><i class="fa-solid fa-ban me-1"></i> {% trans "Cancel"|capfirst %}</a>
<button class="btn btn-success" type="submit">
<i class="fa-solid fa-floppy-disk me-1"></i>
{{ _("Save") }}
</button>
</div>

View File

@ -7,7 +7,7 @@
{% block content %}
<section class="">
<div class="row">
<div class="row mt-4">
<div class="col-auto">
<div class="d-md-flex justify-content-between">
<div>
@ -16,11 +16,11 @@
</div>
</div>
</div>
<div class="table-responsive scrollbar mx-n1 px-1">
<div class="table-responsive scrollbar mx-n1 px-1 mt-3">
<table class="table table-hover table-responsive-sm fs-9 mb-0">
<table class="table align-items-center table-flush table-hover">
<thead>
<tr>
<tr class="bg-body-highlight">
<th>{% trans 'name'|capfirst %}</th>
<th>{% trans 'total Users'|capfirst %}</th>
<th>{% trans 'total permission'|capfirst %}</th>
@ -30,10 +30,10 @@
<tbody>
{% for group in groups %}
<tr>
<td>{{ group.name }}</td>
<td><i class="fa-solid fa-users"></i> {{ group.users.count }}</td>
<td><i class="fa-solid fa-unlock"></i> {{ group.permissions.count }}</td>
<td>
<td class="align-middle white-space-nowrap ps-1">{{ 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">
<a class="btn btn-phoenix-success"
href="{% url 'group_detail' group.id %}">
<i class="fa-solid fa-eye"></i>

View File

@ -46,9 +46,9 @@
<div class="col-sm-12">
<div class="table-list" id="inventoryTable">
<div class="table-responsive scrollbar mb-3">
<table class="table table-sm fs-9 mb-0 overflow-hidden">
<table class="table align-items-center table-flush">
<thead class="text-body">
<tr>
<tr class="bg-body-highlight">
<th class="pe-1 align-middle white-space-nowrap text-center" data-sort="stock">{% trans 'Stock'|upper %}</th>
<th class="pe-1 align-middle white-space-nowrap text-start" data-sort="vin" style="min-width: 4.5rem;">{% trans "VIN" %}</th>
<th class="pe-1 align-middle white-space-nowrap text-center" data-sort="date">{% trans "Year"|upper %}</th>
@ -126,10 +126,15 @@
</table>
</div>
</div>
<!-- Pagination -->
{% if is_paginated %}
{% include 'partials/pagination.html' %}
{% endif %}
<div class="d-flex justify-content-between mt-3"><span class="d-none d-sm-inline-block" data-list-info="data-list-info">{{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }}<span class="text-body-tertiary"> {{ _("Items of")}} </span>{{ page_obj.paginator.count }}</span>
<div class="d-flex">
{% if is_paginated %}
{% include 'partials/pagination.html' %}
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -102,18 +102,18 @@
</div>
<table class="table table-sm fs-9 mb-0 border-translucent">
<thead>
<tr>
<th class="align-middle ps-1" scope="col">{{ _("VIN") }}</th>
<th class="align-middle" scope="col">{{ _("Make") }}</th>
<th class="align-middle" scope="col">{{ _("Model") }}</th>
<th class="align-middle" scope="col">{{ _("Year") }}</th>
<th class="align-middle" scope="col">{{ _("Trim") }}</th>
<th class="align-middle" scope="col">{{ _("Color") }}</th>
<th class="align-middle" scope="col">{{ _("Age") }}</th>
<th class="align-middle" scope="col">{{ _("Status") }}</th>
<th class="align-middle" scope="col"></th>
<table class="table align-items-center table-flush">
<thead class="text-body">
<tr class="bg-body-highlight">
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("VIN") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Make") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Model") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Year") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Trim") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Color") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Age") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col">{{ _("Status") }}</th>
<th class="sort white-space-nowrap align-middle" scope="col"></th>
</tr>
</thead>
<tbody class="list" id="project-list-table-body">
@ -175,7 +175,15 @@
</table>
</div>
{% include 'partials/pagination.html' %}
<div class="d-flex justify-content-between mt-3"><span class="d-none d-sm-inline-block" data-list-info="data-list-info">{{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }}<span class="text-body-tertiary"> {{ _("Items of")}} </span>{{ page_obj.paginator.count }}</span>
<div class="d-flex">
{% if is_paginated %}
{% include 'partials/pagination.html' %}
{% endif %}
</div>
</div>
</div>

View File

@ -39,9 +39,9 @@
</div>
<div class="table-responsive scrollbar mx-n1 px-1">
<table class="table table-hover fs-9 mb-0">
<table class="table align-items-center table-flush table-hover">
<thead>
<tr>
<tr class="bg-body-highlight">
<th class="sort white-space-nowrap align-middle text-uppercase ps-0" 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">
@ -103,9 +103,6 @@
<div class="d-flex align-items-center">
<div>
<a class="fs-8 fw-bold" href="{% url 'organization_detail' org.slug %}">{{ org.name }}</a>
<div class="d-flex align-items-center">
<p class="mb-0 text-body-highlight fw-semibold fs-9 me-2"></p><span class="badge badge-phoenix badge-phoenix-primary">{{ org.name }}</span>
</div>
</div>
</div>
</td>

View File

@ -11,9 +11,9 @@
{% csrf_token %}
{{ form|crispy }}
{% if object %}
<a class="btn btn-sm btn-phoenix-danger" href="{% url 'billing_info_delete' %}"><!--<span class="far fa-trash-alt"></span>--> {{ _("Delete") }}</a>
<a class="btn btn-sm btn-danger" href="{% url 'billing_info_delete' %}"><!--<span class="far fa-trash-alt"></span>--> {{ _("Delete") }}</a>
{% endif %}
<button type="submit" class="btn btn-sm btn-phoenix-primary">
<button type="submit" class="btn btn-sm btn-success">
{{ _("Save") }}
</button>
</form>

View File

@ -214,7 +214,15 @@
</table>
</div>
</div>
<div class="d-flex justify-content-between mt-3"><span class="d-none d-sm-inline-block" data-list-info="data-list-info">{{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }}<span class="text-body-tertiary"> {{ _("Items of")}} </span>{{ page_obj.paginator.count }}</span>
<div class="d-flex">
{% if is_paginated %}
{% include 'partials/pagination.html' %}
{% endif %}
</div>
</div>
</div>

View File

@ -38,9 +38,9 @@
<div class="text-danger">{{ error }}</div>
{% endfor %}
<div class="d-flex mb-3">
<a href="{{request.META.HTTP_REFERER}}" class="btn btn-phoenix-primary me-2 px-6"><i class="fa-solid fa-ban"></i> {% trans "Cancel"|capfirst %}</a>
<button class="btn btn-primary" type="submit">
<i class="fa-solid fa-floppy-disk"></i>
<a href="{{request.META.HTTP_REFERER}}" class="btn btn-danger me-2"><i class="fa-solid fa-ban me-1"></i> {% trans "Cancel"|capfirst %}</a>
<button class="btn btn-success " type="submit">
<i class="fa-solid fa-floppy-disk me-1"></i>
{{ _("Save") }}
</button>
</div>

View File

@ -7,13 +7,13 @@
{% block content %}
<section class="">
<div class="row">
<div class="row mt-4">
<div class="col-auto">
<div class="d-md-flex justify-content-between">
<div>
{% if request.user.userplan %}
<a href="{% url 'user_create' %}" class="btn btn-sm btn-phoenix-primary"><i class="fa-solid fa-user-tie"></i> {% trans "Add New Staff" %}</a>
<a href="{% url 'group_list' %}" class="btn btn-sm btn-phoenix-success"><i class="fa-solid fa-user-group"></i> {% trans "Manage Groups & Permissions" %}</a>
<a href="{% url 'user_create' %}" class="btn btn-sm btn-phoenix-primary me-4"><i class="fa-solid fa-user-tie me-1"></i> {% trans "Add New Staff" %}</a>
<a href="{% url 'group_list' %}" class="btn btn-sm btn-phoenix-success"><i class="fa-solid fa-user-group me-1"></i> {% trans "Manage Groups & Permissions" %}</a>
{% else %}
<div class="alert alert-outline-info d-flex align-items-center" role="alert">
<i class="fa-solid fa-circle-info fs-6"></i>
@ -24,11 +24,11 @@
</div>
</div>
</div>
<div class="table-responsive scrollbar mx-n1 px-1">
<div class="table-responsive scrollbar mx-n1 px-1 mt-3">
<table class="table table-hover table-responsive-sm fs-9 mb-0">
<table class="table align-items-center table-flush table-hover">
<thead>
<tr>
<tr class="bg-body-highlight">
<th>{% trans 'name'|capfirst %}</th>
<th>{% trans 'email'|capfirst %}</th>
<th>{% trans 'phone number'|capfirst %}</th>
@ -39,12 +39,10 @@
<tbody>
{% for user in users %}
<tr>
<td class="align-middle white-space-nowrap ps-0">
<td class="align-middle white-space-nowrap ps-1">
<div>
<a class="fs-8 fw-bold" href="{% url 'user_detail' user.slug%}">{{ user.arabic_name }}</a>
<div class="d-flex align-items-center">
<p class="mb-0 text-body-highlight fw-semibold fs-9 me-2">{{ user.name }}</p>
</div>
</div>
</td>
<td class="align-middle white-space-nowrap align-items-center">{{ user.email }}</td>