update admin notif
This commit is contained in:
+56
-55
@@ -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'<strong class="text-green-700 font-semibold dark:text-green-400">+{intcomma(f"{random.uniform(1, 9):.02f}")}%</strong> 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'<strong class="text-green-700 font-semibold dark:text-green-400">+{intcomma(f"{random.uniform(1, 9):.02f}")}%</strong> 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'<strong class="text-green-700 font-semibold dark:text-green-400">+{intcomma(f"{random.uniform(1, 9):.02f}")}%</strong> 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(
|
||||
{
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
{% load unfold i18n %}
|
||||
|
||||
{% if pending_count%}
|
||||
<div dir='rtl' class="bg-base-50 border border-base-200 border-dashed flex flex-col gap-4 p-4 rounded dark:bg-white/[.02] dark:border-base-700 lg:flex-row lg:justify-between w-full shrink-0 lg:items-center" style="justify-content: space-between;">
|
||||
<div class="flex flex-col lg:flex-row lg:items-center">
|
||||
<h2 class="font-semibold text-font-important-light text-base dark:text-font-important-dark flex items-center">
|
||||
<span class="material-symbols-outlined md-18 mr-3 w-4.5 align-middle">notifications</span>
|
||||
<span class="align-middle">سفارش جدید داری</span>
|
||||
<span class="text-white bg-primary-600 py-1 px-2 rounded" style="margin-right: 10px;">{{ pending_count }} </span>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
@@ -15,4 +17,5 @@
|
||||
{% endcomponent %}
|
||||
{% endcomponent %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user