This commit is contained in:
ismail 2025-06-26 15:52:00 +03:00
parent c3fbb3ea22
commit 80a3f69bbc
4 changed files with 12 additions and 12 deletions

View File

@ -122,9 +122,12 @@ class DealerSlugMiddleware:
return response
def process_view(self, request, view_func, view_args, view_kwargs):
if request.user.is_authenticated:
dealer = get_user_type(request)
if view_kwargs.get("dealer_slug"):
if view_kwargs["dealer_slug"] != dealer.slug:
raise Http404("Dealer slug mismatch")
return None
if not request.user.is_authenticated:
return None
if request.path.startswith('/en/ledger/') or request.path.startswith('/ar/ledger/'):
return None
if not view_kwargs.get("dealer_slug"):
return None
dealer = get_user_type(request)
if view_kwargs["dealer_slug"] != dealer.slug:
raise Http404("Dealer slug mismatch")

View File

@ -2898,7 +2898,7 @@ class UserCreateView(
success_message = _("User created successfully")
def form_valid(self, form):
dealer = get_user_type(self.request)
dealer = get_object_or_404(models.Dealer, slug=self.kwargs["dealer_slug"])
# quota_dict = get_user_quota(dealer.user)
# allowed_users = quota_dict.get("Users")
@ -5565,7 +5565,7 @@ def schedule_lead(request, dealer_slug,slug):
messages.success(request, _("Appointment Created Successfully"))
try:
if lead.opportunity:
return redirect("opportunity_detail", slug=lead.opportunity.slug)
return redirect("opportunity_detail", dealer_slug=lead.dealer.slug, slug=lead.opportunity.slug)
except models.Lead.opportunity.RelatedObjectDoesNotExist:
return redirect("lead_list", dealer_slug=lead.dealer.slug)
else:

View File

@ -5,7 +5,6 @@
<table class="table table-hover table-bordered align-middle">
<thead class="table-light">
<tr class="text-center">
<th class="py-3 text-start">{% trans "Created at" %}</th>
<th class="py-3 text-start">{% trans "Item" %}</th>
<th class="py-3">{% trans "UOM" %}</th>
<th class="py-3">{% trans "Quantity" %}</th>
@ -17,8 +16,6 @@
{% for i in inventory_list %}
<tr class="hover-actions-trigger">
<td class="ps-2 fw-medium">{{ i.item_model__name }}</td>
<td class="ps-2 fw-medium">{{ i.item_model__name }}</td>
<td class="text-center">{{ i.item_model__uom__name }}</td>
<td class="text-end pe-3">{{ i.total_quantity | floatformat:3 }}</td>

View File

@ -102,7 +102,7 @@
<div class="row g-4 g-xl-1 g-xxl-3 justify-content-between">
<div class="col-sm-auto">
<div class="d-sm-block d-inline-flex d-md-flex flex-xl-column flex-xxl-row align-items-center align-items-xl-start align-items-xxl-center">
<div class="d-flex bg-success-subtle rounded flex-center me-3 mb-sm-3 mb-md-0 mb-xl-3 mb-xxl-0" style="width:32px; height:32px"><span class="text-success-dark" data-feather="dollar-sign" style="width:24px; height:24px"></span></div>
<div class="d-flex bg-success-subtle rounded flex-center me-3 mb-sm-3 mb-md-0 mb-xl-3 mb-xxl-0" style="width:32px; height:32px"><span class="text-success-dark icon-saudi_riyal" style="width:24px; height:24px;font-weight: bold"></span></div>
<div>
<p class="fw-bold mb-1">{% trans 'Paid Amount' %}</p>
<h4 class="fw-bolder text-nowrap {% if invoice.is_paid %}text-success{% endif %}">{{invoice.amount_paid}}&nbsp;<span class="icon-saudi_riyal"></span></h4>