merge: bring latest origin/main into dev (design local, logic main)
Keep local template/style for conflicted Vue pages; take main script/API/shared logic.
This commit is contained in:
@@ -153,6 +153,7 @@ export type OrgModuleKey =
|
||||
| "reports"
|
||||
| "notes"
|
||||
| "tahesab"
|
||||
| "account_balances"
|
||||
| "custom_fields"
|
||||
| "currencies"
|
||||
| "team_settings"
|
||||
@@ -197,6 +198,7 @@ export const ORG_MODULE_KEYS: OrgModuleKey[] = [
|
||||
"reports",
|
||||
"notes",
|
||||
"tahesab",
|
||||
"account_balances",
|
||||
"custom_fields",
|
||||
"currencies",
|
||||
"team_settings",
|
||||
@@ -241,6 +243,7 @@ export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
|
||||
reports: "گزارشها",
|
||||
notes: "یادداشتها",
|
||||
tahesab: "تهحساب (اتصال و گزارش فروش)",
|
||||
account_balances: "مانده حساب",
|
||||
custom_fields: "فیلدهای سفارشی",
|
||||
currencies: "ارزها",
|
||||
team_settings: "تیم و تنظیمات سازمان",
|
||||
@@ -266,7 +269,7 @@ export const ORG_MODULE_GROUPS: Array<{
|
||||
title: string;
|
||||
keys: OrgModuleKey[];
|
||||
}> = [
|
||||
{ title: "مشتریان", keys: ["customers"] },
|
||||
{ title: "مشتریان", keys: ["customers", "account_balances"] },
|
||||
{ title: "لیدها", keys: ["leads", "lead_forms"] },
|
||||
{
|
||||
title: "فروش",
|
||||
@@ -329,6 +332,7 @@ export function isOrgModuleKey(value: string): value is OrgModuleKey {
|
||||
export const OPT_IN_ORG_MODULES: OrgModuleKey[] = [
|
||||
"workflow_automations_advanced",
|
||||
"prior_data_archive",
|
||||
"account_balances",
|
||||
];
|
||||
|
||||
export function defaultEnabledModules(): OrgModuleKey[] {
|
||||
@@ -892,6 +896,7 @@ export type RolePermissionKey =
|
||||
| "treasury_reports"
|
||||
| "treasury_audit"
|
||||
| "treasury_categories"
|
||||
| "treasury_documents_manage"
|
||||
| "behavior";
|
||||
|
||||
/** بخشی که مسئولش را میشود به کاربر دیگری داد */
|
||||
@@ -947,6 +952,7 @@ export const ROLE_PERMISSION_ITEMS: Array<{
|
||||
{ key: "treasury_reports", label: "مالی — گزارش" },
|
||||
{ key: "treasury_audit", label: "مالی — سوابق" },
|
||||
{ key: "treasury_categories", label: "مالی — دستهبندی" },
|
||||
{ key: "treasury_documents_manage", label: "مالی — ویرایش و حذف اسناد" },
|
||||
{ key: "behavior", label: "شخصیتشناسی و دستیار فروش" },
|
||||
];
|
||||
|
||||
@@ -990,6 +996,15 @@ export function treasurySectionAllowed(
|
||||
return perms.includes(section);
|
||||
}
|
||||
|
||||
/** ویرایش/حذف اسناد مالی — مالک، مدیر، یا کلید اختصاصی در نقش/override */
|
||||
export function canManageTreasuryDocuments(
|
||||
role: string | null | undefined,
|
||||
permissions: readonly string[] | null | undefined,
|
||||
): boolean {
|
||||
if (role === "owner" || role === "admin") return true;
|
||||
return (permissions ?? []).includes("treasury_documents_manage");
|
||||
}
|
||||
|
||||
export interface OrgRoleMemberDto {
|
||||
id: string;
|
||||
fullName: string;
|
||||
@@ -1344,8 +1359,10 @@ export interface CustomerGroupDto {
|
||||
/** گروه اصلی؛ خالی یعنی خودش اصلی است */
|
||||
parentId?: string | null;
|
||||
parentName?: string | null;
|
||||
/** مسئولان گروه (اختیاری) */
|
||||
/** مسئولان گروه به ترتیب انتخاب در فرم */
|
||||
assignees: CustomerGroupAssigneeDto[];
|
||||
/** شناسهٔ مسئولان به همان ترتیب انتخاب (منبع ترتیب) */
|
||||
assigneeIds?: string[];
|
||||
}
|
||||
|
||||
export interface CreateCustomerGroupRequest {
|
||||
@@ -1474,6 +1491,98 @@ export const PERSON_IMPORT_SOURCE_LABELS: Record<PersonImportSource, string> = {
|
||||
other: "سایر",
|
||||
};
|
||||
|
||||
/** گزینههای ثابت فیلد «سابقه فعالیت» برای لید و مشتری */
|
||||
export const ACTIVITY_EXPERIENCE_OPTIONS = [
|
||||
"ندارم",
|
||||
"1 الی 2 سال",
|
||||
"2 الی 5 سال",
|
||||
"بیش از 5 سال",
|
||||
] as const;
|
||||
export type ActivityExperience = (typeof ACTIVITY_EXPERIENCE_OPTIONS)[number];
|
||||
|
||||
/** نرمالسازی جواب فرم/ویرایش به یکی از گزینههای ثابت */
|
||||
export function normalizeActivityExperience(
|
||||
raw: string | null | undefined,
|
||||
): ActivityExperience | null {
|
||||
const text = (raw ?? "")
|
||||
.trim()
|
||||
.replace(/[۰-۹]/g, (d) => String("۰۱۲۳۴۵۶۷۸۹".indexOf(d)))
|
||||
.replace(/[٠-٩]/g, (d) => String("٠١٢٣٤٥٦٧٨٩".indexOf(d)))
|
||||
.replace(/\s+/g, " ");
|
||||
if (!text) return null;
|
||||
const lower = text.replace(/ي/g, "ی").replace(/ك/g, "ک").toLowerCase();
|
||||
if (
|
||||
lower === "ندارم" ||
|
||||
lower === "ندارد" ||
|
||||
lower.includes("بدون سابقه") ||
|
||||
lower === "0" ||
|
||||
lower === "هیچ"
|
||||
) {
|
||||
return "ندارم";
|
||||
}
|
||||
if (
|
||||
lower.includes("بیش از 5") ||
|
||||
lower.includes("بیشتر از 5") ||
|
||||
lower.includes("بالای 5") ||
|
||||
lower.includes("+5") ||
|
||||
lower.includes("5 سال به بالا")
|
||||
) {
|
||||
return "بیش از 5 سال";
|
||||
}
|
||||
if (
|
||||
lower.includes("2 الی 5") ||
|
||||
lower.includes("2 تا 5") ||
|
||||
lower.includes("۲ الی ۵") ||
|
||||
lower.includes("2-5") ||
|
||||
lower.includes("2–5")
|
||||
) {
|
||||
return "2 الی 5 سال";
|
||||
}
|
||||
if (
|
||||
lower.includes("1 الی 2") ||
|
||||
lower.includes("1 تا 2") ||
|
||||
lower.includes("۱ الی ۲") ||
|
||||
lower.includes("1-2") ||
|
||||
lower.includes("1–2")
|
||||
) {
|
||||
return "1 الی 2 سال";
|
||||
}
|
||||
for (const option of ACTIVITY_EXPERIENCE_OPTIONS) {
|
||||
if (lower === option.toLowerCase()) return option;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** برچسب سؤال فرم که به فیلد سابقه فعالیت مربوط است */
|
||||
export function isActivityExperienceLabel(label: string): boolean {
|
||||
const text = label.trim().replace(/ي/g, "ی").replace(/ك/g, "ک");
|
||||
return /سابقه\s*فعالیت/.test(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* استخراج سابقه فعالیت از خطوط یادداشت فرم
|
||||
* (مثلاً «سابقه فعالیت در حوزه نقره: بیش از 5 سال»).
|
||||
*/
|
||||
export function extractActivityExperienceFromNotes(
|
||||
notes: string | null | undefined,
|
||||
): ActivityExperience | null {
|
||||
const text = (notes ?? "").trim();
|
||||
if (!text || !/سابقه\s*فعالیت/.test(text.replace(/ي/g, "ی").replace(/ك/g, "ک"))) {
|
||||
return null;
|
||||
}
|
||||
for (const line of text.split(/\r?\n/)) {
|
||||
const trimmed = line.trim();
|
||||
if (!trimmed) continue;
|
||||
const splitAt = trimmed.indexOf(":");
|
||||
if (splitAt <= 0 || splitAt > 200) continue;
|
||||
const label = trimmed.slice(0, splitAt).trim();
|
||||
const value = trimmed.slice(splitAt + 1).trim();
|
||||
if (!value || !isActivityExperienceLabel(label)) continue;
|
||||
return normalizeActivityExperience(value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export interface PersonImportSourceStatDto {
|
||||
source: PersonImportSource | string;
|
||||
label: string;
|
||||
@@ -1503,6 +1612,7 @@ export interface PersonDto {
|
||||
instagram: string | null;
|
||||
birthDate: string | null;
|
||||
referrer: string | null;
|
||||
activityExperience: string | null;
|
||||
addresses: string[];
|
||||
notes: string | null;
|
||||
mood: PersonMood;
|
||||
@@ -1538,6 +1648,7 @@ export interface CreatePersonRequest {
|
||||
instagram?: string;
|
||||
birthDate?: string | null;
|
||||
referrer?: string;
|
||||
activityExperience?: string | null;
|
||||
addresses?: string[];
|
||||
notes?: string;
|
||||
mood?: PersonMood;
|
||||
@@ -1968,6 +2079,9 @@ export const ACTIVITY_STAGE_KIND_LABELS: Record<ActivityStatus, string> = {
|
||||
canceled: "لغو شده",
|
||||
};
|
||||
|
||||
/** کلید سیستمی گروه فعالیت مطالبات مانده حساب */
|
||||
export const ACTIVITY_BOARD_SYSTEM_BALANCE_CLAIMS = "balance_claims";
|
||||
|
||||
/** گروه فعالیت (مثل مسیر فروش): هر گروه ستونهای خودش را دارد */
|
||||
export interface ActivityBoardDto {
|
||||
id: string;
|
||||
@@ -1976,6 +2090,8 @@ export interface ActivityBoardDto {
|
||||
position: number;
|
||||
/** خالی = گروه برای همهٔ اعضای محیط باز است */
|
||||
memberIds: string[];
|
||||
/** مثلاً balance_claims — گروه سیستمی غیرقابل حذف/تغییر نام */
|
||||
systemKey?: string | null;
|
||||
}
|
||||
|
||||
export interface CreateActivityBoardRequest {
|
||||
@@ -2231,6 +2347,19 @@ export const ACTIVITY_EDIT_POLICY_LABELS: Record<ActivityEditPolicy, string> = {
|
||||
assignees: "همهٔ مسئولان",
|
||||
};
|
||||
|
||||
/** ماندهٔ کششدهٔ تهحساب برای کارت/جزئیات فعالیت مطالبات */
|
||||
export interface ActivityAccountBalanceWeightDto {
|
||||
key: string;
|
||||
label: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface ActivityAccountBalanceDto {
|
||||
rialBalance: number | null;
|
||||
weights: ActivityAccountBalanceWeightDto[];
|
||||
fetchedAt: string | null;
|
||||
}
|
||||
|
||||
export interface ActivityDto {
|
||||
id: string;
|
||||
type: ActivityType;
|
||||
@@ -2258,6 +2387,11 @@ export interface ActivityDto {
|
||||
importSource?: string;
|
||||
promotedFromPriorAt?: string | null;
|
||||
tags: string[];
|
||||
/**
|
||||
* فقط برای فعالیتهای کاریز مطالبات (تگ balance_claims):
|
||||
* مانده ریالی/وزنی از کش تهحساب؛ null یعنی لینک/کش نیست.
|
||||
*/
|
||||
accountBalance?: ActivityAccountBalanceDto | null;
|
||||
person: PersonSummaryDto | null;
|
||||
company: CompanySummaryDto | null;
|
||||
deal: DealSummaryDto | null;
|
||||
@@ -2872,9 +3006,11 @@ export type LeadFormMapTo =
|
||||
| "lead.city"
|
||||
| "lead.region"
|
||||
| "lead.trade"
|
||||
| "lead.activityExperience"
|
||||
| "lead.notes"
|
||||
| "lead.source"
|
||||
| "lead.gender"
|
||||
| "person.activityExperience"
|
||||
| "person.gender"
|
||||
| "notes"
|
||||
| "custom";
|
||||
@@ -4850,6 +4986,167 @@ export interface PersonAssetsDto {
|
||||
fetchedAt: string;
|
||||
}
|
||||
|
||||
/** تگ فعالیتهای ساختهشده از مانده حساب */
|
||||
export const ACCOUNT_BALANCE_CLAIMS_TAG = "balance_claims";
|
||||
|
||||
export const ACCOUNT_BALANCE_WEIGHT_KEYS = [
|
||||
"MandeyeVazni",
|
||||
"MandeyeVazniNoghre",
|
||||
] as const;
|
||||
|
||||
export type AccountBalanceWeightKey = (typeof ACCOUNT_BALANCE_WEIGHT_KEYS)[number] | string;
|
||||
|
||||
export const ACCOUNT_BALANCE_WEIGHT_LABELS: Record<string, string> = {
|
||||
MandeyeVazni: "مانده وزنی طلا (گرم)",
|
||||
MandeyeVazniNoghre: "مانده وزنی نقره (گرم)",
|
||||
};
|
||||
|
||||
/** نحوهٔ انتخاب بدهکاران برای یک معیار مانده */
|
||||
export type AccountBalanceCriterionMode = "all_debtors" | "range";
|
||||
|
||||
export interface AccountBalanceRangeDto {
|
||||
/**
|
||||
* all_debtors = هر مانده منفی (بد)، بدون بازه
|
||||
* range = فقط مقادیر بین min و max
|
||||
* نبود mode در دادهٔ قدیمی = range
|
||||
*/
|
||||
mode: AccountBalanceCriterionMode;
|
||||
/** فقط برای mode=range */
|
||||
min?: number;
|
||||
max?: number;
|
||||
}
|
||||
|
||||
export interface AccountBalanceSettingsDto {
|
||||
/** عنوان ستون اول کاریز مطالبات */
|
||||
firstStageName: string;
|
||||
/** معیار مانده مالی؛ null = خاموش */
|
||||
rial: AccountBalanceRangeDto | null;
|
||||
/** معیار بهازای هر کلید مانده وزنی؛ نبود کلید = خاموش */
|
||||
weights: Record<string, AccountBalanceRangeDto>;
|
||||
}
|
||||
|
||||
export interface UpdateAccountBalanceSettingsRequest {
|
||||
firstStageName?: string;
|
||||
rial?: AccountBalanceRangeDto | null;
|
||||
weights?: Record<string, AccountBalanceRangeDto | null>;
|
||||
}
|
||||
|
||||
export type UpdateAccountBalanceSettingsDto = UpdateAccountBalanceSettingsRequest;
|
||||
|
||||
/** اندازهٔ هر تکهٔ ارزیابی مطالبات (برای جلوگیری از تایماوت) */
|
||||
export const ACCOUNT_BALANCE_EVALUATE_BATCH_SIZE = 2000;
|
||||
|
||||
export interface AccountBalanceEvaluateRequest {
|
||||
/** از این ایندکس در فهرست واجدین شرایط */
|
||||
offset?: number;
|
||||
/** حداکثر نفر در این تکه؛ پیشفرض ۲۰۰۹ */
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
/** نتیجهٔ ارزیابی دستی/جاب مطالبات مانده */
|
||||
export interface AccountBalanceEvaluateResultDto {
|
||||
linkedPeople: number;
|
||||
candidates: number;
|
||||
skippedNoAssignee: number;
|
||||
matched: number;
|
||||
created: number;
|
||||
reopened: number;
|
||||
canceled: number;
|
||||
unchanged: number;
|
||||
errors: number;
|
||||
message: string;
|
||||
offset: number;
|
||||
limit: number;
|
||||
/** چند نفر در همین تکه پردازش شدند */
|
||||
batchProcessed: number;
|
||||
/** آیا همهٔ تکهها تمام شد */
|
||||
done: boolean;
|
||||
/** برای درخواست بعدی؛ null یعنی تمام */
|
||||
nextOffset: number | null;
|
||||
}
|
||||
|
||||
export const DEFAULT_ACCOUNT_BALANCE_FIRST_STAGE = "مطالبه مشتریان";
|
||||
|
||||
export function defaultAccountBalanceSettings(): AccountBalanceSettingsDto {
|
||||
return {
|
||||
firstStageName: DEFAULT_ACCOUNT_BALANCE_FIRST_STAGE,
|
||||
rial: null,
|
||||
weights: {},
|
||||
};
|
||||
}
|
||||
|
||||
export function parseAccountBalanceRange(raw: unknown): AccountBalanceRangeDto | null {
|
||||
if (!raw || typeof raw !== "object") return null;
|
||||
const obj = raw as { mode?: unknown; min?: unknown; max?: unknown };
|
||||
const modeRaw = typeof obj.mode === "string" ? obj.mode.trim() : "";
|
||||
if (modeRaw === "all_debtors") {
|
||||
return { mode: "all_debtors" };
|
||||
}
|
||||
// mode=range یا دادهٔ قدیمی بدون mode
|
||||
const min = Number(obj.min);
|
||||
const max = Number(obj.max);
|
||||
if (!Number.isFinite(min) || !Number.isFinite(max)) return null;
|
||||
return { mode: "range", min, max: Math.max(min, max) };
|
||||
}
|
||||
|
||||
export function parseAccountBalanceSettings(raw: unknown): AccountBalanceSettingsDto {
|
||||
const base = defaultAccountBalanceSettings();
|
||||
if (!raw || typeof raw !== "object") return base;
|
||||
const obj = raw as Record<string, unknown>;
|
||||
const firstStageName =
|
||||
typeof obj.firstStageName === "string" && obj.firstStageName.trim()
|
||||
? obj.firstStageName.trim().slice(0, 80)
|
||||
: base.firstStageName;
|
||||
const rial = parseAccountBalanceRange(obj.rial);
|
||||
const weights: Record<string, AccountBalanceRangeDto> = {};
|
||||
if (obj.weights && typeof obj.weights === "object") {
|
||||
for (const [key, value] of Object.entries(obj.weights as Record<string, unknown>)) {
|
||||
const range = parseAccountBalanceRange(value);
|
||||
if (range) weights[key] = range;
|
||||
}
|
||||
}
|
||||
return { firstStageName, rial, weights };
|
||||
}
|
||||
|
||||
/** تطبیق مانده با معیار: تمام بدهکاران (منفی) یا بازهٔ inclusive */
|
||||
export function accountBalanceMatchesCriterion(
|
||||
value: number | null | undefined,
|
||||
criterion: AccountBalanceRangeDto | null | undefined,
|
||||
): boolean {
|
||||
if (!criterion || value == null || !Number.isFinite(value)) return false;
|
||||
if (criterion.mode === "all_debtors") return value < 0;
|
||||
if (criterion.min == null || criterion.max == null) return false;
|
||||
if (!Number.isFinite(criterion.min) || !Number.isFinite(criterion.max)) return false;
|
||||
return value >= criterion.min && value <= criterion.max;
|
||||
}
|
||||
|
||||
/** @deprecated از accountBalanceMatchesCriterion استفاده کنید */
|
||||
export function accountBalanceInRange(
|
||||
value: number | null | undefined,
|
||||
range: AccountBalanceRangeDto | null | undefined,
|
||||
): boolean {
|
||||
return accountBalanceMatchesCriterion(value, range);
|
||||
}
|
||||
|
||||
export function parseAccountBalanceNumber(raw: unknown): number | null {
|
||||
if (raw == null || raw === "") return null;
|
||||
const n = Number(String(raw).replace(/,/g, "").trim());
|
||||
return Number.isFinite(n) ? n : null;
|
||||
}
|
||||
|
||||
export function parseAccountBalanceWeightFields(
|
||||
fields: Array<{ key: string; value: unknown }> | null | undefined,
|
||||
): Record<string, number> {
|
||||
const out: Record<string, number> = {};
|
||||
for (const field of fields ?? []) {
|
||||
const key = String(field.key ?? "").trim();
|
||||
if (!key) continue;
|
||||
const value = parseAccountBalanceNumber(field.value);
|
||||
if (value != null) out[key] = value;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// —— پیام خودکار (جدا از اتوماسیون گردش کار) ——
|
||||
|
||||
export type MessageAutomationTrigger =
|
||||
@@ -5228,7 +5525,7 @@ export interface ReportsViewFilters {
|
||||
period: string;
|
||||
from?: string;
|
||||
to?: string;
|
||||
/** dashboard | builder */
|
||||
/** dashboard | builder | leads */
|
||||
mode?: string;
|
||||
builder?: {
|
||||
metric?: string;
|
||||
@@ -5248,7 +5545,12 @@ export type ReportsBuilderMetric =
|
||||
| "activities_done"
|
||||
| "people_created"
|
||||
| "invoice_amount"
|
||||
| "invoice_count";
|
||||
| "invoice_count"
|
||||
| "leads_created"
|
||||
| "leads_converted"
|
||||
| "leads_lost"
|
||||
| "leads_active"
|
||||
| "leads_avg_dwell_hours";
|
||||
|
||||
export const REPORTS_BUILDER_METRICS: ReportsBuilderMetric[] = [
|
||||
"won_amount",
|
||||
@@ -5260,6 +5562,11 @@ export const REPORTS_BUILDER_METRICS: ReportsBuilderMetric[] = [
|
||||
"people_created",
|
||||
"invoice_amount",
|
||||
"invoice_count",
|
||||
"leads_created",
|
||||
"leads_converted",
|
||||
"leads_lost",
|
||||
"leads_active",
|
||||
"leads_avg_dwell_hours",
|
||||
];
|
||||
|
||||
export const REPORTS_BUILDER_METRIC_LABELS: Record<
|
||||
@@ -5275,6 +5582,11 @@ export const REPORTS_BUILDER_METRIC_LABELS: Record<
|
||||
people_created: "مشتریان جدید",
|
||||
invoice_amount: "مبلغ فاکتور",
|
||||
invoice_count: "تعداد فاکتور",
|
||||
leads_created: "لیدهای ایجادشده",
|
||||
leads_converted: "لیدهای تبدیلشده",
|
||||
leads_lost: "لیدهای ازدسترفته",
|
||||
leads_active: "لیدهای فعال (فعلی)",
|
||||
leads_avg_dwell_hours: "میانگین ماندن در مرحله لید (ساعت)",
|
||||
};
|
||||
|
||||
/** ابعاد گروهبندی گزارشساز */
|
||||
@@ -5284,6 +5596,7 @@ export type ReportsBuilderDimension =
|
||||
| "team"
|
||||
| "source"
|
||||
| "stage"
|
||||
| "lead_stage"
|
||||
| "month"
|
||||
| "status";
|
||||
|
||||
@@ -5293,6 +5606,7 @@ export const REPORTS_BUILDER_DIMENSIONS: ReportsBuilderDimension[] = [
|
||||
"team",
|
||||
"source",
|
||||
"stage",
|
||||
"lead_stage",
|
||||
"month",
|
||||
"status",
|
||||
];
|
||||
@@ -5306,10 +5620,26 @@ export const REPORTS_BUILDER_DIMENSION_LABELS: Record<
|
||||
team: "تیم",
|
||||
source: "منبع",
|
||||
stage: "مرحله مسیر فروش",
|
||||
lead_stage: "مرحله / ستون لید",
|
||||
month: "ماه",
|
||||
status: "وضعیت معامله",
|
||||
};
|
||||
|
||||
/** متریکهای مربوط به لید در گزارشساز */
|
||||
export const REPORTS_LEAD_BUILDER_METRICS: ReportsBuilderMetric[] = [
|
||||
"leads_created",
|
||||
"leads_converted",
|
||||
"leads_lost",
|
||||
"leads_active",
|
||||
"leads_avg_dwell_hours",
|
||||
];
|
||||
|
||||
export function isReportsLeadBuilderMetric(
|
||||
metric: ReportsBuilderMetric,
|
||||
): boolean {
|
||||
return (REPORTS_LEAD_BUILDER_METRICS as string[]).includes(metric);
|
||||
}
|
||||
|
||||
export interface ReportsBuilderQuery {
|
||||
metric: ReportsBuilderMetric;
|
||||
dimension: ReportsBuilderDimension;
|
||||
@@ -5325,6 +5655,48 @@ export interface ReportsBuilderRowDto {
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** تحلیل اختصاصی کانبان لیدها (قیف، تبدیل بینمرحلهای، ماندگاری) */
|
||||
export interface ReportsLeadsFunnelStageDto {
|
||||
stageId: string;
|
||||
stageName: string;
|
||||
count: number;
|
||||
sharePercent: number;
|
||||
/** نسبت به ستون قبلی در ترتیب کانبان؛ null برای اولی */
|
||||
conversionFromPrevPercent: number | null;
|
||||
avgDwellHours: number | null;
|
||||
}
|
||||
|
||||
export interface ReportsLeadsTransitionDto {
|
||||
fromStageId: string;
|
||||
fromStageName: string;
|
||||
toStageId: string;
|
||||
toStageName: string;
|
||||
count: number;
|
||||
/** درصد از کل خروجیهای fromStage در بازه */
|
||||
conversionPercent: number;
|
||||
}
|
||||
|
||||
export interface ReportsLeadsDwellDto {
|
||||
stageId: string;
|
||||
stageName: string;
|
||||
avgHours: number;
|
||||
sampleCount: number;
|
||||
}
|
||||
|
||||
export interface ReportsLeadsAnalyticsDto {
|
||||
from: string;
|
||||
to: string;
|
||||
created: number;
|
||||
converted: number;
|
||||
lost: number;
|
||||
active: number;
|
||||
/** تبدیلشده ÷ (تبدیلشده + ازدسترفته) در بازه؛ اگر مخرج صفر باشد ۰ */
|
||||
conversionRate: number;
|
||||
funnel: ReportsLeadsFunnelStageDto[];
|
||||
transitions: ReportsLeadsTransitionDto[];
|
||||
dwellByStage: ReportsLeadsDwellDto[];
|
||||
}
|
||||
|
||||
export interface ReportsBuilderResultDto {
|
||||
metric: ReportsBuilderMetric;
|
||||
metricLabel: string;
|
||||
@@ -6055,6 +6427,7 @@ export interface LeadDto {
|
||||
addresses: string[];
|
||||
trade: string | null;
|
||||
source: string | null;
|
||||
activityExperience: string | null;
|
||||
notes: string | null;
|
||||
estimatedValue: number | null;
|
||||
stageId: string;
|
||||
@@ -6096,6 +6469,7 @@ export interface CreateLeadRequest {
|
||||
addresses?: string[];
|
||||
trade?: string | null;
|
||||
source?: string | null;
|
||||
activityExperience?: string | null;
|
||||
notes?: string | null;
|
||||
estimatedValue?: number | null;
|
||||
stageId?: string;
|
||||
@@ -6119,9 +6493,12 @@ export interface UpdateLeadRequest {
|
||||
addresses?: string[];
|
||||
trade?: string | null;
|
||||
source?: string | null;
|
||||
activityExperience?: string | null;
|
||||
notes?: string | null;
|
||||
estimatedValue?: number | null;
|
||||
stageId?: string;
|
||||
/** الزامی هنگام تغییر ستون؛ در جدول زمانی لید ثبت میشود */
|
||||
reason?: string | null;
|
||||
assigneeId?: string | null;
|
||||
nextFollowUpAt?: string | null;
|
||||
lastContactAt?: string | null;
|
||||
@@ -6130,6 +6507,8 @@ export interface UpdateLeadRequest {
|
||||
export interface MoveLeadRequest {
|
||||
stageId: string;
|
||||
position?: number;
|
||||
/** الزامی هنگام تغییر ستون؛ در جدول زمانی لید ثبت میشود */
|
||||
reason?: string | null;
|
||||
}
|
||||
|
||||
export interface AssignLeadsRequest {
|
||||
@@ -6140,6 +6519,8 @@ export interface AssignLeadsRequest {
|
||||
export interface BulkLeadStageRequest {
|
||||
leadIds: string[];
|
||||
stageId: string;
|
||||
/** الزامی؛ در جدول زمانی هر لید ثبت میشود */
|
||||
reason?: string | null;
|
||||
}
|
||||
|
||||
export interface AutoAssignLeadsRequest {
|
||||
@@ -6843,7 +7224,7 @@ export interface FinancialDocumentDto {
|
||||
reference: string | null;
|
||||
notes: string | null;
|
||||
createdAt: string;
|
||||
attachments?: Array<{ id: string; fileName: string }>;
|
||||
attachments?: Array<{ id: string; fileName: string; mimeType?: string }>;
|
||||
}
|
||||
|
||||
export interface FinancialMovementDto {
|
||||
|
||||
Reference in New Issue
Block a user