feat: gate treasury as an org module and group money inputs

Link optional invoice and cheque settlements to cash accounts, and let superadmin enable the finance module per organization.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-18 19:33:09 +03:30
co-authored by Cursor
parent ab538b8304
commit 8981a552fc
25 changed files with 509 additions and 33 deletions
+16 -2
View File
@@ -54,6 +54,8 @@ export interface AuthUserDto {
/** صفحهٔ تیم برای مالک واقعی باز بماند */
canOpenTeamSettings: boolean;
} | null;
/** مجوزهای نقش سازمانی؛ مالک و مدیر همهٔ بخش‌ها را دارند */
permissions?: RolePermissionKey[];
}
export type BillingPlanCode =
@@ -154,7 +156,8 @@ export type OrgModuleKey =
| "conversations"
| "routines"
| "gamification"
| "prior_data_archive";
| "prior_data_archive"
| "treasury";
export const ORG_MODULE_KEYS: OrgModuleKey[] = [
"customers",
@@ -196,6 +199,7 @@ export const ORG_MODULE_KEYS: OrgModuleKey[] = [
"routines",
"gamification",
"prior_data_archive",
"treasury",
];
export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
@@ -238,6 +242,7 @@ export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
routines: "کارهای روتین",
gamification: "باشگاه امتیازات",
prior_data_archive: "بایگانی اطلاعات قبل",
treasury: "مدیریت مالی",
};
export const ORG_MODULE_GROUPS: Array<{
@@ -273,6 +278,7 @@ export const ORG_MODULE_GROUPS: Array<{
"project_boards",
"inventory",
"cheques",
"treasury",
"attachments",
"loyalty",
"reports",
@@ -434,7 +440,9 @@ export type RolePermissionKey =
| "reports"
| "audit"
| "conversations"
| "conversations_groups";
| "conversations_groups"
| "treasury"
| "treasury_payroll";
export const ROLE_PERMISSION_ITEMS: Array<{
key: RolePermissionKey;
@@ -450,6 +458,8 @@ export const ROLE_PERMISSION_ITEMS: Array<{
{ key: "audit", label: "لاگ فعالیت کاربران" },
{ key: "conversations", label: "گفتگو" },
{ key: "conversations_groups", label: "ساخت گروه گفتگو" },
{ key: "treasury", label: "مدیریت مالی" },
{ key: "treasury_payroll", label: "حقوق و دستمزد" },
];
export interface OrgRoleMemberDto {
@@ -2358,6 +2368,7 @@ export interface CreateChequeRequest {
status?: ChequeStatus | string;
direction?: ChequeDirection | string;
notes?: string;
financialAccountId?: string | null;
}
export interface UpdateChequeRequest {
@@ -2366,6 +2377,7 @@ export interface UpdateChequeRequest {
dueDate?: string;
status?: ChequeStatus | string;
notes?: string | null;
financialAccountId?: string | null;
}
export interface PaymentDto {
@@ -2497,6 +2509,8 @@ export interface CreatePaymentRequest {
paidAt?: string;
notes?: string;
installmentId?: string | null;
/** اگر پر باشد، پرداخت غیرچکی یا چک وصول‌شده در این حساب صندوق می‌نشیند */
financialAccountId?: string | null;
cheque?: ChequeInput;
}