feat: customer groups for people and companies with tahesab group sync and bulk register

Multiple groups per contact, legacy group text migrated, excel import/export, contacts filter and column, richer create-in-tahesab, match-first bulk export
This commit is contained in:
2026-10-21 17:16:31 +03:30
parent ce27df20ca
commit 29d99cbded
27 changed files with 1728 additions and 26 deletions
+48
View File
@@ -774,6 +774,48 @@ export interface HealthResponse {
timestamp: string;
}
/* ───────── گروه مشتری (اشخاص و شرکت‌ها) ───────── */
export const CUSTOMER_GROUP_COLORS = [
"teal",
"sky",
"violet",
"rose",
"amber",
"pink",
"slate",
] as const;
export type CustomerGroupColor = (typeof CUSTOMER_GROUP_COLORS)[number];
export interface CustomerGroupSummaryDto {
id: string;
name: string;
color: CustomerGroupColor | string;
/** manual | tahesab — فقط برای اشخاص */
source?: "manual" | "tahesab";
}
export interface CustomerGroupDto {
id: string;
name: string;
color: CustomerGroupColor | string;
position: number;
/** گروه متناظر در ته‌حساب دارد */
fromTahesab: boolean;
personCount: number;
companyCount: number;
}
export interface CreateCustomerGroupRequest {
name: string;
color?: CustomerGroupColor;
}
export interface UpdateCustomerGroupRequest {
name?: string;
color?: CustomerGroupColor;
}
export interface CompanySummaryDto {
id: string;
name: string;
@@ -807,6 +849,7 @@ export interface CompanyDto {
registeredAt: string | null;
tags: string[];
customFields: Record<string, unknown>;
groups: CustomerGroupSummaryDto[];
peopleCount: number;
owner: UserSummaryDto | null;
createdAt: string;
@@ -837,6 +880,8 @@ export interface CreateCompanyRequest {
tags?: string[];
customFields?: Record<string, unknown>;
ownerId?: string | null;
/** همهٔ گروه‌های شرکت (جایگزین کامل) */
groupIds?: string[];
}
export type UpdateCompanyRequest = Partial<CreateCompanyRequest>;
@@ -914,6 +959,7 @@ export interface PersonDto {
mood: PersonMood;
tags: string[];
customFields: Record<string, unknown>;
groups: CustomerGroupSummaryDto[];
loyaltyPoints: number;
loyaltyTier: LoyaltyTierSummaryDto | null;
/** تیپ غالب یا ترکیبی تأییدشده؛ بدون مجوز رفتار خالی برمی‌گردد */
@@ -950,6 +996,8 @@ export interface CreatePersonRequest {
ownerId?: string | null;
/** فقط برای ایمپورت اکسل — تاریخ ثبت مبدأ */
registeredAt?: string | null;
/** همهٔ گروه‌های شخص (جایگزین کامل؛ منبع گروه‌های ته‌حسابیِ باقی‌مانده حفظ می‌شود) */
groupIds?: string[];
}
export type UpdatePersonRequest = Partial<CreatePersonRequest>;