diff --git a/backend/core/views.py b/backend/core/views.py index ca70765..ac29451 100644 --- a/backend/core/views.py +++ b/backend/core/views.py @@ -7,7 +7,7 @@ from django.utils.safestring import mark_safe 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 class HomeView(RedirectView): pattern_name = "admin:index" @@ -15,8 +15,9 @@ class HomeView(RedirectView): def dashboard_callback(request, context): - + pending_count = OrderModel.objects.filter(status='ADMIN_PENDING').count() context.update(random_data()) + context.update({'pending_count': pending_count}) return context @@ -46,7 +47,7 @@ def random_data(): ], "kpi": [ { - "title": "Product A Performance", + "title": "IPhone 16 Pro Max", "metric": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", "footer": mark_safe( f'+{intcomma(f"{random.uniform(1, 9):.02f}")}% progress from last week' @@ -59,14 +60,14 @@ def random_data(): ), }, { - "title": "Product B Performance", + "title": "Macbook Pro M3", "metric": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", "footer": mark_safe( f'+{intcomma(f"{random.uniform(1, 9):.02f}")}% progress from last week' ), }, { - "title": "Product C Performance", + "title": "Apple Watch 8", "metric": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", "footer": mark_safe( f'+{intcomma(f"{random.uniform(1, 9):.02f}")}% progress from last week' @@ -74,56 +75,56 @@ def random_data(): }, ], "progress": [ - { - "title": "🦆 Social marketing e-book", - "description": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", - "value": random.randint(10, 90), - }, - { - "title": "🦍 Freelancing tasks", - "description": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", - "value": random.randint(10, 90), - }, - { - "title": "🐋 Development coaching", - "description": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", - "value": random.randint(10, 90), - }, - { - "title": "🦑 Product consulting", - "description": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", - "value": random.randint(10, 90), - }, - { - "title": "🐨 Other income", - "description": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", - "value": random.randint(10, 90), - }, - { - "title": "🐶 Course sales", - "description": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", - "value": random.randint(10, 90), - }, - { - "title": "🐻❄️ Ads revenue", - "description": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", - "value": random.randint(10, 90), - }, - { - "title": "🦩 Customer Retention Rate", - "description": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", - "value": random.randint(10, 90), - }, - { - "title": "🦊 Marketing ROI", - "description": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", - "value": random.randint(10, 90), - }, - { - "title": "🦁 Affiliate partnerships", - "description": f"${intcomma(f"{random.uniform(1000, 9999):.02f}")}", - "value": random.randint(10, 90), - }, +{ + "title": "📱 Phone and Mobile", + "description": "$2,499.99", + "value": 20, + }, + { + "title": "⌚ Watch and Smart Watch", + "description": "$1,799.49", + "value": 60, + }, + { + "title": "💻 Laptop and Mac Book", + "description": "$3,499.99", + "value": 85, + }, + { + "title": "📹 Camera and Video Recorder", + "description": "$2,299.99", + "value": 50, + }, + { + "title": "📷 Camera and Picture Capture", + "description": "$1,799.00", + "value": 10, + }, + { + "title": "📚 Course Sales and Learning", + "description": "$1,299.49", + "value": 20, + }, + { + "title": "📈 Ads Revenue and Marketing", + "description": "$3,199.99", + "value": 90, + }, + { + "title": "📊 Customer Retention and Engagement", + "description": "$1,649.00", + "value": 80, + }, + { + "title": "📣 Marketing ROI and Campaigns", + "description": "$2,199.75", + "value": 45, + }, + { + "title": "🤝 Affiliate Partnerships and Collaborations", + "description": "$2,899.95", + "value": 78, + }, ], "chart": json.dumps( { diff --git a/backend/templates/formula/service.html b/backend/templates/formula/service.html index 728572c..1ddcb8b 100644 --- a/backend/templates/formula/service.html +++ b/backend/templates/formula/service.html @@ -1,10 +1,12 @@ {% load unfold i18n %} +{% if pending_count%}