Bỏ qua để đến nội dung

Dashboard home (Admin)

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

The admin home at /dashboard shows KPIs, analytics charts, and operational widgets from the dashboard API. It is the default landing route after successful login.


GoalsNon-goals
Orient admins to business health at a glanceReplace detailed reporting or BI exports
Link to underlying modules (orders, products, subscriptions)Document every analytics SQL or metric definition

  • Loads overview + analytics endpoints.
  • Performance KPIs (first row): Revenue and Orders use admin B2B orders (paid & completed). Vendors is the count of vendors the admin can manage (options list). Master catalog products counts catalog templates only (items.store_id is null), not store- or vendor-scoped SKUs.
  • Network & vendors KPIs (second row): Stores and Warehouses come from the analytics summary for the current scope. Subscriptions is the count of open platform vendor membership subscriptions in scope. Expiring soon counts those subscriptions whose ends_at falls within the next N days (same N as in the API; shown on tiles and in copy).
  • Charts: Revenue-by-day and orders-by-weekday are aligned with admin orders for the selected period and scope where the API implements that.
  • Sales & inventory row: First column is vendors with platform packages expiring soon (soonest first, capped by the API). Top stores and top vendors remain revenue-based snapshots for the period (retail order context unless the API notes otherwise).

  1. Sign in → redirect to /dashboard.
  2. Review KPI rows and charts for the selected period and optional store/vendor scope.
  3. Use View all on the expiring-packages widget to open membership subscriptions when you need renewals workflow.

  • Data respects admin modules and optional store/vendor filters when selected—empty widgets may mean no permission or no data, not necessarily “zero business”.
  • If KPIs look wrong, verify API health, date range, and scope before escalating.

IDScenarioExpected
DH1Home after loginKPI blocks render without error
DH2Store or vendor scopeNumbers limited to selected store or vendor’s stores
DH3API failureUser-visible error or empty state, not infinite spinner

  • /dashboard — default home after sign-in.

The home screen loads overview and analytics from the admin dashboard API and renders:

BlockContent
Performance KPIsRevenue, Orders (admin B2B, paid & completed), Vendors, Master catalog products (templates only).
Network & vendors KPIsStores, Warehouses, Subscriptions (open platform vendor plans), Expiring soon (ending within N days).
Profit chartRevenue by day, total vs prior window, and a short summary (store / product / warehouse counts from analytics when present).
ActivityOrders by weekday (ActiveDayChart).
Expiring soon panelShort summary of how many open platform subscriptions end within N days.
Sales & inventoryVendors expiring soon table (vendor, package, end time), Top stores, Top vendors.

Implementation: apps/admin-web/src/app/dashboard/page.tsx, services in admin-dashboard.api.ts (/admin/dashboard/overview and /admin/dashboard/analytics).

The page keeps internal state for reporting period (for example “Last 30 days”) and optional tenant scope (all, or narrowed by store or vendor ID). The default is a ~30-day window and no store/vendor filter. Period and scope are controlled from the home page UI (page.tsx).

If overview loading fails, an inline alert shows a short message (from the API error or a generic fallback).