import { ShellPage } from "@/components/page-templates"; import { TablePlaceholder } from "@/components/placeholders"; import { getSession } from "@/lib/auth"; import { prisma } from "@/lib/prisma"; import { redirect } from "next/navigation"; function formatMoney(value: number) { return new Intl.NumberFormat("id-ID", { style: "currency", currency: "IDR", maximumFractionDigits: 0 }).format(value); } export default async function SuperAdminPlanCatalogPage() { const session = await getSession(); if (!session || session.role !== "super_admin") { redirect("/unauthorized"); } const plans = await prisma.subscriptionPlan.findMany({ orderBy: { createdAt: "asc" } }); return ( [ `${plan.name} (${plan.code})`, formatMoney(plan.priceMonthly), String(plan.messageQuota), String(plan.seatQuota), String(plan.broadcastQuota) ])} /> ); }