Redesign sales goals and forecast with typed targets and live progress.

Match desktop/mobile mockups and compute current amounts, status, and KPIs from real CRM data.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 18:38:11 +03:30
co-authored by Cursor
parent 1c1b77e74a
commit 32af147237
8 changed files with 1287 additions and 385 deletions
+38 -1
View File
@@ -1097,15 +1097,31 @@ export interface CreatePaymentRequest {
installmentId?: string | null;
}
export type SalesGoalType =
| "sales"
| "customer"
| "revenue"
| "deal"
| "activity"
| "quality";
export type SalesGoalStatus = "in_progress" | "completed" | "needs_attention";
export interface SalesGoalDto {
id: string;
title: string;
type: SalesGoalType | string;
periodStart: string;
periodEnd: string;
targetAmount: number;
forecastAmount: number | null;
probability: number | null;
currency: string;
notes: string | null;
user: UserSummaryDto | null;
currentAmount: number;
progressPercent: number;
status: SalesGoalStatus;
createdAt: string;
updatedAt: string;
}
@@ -1115,6 +1131,10 @@ export interface CreateSalesGoalRequest {
periodStart: string;
periodEnd: string;
targetAmount: number;
type?: SalesGoalType | string;
forecastAmount?: number | null;
/** 0-100 */
probability?: number | null;
currency?: string;
notes?: string;
/** فقط مالک/مدیر؛ در غیر این صورت هدف برای خود کاربر */
@@ -1126,11 +1146,24 @@ export interface UpdateSalesGoalRequest {
periodStart?: string;
periodEnd?: string;
targetAmount?: number;
type?: SalesGoalType | string;
forecastAmount?: number | null;
/** 0-100 */
probability?: number | null;
currency?: string;
notes?: string | null;
userId?: string | null;
}
export interface SalesForecastKpiDto {
key: "sales" | "customer" | "deal" | "forecast";
label: string;
current: number;
target: number;
percent: number;
unit: "money" | "count";
}
export interface SalesForecastDto {
periodStart: string;
periodEnd: string;
@@ -1141,12 +1174,16 @@ export interface SalesForecastDto {
wonAmount: number;
/** معاملات باز فعلی */
openPipelineAmount: number;
/** پیش‌بینی ساده: تحقق + ۴۰٪ کاریز باز */
/** پیش‌بینی: تحقق + کاریز باز × میانگین احتمال */
forecastAmount: number;
progressPercent: number | null;
openDealsCount: number;
wonDealsCount: number;
goals: SalesGoalDto[];
kpis: SalesForecastKpiDto[];
newCustomersCount: number;
/** معاملات ایجادشده در بازه */
newDealsCount: number;
}
export type TicketStatus =