"use client";
import { useQuery } from "@tanstack/react-query";
import { PageHeader, EmptyState, Badge, DataTable } from "@/components/ds";
import { beautyBusinessApi } from "@/modules/beauty/services/beauty-business-api";
import { useTenantId } from "@/hooks/useTenantId";
import { useBeautyLookups } from "@/modules/beauty/hooks/useBeautyLookups";
import { CenterCard, CustomerCard, StaffCard } from "@/modules/beauty/design-system";
import {
AggregateStatsRow,
AnalyticsPage,
BeautyPageError,
BeautyPageLoader,
MonitoringPage,
ServiceMetaBadges,
SettingsListPage,
} from "./shared";
export function AdminDashboard() {
const { tenantId } = useTenantId();
const { organizations, branches, customers, staff, isLoading } = useBeautyLookups();
if (!tenantId || isLoading) return ;
return (
);
}
export function AdminOrganizations() {
const { organizations, isLoading } = useBeautyLookups();
if (isLoading) return ;
return (
{organizations.map((o) => (
))}
{organizations.length === 0 ?
: null}
);
}
export function AdminBranches() {
const { tenantId } = useTenantId();
const q = useQuery({
queryKey: ["beauty", tenantId, "admin-branches"],
queryFn: () => beautyBusinessApi.branches.list(tenantId!),
enabled: !!tenantId,
});
if (!tenantId || q.isLoading) return ;
if (q.error) return q.refetch()} />;
return (
{String(r.status)},
},
]}
rows={(q.data ?? []) as unknown as Record[]}
empty={}
/>
);
}
export function AdminStaff() {
const { staff, isLoading } = useBeautyLookups();
if (isLoading) return ;
return (
{staff.map((s) => (
))}
{staff.length === 0 ?
: null}
);
}
export function AdminCustomers() {
const { customers, isLoading } = useBeautyLookups();
if (isLoading) return ;
return (
{customers.map((c) => (
))}
{customers.length === 0 ?
: null}
);
}
export function AdminPermissions() {
const { tenantId } = useTenantId();
const q = useQuery({
queryKey: ["beauty", tenantId, "admin-permissions"],
queryFn: () => beautyBusinessApi.permissions.catalog(tenantId!),
enabled: !!tenantId,
});
if (!tenantId || q.isLoading) return ;
if (q.error) return q.refetch()} />;
return (
prefix: {q.data?.prefix}
({ permission: p })) as Record[]}
empty={}
/>
);
}
export function AdminReports() {
return ;
}
export function AdminAnalytics() {
return ;
}
export function AdminMonitoring() {
return ;
}
export function AdminSettings() {
return ;
}