"use client"; import Link from "next/link"; import { useQuery } from "@tanstack/react-query"; import { ChevronLeft, ExternalLink, Palette, Shield, Users } from "lucide-react"; import { accountingApi } from "@/lib/accounting-api"; import { useTenantId } from "@/hooks/useTenantId"; import { useColorMode } from "@/components/providers/ColorModeProvider"; import { PageHeader, LoadingState, ErrorState, Card, CardContent, CardHeader, CardTitle, Badge, Button, } from "@/components/ds"; const SETUP_STEPS: { key: keyof Awaited>; label: string }[] = [ { key: "has_chart", label: "دفتر حساب (Chart)" }, { key: "has_accounts", label: "حساب‌ها" }, { key: "has_currency", label: "ارز" }, { key: "has_base_currency", label: "ارز پایه" }, { key: "has_fiscal_year", label: "سال مالی" }, { key: "has_fiscal_period", label: "دوره مالی" }, { key: "has_cash_box", label: "صندوق نقد" }, { key: "has_customer", label: "مشتری" }, { key: "has_voucher", label: "سند حسابداری" }, ]; const SUPERAPP_LINKS = [ { href: "/dashboard/settings", title: "کاربران و نقش‌ها", description: "مدیریت دسترسی اعضای workspace از SuperApp", icon: Users, }, { href: "/dashboard/settings", title: "نقش‌ها و مجوزها", description: "تخصیص نقش IAM — از تنظیمات workspace", icon: Shield, }, { href: "/dashboard/settings", title: "برندسازی (White-label)", description: "لوگو، رنگ و هویت بصری tenant", icon: Palette, }, ]; export default function AccountingSettingsPage() { const { tenantId } = useTenantId(); const { mode, toggle } = useColorMode(); const healthQ = useQuery({ queryKey: ["accounting", "health"], queryFn: () => accountingApi.health(), }); const setupQ = useQuery({ queryKey: ["accounting", tenantId, "setup-status"], queryFn: () => accountingApi.setup.status(tenantId!), enabled: !!tenantId, }); if (!tenantId || setupQ.isLoading) return ; if (setupQ.error) { return setupQ.refetch()} />; } const setup = setupQ.data!; return (

پیشرفت راه‌اندازی

{setup.completed_steps} از {setup.total_steps} مرحله تکمیل شده

= 100 ? "success" : setup.percent >= 50 ? "primary" : "warning"}> {setup.percent}%
    {SETUP_STEPS.map(({ key, label }) => (
  • {label} {setup[key] ? "✓" : "—"}
  • ))}
سرویس حسابداری
وضعیت {healthQ.data?.status ?? "…"}
نسخه {healthQ.data?.version ?? "—"}
Tenant {tenantId}
ظاهر ماژول

تم رابط

روشن / تاریک — RTL حفظ می‌شود

مدیریت workspace (SuperApp)

{SUPERAPP_LINKS.map((link) => { const Icon = link.icon; return (

{link.title}

{link.description}

رفتن به تنظیمات ); })}
{[ ["/accounting/chart-of-accounts", "دفتر حساب‌ها"], ["/accounting/fiscal", "سال و دوره مالی"], ["/accounting/currencies", "ارزها"], ["/accounting/treasury", "خزانه"], ].map(([href, label]) => ( {label} ))}
); }