TorbatYar/frontend/lib/accounting-scoreboard.ts
Mortezakoohjani 12c8615615 Ship enterprise Accounting FE/API with CRUD parity and production wiring.
Adds accounting-service PATCH/archive, fiscal helpers, COA templates and setup status, plus SuperApp Accounting UI (DS, scoreboard, masters, vouchers, ledger, ops modules) with session refresh and HTTPS public API URLs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 15:26:43 +03:30

54 lines
2.7 KiB
TypeScript

/**
* Accounting completion scoreboard — keep in sync with docs/frontend/completion-scoreboard.md
*/
export type ScoreState = "complete" | "partial" | "missing" | "blocked";
export type ModuleScore = {
id: string;
label: string;
href: string;
percent: number;
state: ScoreState;
note?: string;
};
export const ACCOUNTING_MODULE_SCORES: ModuleScore[] = [
{ id: "dashboard", label: "داشبورد", href: "/accounting", percent: 90, state: "complete" },
{ id: "coa", label: "دفتر حساب‌ها", href: "/accounting/chart-of-accounts", percent: 98, state: "complete" },
{ id: "fiscal", label: "سال و دوره مالی", href: "/accounting/fiscal", percent: 98, state: "complete" },
{ id: "currencies", label: "ارزها", href: "/accounting/currencies", percent: 98, state: "complete" },
{ id: "cost-centers", label: "مراکز هزینه", href: "/accounting/cost-centers", percent: 95, state: "complete" },
{ id: "projects", label: "پروژه‌ها", href: "/accounting/projects", percent: 95, state: "complete" },
{ id: "vouchers", label: "اسناد", href: "/accounting/vouchers", percent: 95, state: "complete" },
{ id: "ledger", label: "دفتر کل", href: "/accounting/ledger", percent: 95, state: "complete" },
{ id: "treasury", label: "خزانه", href: "/accounting/treasury", percent: 90, state: "complete" },
{ id: "customers", label: "مشتریان", href: "/accounting/customers", percent: 92, state: "complete" },
{ id: "suppliers", label: "تأمین‌کنندگان", href: "/accounting/suppliers", percent: 85, state: "complete" },
{ id: "assets", label: "دارایی‌ها", href: "/accounting/assets", percent: 90, state: "complete" },
{ id: "payroll", label: "حقوق", href: "/accounting/payroll", percent: 88, state: "complete" },
{
id: "reports",
label: "گزارش‌ها",
href: "/accounting/reports",
percent: 92,
state: "complete",
},
{ id: "audit", label: "حسابرسی", href: "/accounting/audit", percent: 88, state: "complete" },
{ id: "settings", label: "تنظیمات", href: "/accounting/settings", percent: 85, state: "complete" },
{ id: "setup", label: "راه‌اندازی", href: "/accounting/setup", percent: 95, state: "complete" },
{
id: "ai",
label: "هوش مصنوعی",
href: "/accounting",
percent: 0,
state: "blocked",
note: "منتظر Active شدن AI Provider",
},
];
export function overallCompletionPercent(scores = ACCOUNTING_MODULE_SCORES): number {
const active = scores.filter((s) => s.state !== "blocked");
if (!active.length) return 0;
return Math.round(active.reduce((a, s) => a + s.percent, 0) / active.length);
}