This commit is contained in:
Marwan Alwali 2024-12-25 17:55:18 +03:00
parent b6486bb657
commit 2dc1671902
3 changed files with 13 additions and 1 deletions

View File

@ -522,6 +522,18 @@ class Dealer(models.Model, LocalizedNameMixin):
except SubscriptionPlan.DoesNotExist:
return None
@property
def get_plan_price(self):
"""Get the price of the active subscription plan for the dealer."""
active_plan = self.get_active_plan
if active_plan:
subscription_plan = SubscriptionPlan.objects.filter(
name=active_plan.plan
).first()
if subscription_plan:
return subscription_plan.price
return None

View File

@ -144,7 +144,7 @@
</div>
<p class="fs-9 text-body-tertiary">{% trans 'Active until' %}: {{ dealer.get_active_plan.end_date|date}}</p>
<div class="d-flex align-items-end mb-md-5 mb-lg-0">
<h4 class="fw-bolder me-1">{{ dealer.get_active_plan.users.description }}</h4>
<h4 class="fw-bolder me-1">{{ dealer.get_plan_price }} {% trans 'SAR' %}</h4>
<h5 class="fs-9 fw-normal text-body-tertiary ms-1">Per month</h5>
</div>
</div><img class="d-dark-none" src="{% static 'images/spot-illustrations/star.png' %}" width="54" height="54" alt="" /><img class="d-light-none" src="{% static 'images/spot-illustrations/star-dark.png' %}" width="54" height="54" alt="" />