Add deeper reports: stage conversion, period compare, and deal drill-down.

This commit is contained in:
2026-09-27 10:39:09 +03:30
parent d133c8ca34
commit 6a9e864b07
5 changed files with 889 additions and 60 deletions
+67 -7
View File
@@ -2077,6 +2077,70 @@ export interface ReportsTeamRowDto {
activitiesDone: number;
}
/** گونه‌های drill-down گزارش عمیق (فاز ۱ BI) */
export type ReportsDrillKind =
| "stage_open"
| "team_won"
| "period_won"
| "period_lost"
| "source"
| "lost_reason";
export const REPORTS_DRILL_KINDS: ReportsDrillKind[] = [
"stage_open",
"team_won",
"period_won",
"period_lost",
"source",
"lost_reason",
];
export interface ReportsFunnelStageDto {
stageId: string;
stageName: string;
pipelineId: string;
pipelineName: string;
count: number;
amount: number;
/** درصد تبدیل نسبت به مرحله قبل همان کاریز؛ null برای اولین مرحله */
conversionFromPrevPercent: number | null;
/** سهم از کل معاملات باز همان کاریز */
shareOfPipelinePercent: number;
}
export interface ReportsPeriodCompareRowDto {
key: string;
label: string;
format: "money" | "number" | "percent";
current: number;
previous: number;
changePercent: number | null;
/** اگر قابل کلیک برای لیست پرونده باشد */
drillKind?: ReportsDrillKind;
}
export interface ReportsDrillItemDto {
id: string;
title: string;
status: string;
statusLabel: string;
amount: number;
currency: string;
ownerName: string | null;
stageName: string | null;
updatedAt: string;
link: string;
}
export interface ReportsDrilldownDto {
kind: ReportsDrillKind;
title: string;
from: string;
to: string;
total: number;
items: ReportsDrillItemDto[];
}
export interface ReportsDashboardDto {
from: string;
to: string;
@@ -2107,13 +2171,9 @@ export interface ReportsDashboardDto {
lostAmount: number;
winRate: number;
};
funnel: Array<{
stageId: string;
stageName: string;
pipelineName: string;
count: number;
amount: number;
}>;
funnel: ReportsFunnelStageDto[];
/** مقایسه صریح بازه فعلی با دوره قبل هم‌طول */
periodCompare: ReportsPeriodCompareRowDto[];
tickets: {
open: number;
resolved: number;