This commit is contained in:
Marwan Alwali 2025-03-02 21:21:15 +03:00
parent a96b1131d3
commit 1580e2ad26
9 changed files with 34 additions and 0 deletions

View File

@ -65,6 +65,7 @@ admin.site.register(models.Lead)
admin.site.register(models.Activity)
admin.site.register(models.Schedule)
admin.site.register(models.Notes)
admin.site.register(models.UserActivityLog)
# admin.site.register(appointment_models.Client)

View File

@ -327,6 +327,7 @@ class ManagerDashboard(LoginRequiredMixin, TemplateView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
dealer = get_user_type(self.request)
entity = dealer.entity
total_cars = models.Car.objects.filter(dealer=dealer).count()
total_reservations = models.CarReservation.objects.filter(
reserved_until__gte=timezone.now()
@ -352,6 +353,11 @@ class ManagerDashboard(LoginRequiredMixin, TemplateView):
sold_percentage = sold_cars / total_cars * 100
qs = models.Car.objects.values('id_car_make__name').annotate(count=Count('id')).order_by('id_car_make__name')
car_by_make = list(qs)
total_activity = models.UserActivityLog.objects.filter(user=dealer.user).count()
staff = models.Staff.objects.filter(dealer=dealer).count()
total_leads = models.Lead.objects.filter(dealer=dealer).count()
invoices = entity.get_invoices().count()
customers = entity.get_customers().count()
context["dealer"] = dealer
context["total_cars"] = total_cars
@ -422,6 +428,11 @@ class SalesDashboard(LoginRequiredMixin, TemplateView):
context['damaged_cars'] = damaged_cars
context['transfer_cars'] = transfer_cars
context['car'] = json.dumps(car_by_make)
context['customers'] = customers
context['staff'] = staff
context['total_leads'] = total_leads
context['invoices'] = invoices
return context

View File

@ -9,6 +9,28 @@
<h3 class="fs-4 fs-md-4 fs-xl-4 fw-black mb-4">
<span class="text-gradient-info me-3">{{ dealer.get_local_name }}</span>
</h3>
<div class="row justify-content-between">
<div class="col-6 col-md-4 col-xxl-2 text-center border-translucent border-start-xxl border-end-xxl-0 border-bottom-xxl-0 border-end border-bottom pb-4 pb-xxl-0 ">
<span class="uil fs-5 lh-1 uil-users-alt text-success"></span>
<h4 class="fs-6 pt-3">{{ staff }}</h4>
<p class="fs-9 mb-0">{{ _("Staff")}}</p>
</div>
<div class="col-6 col-md-4 col-xxl-2 text-center border-translucent border-start-xxl border-end-xxl-0 border-bottom-xxl-0 border-end border-bottom pb-4 pb-xxl-0 ">
<span class="uil fs-5 lh-1 uil-bolt-alt text-primary"></span>
<h4 class="fs-6 pt-3">{{ total_leads }}</h4>
<p class="fs-9 mb-0">{{ _("Leads")}}</p>
</div>
<div class="col-6 col-md-4 col-xxl-2 text-center border-translucent border-start-xxl border-end-xxl-0 border-bottom-xxl-0 border-end border-bottom pb-4 pb-xxl-0 ">
<span class="uil fs-5 lh-1 uil-user-plus text-warning"></span>
<h4 class="fs-6 pt-3">{{ customers }}</h4>
<p class="fs-9 mb-0">{{ _("Customers")}}</p>
</div>
<div class="col-6 col-md-4 col-xxl-2 text-center border-translucent border-start-xxl border-end-xxl-0 border-bottom-xxl-0 border-end border-bottom pb-4 pb-xxl-0 ">
<span class="uil fs-5 lh-1 uil-bill text-info"></span>
<h4 class="fs-6 pt-3">{{ invoices }}</h4>
<p class="fs-9 mb-0">{{ _("Invoices")}}</p>
</div>
</div>
<div class="card mb-3">
<div class="bg-holder" style="background-image:url({% static 'images/bg/38.png' %});background-position:left bottom;background-size:auto;"></div>