diff --git a/app/(dashboard)/page.tsx b/app/(dashboard)/page.tsx
index 6ec05cf..983e3d8 100644
--- a/app/(dashboard)/page.tsx
+++ b/app/(dashboard)/page.tsx
@@ -65,7 +65,9 @@ export default function DashboardPage() {
Для начала работы выберите целевой канал в верхнем меню
@@ -96,8 +98,7 @@ export default function DashboardPage() { {formatNumber(spending?.total_cost)}- {formatNumber(0 || 0, true)} за - прошлый месяц + {formatNumber(0 || 0, true)} за прошлый месяц
> )} @@ -120,8 +121,7 @@ export default function DashboardPage() { {formatNumber(spending?.total_subscriptions)}- {formatNumber(0 || 0, true)} за - прошлый месяц + {formatNumber(0 || 0, true)} за прошлый месяц
> )} @@ -142,8 +142,7 @@ export default function DashboardPage() { ₽{formatMetric(spending?.avg_cpf)}- {formatPercent(0 || 0, true)} от прошлого - месяца + {formatPercent(0 || 0, true)} от прошлого месяца
> )} @@ -164,8 +163,7 @@ export default function DashboardPage() { ₽{formatMetric(spending?.avg_cpm)}- {formatPercent(0 || 0, true)} от прошлого - месяца + {formatPercent(0 || 0, true)} от прошлого месяца
> )} diff --git a/app/(dashboard)/purchases/page.tsx b/app/(dashboard)/purchases/page.tsx index 99612c4..896d22b 100644 --- a/app/(dashboard)/purchases/page.tsx +++ b/app/(dashboard)/purchases/page.tsx @@ -31,7 +31,14 @@ import { TableHead, TableHeader, TableRow, + TableFooter, } from "@/components/ui/table"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; import { purchasesApi, channelsApi } from "@/lib/api"; import { formatNumber, @@ -51,10 +58,36 @@ import { CheckCircle, Clock, Archive, + ArrowUpDown, + ArrowUp, + ArrowDown, + Download, } from "lucide-react"; import type { Purchase } from "@/lib/types/api"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { useTargetChannel } from "@/components/providers/target-channel-provider"; +import * as XLSX from "xlsx"; + +type SortField = + | "status" + | "placement_date" + | "cost" + | "subscriptions_count" + | "views_count" + | "cpm" + | "cpl" + | null; +type SortDirection = "asc" | "desc" | null; + +type AggregateFunction = "sum" | "avg" | "median" | "max" | "min"; + +type AggregateConfig = { + cost: AggregateFunction; + subscriptions_count: AggregateFunction; + views_count: AggregateFunction; + cpm: AggregateFunction; + cpl: AggregateFunction; +}; export default function PurchasesPage() { const { selectedChannel } = useTargetChannel(); @@ -63,6 +96,15 @@ export default function PurchasesPage() { const [error, setError] = useState- {stats.active} активных, {stats.archived} в архиве -
-- За все закупы -
-Всего
-