import { canSee } from "@/lib/session";
import { getPortalSession } from "@/lib/get-session";
import { loadTenantForShell } from "@/lib/portal-data";
import { Panel } from "@/components/portal/Panel";
import { Monogram } from "@/components/portal/Monogram";
import { NotAllowed } from "@/components/portal/NotAllowed";
// "Organization" — IT_ADMIN only.
export default async function OrganizationPage({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
const session = await getPortalSession();
if (!canSee(session, "settings")) return ;
const t = await loadTenantForShell(slug);
if (!t) return null;
const subscribed = t.products.filter((p) => t.entitled.includes(p.id));
const trialing = t.products.filter((p) => t.trialing.includes(p.id));
const seatsLeft = t.seats.total - t.seats.used;
const pct = t.seats.total > 0 ? (t.seats.used / t.seats.total) * 100 : 0;
return (
Organization
Tenant profile, entitlements & primary contact
- Legal name
- {t.name}
- Form
- {t.legalType}
- Registered
- {t.city} · {t.country}
- VAT ID
- {t.vat}
- Tenant ID
- {t.id}
- Customer since
- {t.since}
{t.contact.split(" ").map((s) => s[0]).join("")}
{t.contact}
{t.contactEmail}
ADMIN OWNER
PLAN
{t.plan}
{t.planCode}
SEATS
{t.seats.used} / {t.seats.total}
{seatsLeft} seats available
{subscribed.length} active} pad={false}>
{subscribed.map((p) => (
{p.name}
ENTITLED
))}
{trialing.map((p) => (
{p.name}
TRIALING
))}
{subscribed.length === 0 && trialing.length === 0 ? (
No active products.
) : null}
);
}