chore: restore MVP dashboard components from backup
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
// ============================================================
|
||||
// داشبورد MVP — نمای «انبار» و نمای «بازرگانی و لجستیک»
|
||||
// فیلتر سراسری «چه چیزی» بالای هر دو نما (Zustand — با جابهجایی
|
||||
// بین تبها حفظ میشود). تمام ویجتها مستقیم به API واقعی وصلاند.
|
||||
// ============================================================
|
||||
|
||||
import { useState } from "react";
|
||||
import { BarChart3, Warehouse } from "lucide-react";
|
||||
import { Header, PageLayout } from "../../components/layout/Header";
|
||||
import { AppSwitcherMenu } from "../../components/AppSwitcherMenu";
|
||||
import { DashboardFilterBar } from "../../components/dashboard/DashboardFilterBar";
|
||||
import { DrilldownMatrix } from "../../components/dashboard/DrilldownMatrix";
|
||||
import { FlowChart } from "../../components/dashboard/FlowChart";
|
||||
import { DeadStockTable } from "../../components/dashboard/DeadStockTable";
|
||||
import { DailyControlPanel } from "../../components/dashboard/DailyControlPanel";
|
||||
import { LeadTimeKpiCard } from "../../components/dashboard/LeadTimeKpiCard";
|
||||
import { InTransitGrid } from "../../components/dashboard/InTransitGrid";
|
||||
import { ProcurementFunnel } from "../../components/dashboard/ProcurementFunnel";
|
||||
import { ProjectDensityChart } from "../../components/dashboard/ProjectDensityChart";
|
||||
import { cn } from "../../lib/utils";
|
||||
|
||||
type Tab = "warehouse" | "procurement";
|
||||
|
||||
const TABS: { key: Tab; label: string; icon: typeof Warehouse }[] = [
|
||||
{ key: "warehouse", label: "داشبورد انبار", icon: Warehouse },
|
||||
{ key: "procurement", label: "داشبورد بازرگانی و لجستیک", icon: BarChart3 },
|
||||
];
|
||||
|
||||
export function MvpDashboardPage() {
|
||||
const [tab, setTab] = useState<Tab>("warehouse");
|
||||
|
||||
return (
|
||||
<div className="min-h-screen pb-20 md:pb-6">
|
||||
<Header
|
||||
title="داشبورد تحلیلی"
|
||||
sub="انبار و تدارکات — فیلتر جنس روی همهی ویجتها اعمال میشود"
|
||||
brand
|
||||
menu={<AppSwitcherMenu activeModule="procurement" />}
|
||||
actions={
|
||||
/* تبهای نما — سگمنتکنترل هماهنگ با دیزاینسیستم */
|
||||
<div className="flex items-center gap-1 rounded-xl border border-line bg-slate-bg p-1">
|
||||
{TABS.map(({ key, label, icon: Icon }) => (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
onClick={() => setTab(key)}
|
||||
className={cn(
|
||||
"inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[12px] font-bold transition-all",
|
||||
tab === key
|
||||
? "bg-panel text-accent shadow-sm"
|
||||
: "text-muted hover:text-ink",
|
||||
)}
|
||||
>
|
||||
<Icon className="h-3.5 w-3.5" />
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
||||
<PageLayout className="flex flex-col gap-3 px-3 md:px-6">
|
||||
{/* فیلتر سراسری «چه چیزی» — مشترک بین دو نما */}
|
||||
<DashboardFilterBar />
|
||||
|
||||
{tab === "warehouse" ? (
|
||||
/* ——— نمای A: انبار ——— */
|
||||
<div className="flex flex-col gap-3">
|
||||
{/* ردیف اول: ماتریس Drill-Down (تمام عرض — ستون فقرات نما) */}
|
||||
<DrilldownMatrix />
|
||||
{/* ردیف دوم: سری زمانی + کنترل روزانه */}
|
||||
<div className="grid gap-3 xl:grid-cols-2">
|
||||
<FlowChart />
|
||||
<DailyControlPanel />
|
||||
</div>
|
||||
{/* ردیف سوم: موجودی راکد */}
|
||||
<DeadStockTable />
|
||||
</div>
|
||||
) : (
|
||||
/* ——— نمای B: بازرگانی و لجستیک ——— */
|
||||
<div className="flex flex-col gap-3">
|
||||
{/* KPI + قیف */}
|
||||
<div className="grid gap-3 xl:grid-cols-3">
|
||||
<LeadTimeKpiCard />
|
||||
<div className="xl:col-span-2">
|
||||
<ProcurementFunnel />
|
||||
</div>
|
||||
</div>
|
||||
{/* تراکم پروژهها + سفارشهای در راه */}
|
||||
<div className="grid gap-3 xl:grid-cols-2">
|
||||
<ProjectDensityChart />
|
||||
<InTransitGrid />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</PageLayout>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user