diff --git a/backend/core/settings/unfold_conf.py b/backend/core/settings/unfold_conf.py index a8693a0..e7105d4 100644 --- a/backend/core/settings/unfold_conf.py +++ b/backend/core/settings/unfold_conf.py @@ -119,6 +119,7 @@ UNFOLD = { "title": _("نظرات"), "icon": "chat", "link": reverse_lazy("admin:product_commentmodel_changelist"), + "badge": "utils.admin.comment_count", }, { "title": _("قیمت دلار"), @@ -210,6 +211,7 @@ UNFOLD = { "title": _("تیکت"), "icon": "confirmation_number", "link": reverse_lazy("admin:ticket_ticket_changelist"), + "badge": "utils.admin.new_ticket_count", }, ], diff --git a/backend/core/views.py b/backend/core/views.py index 212a5bc..22fde64 100644 --- a/backend/core/views.py +++ b/backend/core/views.py @@ -8,6 +8,9 @@ from django.utils.translation import gettext_lazy as _ from django.views.generic import RedirectView, TemplateView from unfold.views import UnfoldModelAdminViewMixin from order.models import OrderModel +from ticket.models import Ticket + + class HomeView(RedirectView): pattern_name = "admin:index" @@ -16,8 +19,10 @@ class HomeView(RedirectView): def dashboard_callback(request, context): pending_count = OrderModel.objects.filter(status='ADMIN_PENDING').count() + open_tickets_count = Ticket.objects.filter(status__in=['open', 'in_progress']).count() context.update(random_data()) context.update({'pending_count': pending_count}) + context.update({'open_tickets_count': open_tickets_count}) return context diff --git a/backend/templates/formula/service.html b/backend/templates/formula/service.html index 1ddcb8b..664e402 100644 --- a/backend/templates/formula/service.html +++ b/backend/templates/formula/service.html @@ -5,8 +5,8 @@