+
+
+ Income
+
+ {net ? `${currency} ${net.toFixed(2)}` : `$0.00`}
+
+
+ For the year {currentYear}
+
+
+
+ Total revenue generated as reflected in your stripe dashboard.
+
+
+
+
+
+ Potential Income
+
+ {potentialIncome
+ ? `${currency} ${potentialIncome.toFixed(2)}`
+ : `$0.00`}
+
+
+ For the year {currentYear}
+
+
+
+ This is how much you can close.
+
+
+
+
+
+ Active Clients
+ {subaccounts.length}
+
+
+ Reflects the number of sub accounts you own and manage.
+
+
+
+
+
+ Agency Goal
+
+
+ Reflects the number of sub accounts you want to own and
+ manage.
+
+ );
};
export default Page;
diff --git a/web_app/src/app/(main)/subaccount/[subAccountId]/page.tsx b/web_app/src/app/(main)/subaccount/[subAccountId]/page.tsx
index 15447c8..f990c86 100644
--- a/web_app/src/app/(main)/subaccount/[subAccountId]/page.tsx
+++ b/web_app/src/app/(main)/subaccount/[subAccountId]/page.tsx
@@ -1,11 +1,238 @@
-import React from 'react'
+import BlurPage from "@/components/global/BlurPage";
+import CircleProgress from "@/components/global/CircleProgress";
+import PipelineValue from "@/components/global/PipelineValue";
+import SubaccountFunnelChart from "@/components/global/SubAccountFunnelChart";
+import { Badge } from "@/components/ui/badge";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+} from "@/components/ui/card";
-type Props = {}
+import {
+ Table,
+ TableBody,
+ TableCaption,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "@/components/ui/table";
+import { db } from "@/lib/db";
+import { AreaChart, BadgeDelta } from "@tremor/react";
+import {
+ ClipboardIcon,
+ Contact2,
+ DollarSign,
+ ShoppingCart,
+} from "lucide-react";
+import Link from "next/link";
+import React from "react";
+
+type Props = {
+ params: { subAccountId: string };
+ searchParams: {
+ code: string;
+ };
+};
+
+const SubaccountPageId = async ({ params, searchParams }: Props) => {
+ let currency = "USD";
+ let sessions;
+ let totalClosedSessions;
+ let totalPendingSessions;
+ let net = 0;
+ let potentialIncome = 0;
+ let closingRate = 0;
+
+ const subaccountDetails = await db.subAccount.findUnique({
+ where: {
+ id: params.subAccountId,
+ },
+ });
+
+ const currentYear = new Date().getFullYear();
+ const startDate = new Date(`${currentYear}-01-01T00:00:00Z`).getTime() / 1000;
+ const endDate = new Date(`${currentYear}-12-31T23:59:59Z`).getTime() / 1000;
+
+ if (!subaccountDetails) return;
+
+ const funnels = await db.funnel.findMany({
+ where: {
+ subAccountId: params.subAccountId,
+ },
+ include: {
+ FunnelPages: true,
+ },
+ });
+
+ const funnelPerformanceMetrics = funnels.map((funnel) => ({
+ ...funnel,
+ totalFunnelVisits: funnel.FunnelPages.reduce(
+ (total, page) => total + page.visits,
+ 0
+ ),
+ }));
-const page = (props: Props) => {
return (
-
page
- )
-}
+
+
+
+
+
+
+ Income
+
+ {net ? `${currency} ${net.toFixed(2)}` : `$0.00`}
+
+
+ For the year {currentYear}
+
+
+
+ Total revenue generated as reflected in your stripe dashboard.
+
+
+
+
+
+ Potential Income
+
+ {potentialIncome
+ ? `${currency} ${potentialIncome.toFixed(2)}`
+ : `$0.00`}
+
+
+ For the year {currentYear}
+
+
+
+ This is how much you can close.
+
+
+
+
+
+
+
+ Conversions
+
+ {sessions && (
+
+ Total Carts Opened
+
+
+ {/* {sessions.length} */}0
+
+
+ )}
+ {totalClosedSessions && (
+
+ Won Carts
+
+
+ {/* {totalClosedSessions.length} */}0
+
+
+ )}
+ >
+ }
+ />
+
+
+
+
+
+
+
+ Funnel Performance
+
+
+
+
+ Total page visits across all funnels. Hover over to get more
+ details on funnel page performance.
+