Merge pull request 'Plan' (#213) from frontend into main

Reviewed-on: #213
This commit is contained in:
ismail 2025-09-01 11:48:19 +03:00
commit bd8e191d3d
3 changed files with 85 additions and 61 deletions

View File

@ -372,7 +372,11 @@
hideLoading();
const data = await response.json();
if (response.ok) {
<<<<<<< HEAD
notify("success","{% trans 'Account created successfully'%}");
=======
notify("success","Account created successfully");
>>>>>>> d3dcb85fa378e156b77550e8ab833ad10ffad51f
setTimeout(() => {
window.location.href = "{% url 'account_login' %}";
}, 1000);

View File

@ -68,7 +68,7 @@
<div class="col-12 col-sm-auto d-flex align-items-center justify-content-around flex-wrap mt-3 mt-sm-0">
<div class="text-center mx-3 mb-2 mb-sm-0">
<h6 class="mb-2 text-body-secondary">{% trans 'Total users'|capfirst %}</h6>
<h4 class="fs-7 text-body-highlight mb-2">{{ dealer.staff_count }} / {{ allowed_users }}</h4>
<h4 class="fs-7 text-body-highlight mb-2">{{ dealer.staff_count }}</h4>
<div class="progress" style="height: 5px; width: 100px;">
<div class="progress-bar bg-success"
role="progressbar"
@ -80,7 +80,7 @@
</div>
<div class="text-center mx-3 mb-2 mb-sm-0">
<h6 class="mb-2 text-body-secondary">{% trans 'Total cars'|capfirst %}</h6>
<h4 class="fs-7 text-body-highlight mb-2">{{ cars_count }} / {{ allowed_cars }}</h4>
<h4 class="fs-7 text-body-highlight mb-2">{{ cars_count }}</h4>
<div class="progress" style="height: 5px; width: 100px;">
<div class="progress-bar bg-info"
role="progressbar"
@ -150,56 +150,56 @@
<div class="d-flex align-items-center justify-content-between mb-3">
<h3 class="mb-0">{{ dealer.user.userplan.plan|capfirst }}</h3>
{% if dealer.user.userplan and not dealer.user.userplan.is_expired %}
<span class="badge bg-success-subtle text-success">{{ _("Active") }}</span>
<span class="badge bg-success-subtle text-success">{{ _("Active") }}</span>
{% elif dealer.user.userplan and dealer.user.userplan.is_expired %}
<span class="badge bg-danger-subtle text-danger">{{ _("Expired") }}</span>
<span class="badge bg-danger-subtle text-danger">{{ _("Expired") }}</span>
{% else %}
<span class="badge bg-warning-subtle text-warning">{{ _("No Active Plan") }}</span>
<span class="badge bg-warning-subtle text-warning">{{ _("No Active Plan") }}</span>
{% endif %}
</div>
<p class="fs-9 text-body-secondary">
{% if dealer.user.userplan and not dealer.user.userplan.is_expired %}
{% trans 'Active until' %}: {{ dealer.user.userplan.expire }} &nbsp; <small>{% trans 'Days left' %}: {{ dealer.user.userplan.days_left }}</small>
{% trans 'Active until' %}: {{ dealer.user.userplan.expire }} &nbsp; <small>{% trans 'Days left' %}: {{ dealer.user.userplan.days_left }}</small>
{% else %}
{% trans 'Please subscribe or renew your plan to continue using our services.' %}
{% trans 'Please subscribe or renew your plan to continue using our services.' %}
{% endif %}
</p>
<div class="d-flex align-items-end mb-3">
<h4 class="fw-bolder me-1">
{{ dealer.user.userplan.plan.planpricing_set.first.price }} <span class="icon-saudi_riyal"></span>
{{ dealer.user.userplan.plan.planpricing_set.first.price }} <span class="icon-saudi_riyal"></span>
</h4>
<h5 class="fs-9 fw-normal text-body-tertiary ms-1">{{ _("Per month") }}</h5>
</div>
<ul class="list-unstyled mb-4">
{% for line in dealer.user.userplan.plan.description|splitlines %}
<li class="d-flex align-items-center mb-1">
<span class="uil uil-check-circle text-success me-2"></span>
<span class="text-body-secondary">{{ line }}</span>
</li>
<li class="d-flex align-items-center mb-1">
<span class="uil uil-check-circle text-success me-2"></span>
<span class="text-body-secondary">{{ line }}</span>
</li>
{% endfor %}
</ul>
{% comment %} <div class="d-flex justify-content-end gap-2">
{% if dealer.user.userplan.is_expired %}
<a href="{% url 'pricing_page' request.dealer.slug %}" class="btn btn-warning"><span class="fas fa-redo-alt me-2"></span>{{ _("Renew") }}</a>
<a href="{% url 'pricing_page' request.dealer.slug %}" class="btn btn-warning"><span class="fas fa-redo-alt me-2"></span>{{ _("Renew") }}</a>
{% endif %}
{% if dealer.user.userplan.plan.name != "Enterprise" %}
<a href="{% url 'pricing_page' request.dealer.slug %}" class="btn btn-primary"><span class="fas fa-rocket me-2"></span>{{ _("Upgrade Plan") }}</a>
<a href="{% url 'pricing_page' request.dealer.slug %}" class="btn btn-primary"><span class="fas fa-rocket me-2"></span>{{ _("Upgrade Plan") }}</a>
{% endif %}
{% if not dealer.user.userplan %}
<a href="{% url 'pricing_page' request.dealer.slug %}" class="btn btn-success"><span class="fas fa-cart-plus me-2"></span>{{ _("Subscribe Now") }}</a>
<a href="{% url 'pricing_page' request.dealer.slug %}" class="btn btn-success"><span class="fas fa-cart-plus me-2"></span>{{ _("Subscribe Now") }}</a>
{% endif %}
</div> {% endcomment %}
<div class="d-flex justify-content-end gap-2">
{% if not dealer.user.userplan %}
<a href="{% url 'pricing_page' request.dealer.slug %}"
class="btn btn-outline-primary"><span class="fas fa-cart-plus me-2"></span>{{ _("Subscribe Now") }}</a>
{% elif dealer.user.userplan.is_expired %}
<a href="{% url 'pricing_page' request.dealer.slug %}"
class="btn btn-outline-warning"><span class="fas fa-redo-alt me-2"></span>{{ _("Renew") }}</a>
{% elif dealer.user.userplan.plan.name != "Enterprise" %}
<a href="{% url 'pricing_page' request.dealer.slug %}"
class="btn btn-outline-primary"><span class="fas fa-rocket me-2"></span>{{ _("Upgrade Plan") }}</a>
{% endif %}
{% if not dealer.user.userplan %}
<a href="{% url 'pricing_page' request.dealer.slug %}"
class="btn btn-outline-primary"><span class="fas fa-cart-plus me-2"></span>{{ _("Subscribe Now") }}</a>
{% elif dealer.user.userplan.is_expired %}
<a href="{% url 'pricing_page' request.dealer.slug %}"
class="btn btn-outline-warning"><span class="fas fa-redo-alt me-2"></span>{{ _("Renew") }}</a>
{% elif dealer.user.userplan.plan.name != "Enterprise" %}
<a href="{% url 'pricing_page' request.dealer.slug %}"
class="btn btn-outline-primary"><span class="fas fa-rocket me-2"></span>{{ _("Upgrade Plan") }}</a>
{% endif %}
</div>
</div>
</div>
@ -221,8 +221,8 @@
aria-valuemax="100"></div>
</div>
<div class="d-flex justify-content-between text-body-secondary fs-9 mt-2">
<span>{{ _("Used") }}: {{ dealer.staff_count }}</span>
<span>{{ _("Limit") }}: {{ allowed_users }}</span>
<span>{{ _("Used") }}: {{ dealer.staff_count }}</span>
</div>
</div>
<div class="mb-4">
@ -236,8 +236,8 @@
aria-valuemax="100"></div>
</div>
<div class="d-flex justify-content-between text-body-secondary fs-9 mt-2">
<span>{{ _("Used") }}: {{ cars_count }}</span>
<span>{{ _("Limit") }}: {{ allowed_cars }}</span>
<span>{{ _("Used") }}: {{ cars_count }}</span>
</div>
</div>
<small class="text-body-secondary mt-auto">{{ _("Contact support to increase your limits") }}</small>
@ -258,22 +258,22 @@
<div class="d-flex align-items-center mb-3">
<span class="fas fa-location-dot me-3 text-primary"></span>
<div>
<h6 class="mb-0">{% trans 'Address' %}</h6>
<p class="mb-0 text-body-secondary">{{ dealer.address }}</p>
<h6 class="mb-0">{% trans 'Address' %}</h6>
<p class="mb-0 text-body-secondary">{{ dealer.address }}</p>
</div>
</div>
<div class="d-flex align-items-center mb-3">
<span class="fas fa-envelope me-3 text-info"></span>
<div>
<h6 class="mb-0">{% trans 'Email' %}</h6>
<p class="mb-0 text-body-secondary">{{ dealer.user.email }}</p>
<h6 class="mb-0">{% trans 'Email' %}</h6>
<p class="mb-0 text-body-secondary">{{ dealer.user.email }}</p>
</div>
</div>
<div class="d-flex align-items-center">
<span class="fas fa-phone me-3 text-success"></span>
<div>
<h6 class="mb-0">{% trans 'Phone' %}</h6>
<p class="mb-0 text-body-secondary" dir="ltr">{{ dealer.phone_number }}</p>
<h6 class="mb-0">{% trans 'Phone' %}</h6>
<p class="mb-0 text-body-secondary" dir="ltr">{{ dealer.phone_number }}</p>
</div>
</div>
</div>
@ -285,11 +285,11 @@
<h5 class="mb-3">{{ _("VAT Information") }}</h5>
<form action="{% url 'dealer_vat_rate_update' request.dealer.slug %}"
method="post">
{% csrf_token %}
{{ vatform|crispy }}
<button class="btn btn-phoenix-primary mt-3" type="submit">
<i class="fa-solid fa-pen-to-square me-1"></i>{% trans 'Update VAT' %}
</button>
{% csrf_token %}
{{ vatform|crispy }}
<button class="btn btn-phoenix-primary mt-3" type="submit">
<i class="fa-solid fa-pen-to-square me-1"></i>{% trans 'Update VAT' %}
</button>
</form>
</div>
</div>
@ -304,21 +304,21 @@
<div class="card-body">
<h5 class="mb-4">{{ _("Makes you are selling") }}</h5>
<div class="d-flex flex-wrap gap-3 mb-4">
{% for make in car_makes %}
<div class="text-center p-2 border rounded-3">
{% if make.logo %}
<img src="{{ make.logo.url }}"
alt="{{ make.get_local_name }}"
class="rounded"
style="height: 48px;
width: auto;
background-color:white" />
{% endif %}
<p class="fs-8 text-body-secondary mt-1 mb-0">{{ make.get_local_name }}</p>
</div>
{% empty %}
<p class="text-body-secondary">{{ _("No car makes selected.") }}</p>
{% endfor %}
{% for make in car_makes %}
<div class="text-center p-2 border rounded-3">
{% if make.logo %}
<img src="{{ make.logo.url }}"
alt="{{ make.get_local_name }}"
class="rounded"
style="height: 48px;
width: auto;
background-color:white" />
{% endif %}
<p class="fs-8 text-body-secondary mt-1 mb-0">{{ make.get_local_name }}</p>
</div>
{% empty %}
<p class="text-body-secondary">{{ _("No car makes selected.") }}</p>
{% endfor %}
</div>
<a class="btn btn-phoenix-warning"
href="{% url 'assign_car_makes' request.dealer.slug %}"><span class="fas fa-plus me-2"></span>{{ _("Select Makes") }}</a>
@ -331,4 +331,4 @@
</div>
</div>
</div>
{% endblock %}
{% endblock %}

View File

@ -47,7 +47,7 @@
<p class="text-muted">{% trans 'Report Date' %}: {{ current_time }}</p>
</header>
<main>
<section id="filters" class="mb-5 p-4 rounded border border-primary">
<section id="filters" class="mb-5 p-4 rounded border border-primary">
<h2 class="section-heading mb-4">
{% trans 'Filters' %} <i class="fas fa-sliders-h ms-2"></i>
</h2>
@ -58,7 +58,8 @@
<option value="">{% trans 'All Makes' %}</option>
{% for make in makes %}
<option value="{{ make }}" {% if make == selected_make %}selected{% endif %}>{{ make }}</option>
{% endfor %}
{% endfor %}
</select>
</div>
<div class="col-md-2">
<label for="model-select" class="form-label">{% trans 'Model' %}</label>
@ -111,7 +112,26 @@
</div>
</form>
</section>
<!---->
{% comment %} 'cars_sold': cars_sold,
'current_time': current_time,
'dealer': dealer,
'total_revenue_from_cars': total_revenue_from_cars,
'total_revenue_from_additonals':total_revenue_from_additonals,
'total_revenue_collected': total_revenue_collected,
'total_vat_on_cars':total_vat_on_cars,
'total_vat_from_additonals':total_vat_from_additonals,
'total_vat_collected':total_vat_collected,
'total_discount': total_discount,
'makes': makes,
'models': models_qs,
'series': series,
'years': years,
'selected_make': selected_make,
'selected_model': selected_model,
'selected_serie': selected_serie,
'selected_year': selected_year, {% endcomment %}
<!---->
<section id="summary" class="mb-5">
<h2 class="section-heading mb-4 border-start border-5 border-primary p-2">{% trans 'Report Summary' %}</h2>
<div class="row g-4">
@ -267,13 +287,13 @@
<span>{{ car.discount }} <span class="icon-saudi_riyal"></span></span>
</td>
<td class="fs-9 text-nowrap">
<span >{{ car.final_price }} <span class="icon-saudi_riyal"></span></span>
<span>{{ car.final_price }} <span class="icon-saudi_riyal"></span></span>
</td>
<td class="fs-9 text-nowrap">
<span>{{ car.vat_amount|floatformat:2 }} <span class="icon-saudi_riyal"></span></span>
</td>
<td class="fs-9 text-nowrap">
<span >{{ car.get_additional_services.total|floatformat:2 }} <span class="icon-saudi_riyal"></span></span>
<span>{{ car.get_additional_services.total|floatformat:2 }} <span class="icon-saudi_riyal"></span></span>
</td>
<td class="fs-9 text-nowrap">
<span>{{ car.get_additional_services.services_vat|floatformat:2 }}<span class="icon-saudi_riyal"></span></span>