Editing of the project's Kariz page
This commit is contained in:
@@ -4,7 +4,7 @@ export type PipelineDeal = {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
amount: number;
|
||||
amount: number | null;
|
||||
date: string;
|
||||
initials: string;
|
||||
/** شناسه مرحله فعلی — هنگام جابهجایی بهروز میشود */
|
||||
@@ -12,6 +12,35 @@ export type PipelineDeal = {
|
||||
currencyUnit?: string;
|
||||
};
|
||||
|
||||
export type PipelineUiCopy = {
|
||||
itemNoun: string;
|
||||
addItem: string;
|
||||
empty: string;
|
||||
addItemAria: string;
|
||||
itemMenuAria: string;
|
||||
listColTitle: string;
|
||||
hideAmount?: boolean;
|
||||
};
|
||||
|
||||
export const DEAL_BOARD_COPY: PipelineUiCopy = {
|
||||
itemNoun: 'معامله',
|
||||
addItem: 'افزودن معامله',
|
||||
empty: 'معاملهای نیست',
|
||||
addItemAria: 'افزودن معامله به این مرحله',
|
||||
itemMenuAria: 'گزینههای معامله',
|
||||
listColTitle: 'معامله',
|
||||
};
|
||||
|
||||
export const PROJECT_BOARD_COPY: PipelineUiCopy = {
|
||||
itemNoun: 'کارت',
|
||||
addItem: 'افزودن کارت',
|
||||
empty: 'کارتی نیست',
|
||||
addItemAria: 'افزودن کارت به این مرحله',
|
||||
itemMenuAria: 'گزینههای کارت',
|
||||
listColTitle: 'کارت',
|
||||
hideAmount: true,
|
||||
};
|
||||
|
||||
export type PipelineStage = {
|
||||
id: string;
|
||||
title: string;
|
||||
@@ -152,6 +181,48 @@ export function mapBoardToStages(
|
||||
});
|
||||
}
|
||||
|
||||
export function mapProjectBoardToStages(
|
||||
board: {
|
||||
stages: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
cards: Array<{
|
||||
id: string;
|
||||
title: string;
|
||||
notes: string | null;
|
||||
stageId: string;
|
||||
createdAt: string;
|
||||
person: { fullName: string } | null;
|
||||
company: { name: string } | null;
|
||||
deal: { title: string } | null;
|
||||
}>;
|
||||
}>;
|
||||
},
|
||||
formatDate: (iso: string) => string,
|
||||
): PipelineStage[] {
|
||||
return board.stages.map((stage, index) => ({
|
||||
id: stage.id,
|
||||
title: stage.name,
|
||||
color: ACCENT_CYCLE[index % ACCENT_CYCLE.length]!,
|
||||
deals: stage.cards.map((card) => ({
|
||||
id: card.id,
|
||||
title: card.title,
|
||||
description:
|
||||
card.company?.name ||
|
||||
card.person?.fullName ||
|
||||
card.deal?.title ||
|
||||
card.notes?.trim() ||
|
||||
'',
|
||||
amount: null,
|
||||
date: formatDate(card.createdAt),
|
||||
initials: initialsFromTitle(
|
||||
card.company?.name || card.person?.fullName || card.title,
|
||||
),
|
||||
stageId: card.stageId,
|
||||
})),
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* جابهجایی معامله بین مراحل یا تغییر ترتیب داخل یک مرحله.
|
||||
@@ -241,15 +312,23 @@ export function filterStages(
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (min != null && !Number.isNaN(min) && d.amount < min) return false;
|
||||
if (max != null && !Number.isNaN(max) && d.amount > max) return false;
|
||||
if (min != null && !Number.isNaN(min) && (d.amount == null || d.amount < min)) {
|
||||
return false;
|
||||
}
|
||||
if (max != null && !Number.isNaN(max) && (d.amount == null || d.amount > max)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}),
|
||||
}));
|
||||
}
|
||||
|
||||
export function toFaItemCount(n: number, noun = 'معامله'): string {
|
||||
return `${new Intl.NumberFormat('fa-IR').format(n)} ${noun}`;
|
||||
}
|
||||
|
||||
export function toFaDealCount(n: number): string {
|
||||
return `${new Intl.NumberFormat('fa-IR').format(n)} معامله`;
|
||||
return toFaItemCount(n, 'معامله');
|
||||
}
|
||||
|
||||
/** جابهجایی یک ستون به ایندکس جدید */
|
||||
|
||||
Reference in New Issue
Block a user