fix: keep deal edits and right-align club leaderboard
Empty product lists were wiping the manual amount on update, and follow-ups were only created for new deals. Leaderboard rows were laid out left-to-right on an RTL page. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -116,6 +116,8 @@ const sourceRef = ref('');
|
||||
const status = ref('');
|
||||
const customFields = ref<Record<string, unknown>>({});
|
||||
const lines = ref<LineDraft[]>([]);
|
||||
/** تعداد اقلام ذخیرهشده؛ برای حذف همهٔ اقلام باید آرایهٔ خالی فرستاده شود */
|
||||
const savedLineCount = ref(0);
|
||||
|
||||
const nextDueDate = ref('');
|
||||
const nextDueTime = ref('10:30');
|
||||
@@ -364,7 +366,11 @@ async function load() {
|
||||
quantity: String(item.quantity),
|
||||
unitPrice: String(item.unitPrice),
|
||||
}));
|
||||
savedLineCount.value = lines.value.length;
|
||||
productsOpen.value = lines.value.length > 0;
|
||||
if (data.company && !companies.value.some((c) => c.id === data.company!.id)) {
|
||||
companies.value = [{ id: data.company.id, name: data.company.name } as CompanyDto, ...companies.value];
|
||||
}
|
||||
if (data.pipelineId !== pipelineId.value) {
|
||||
await loadBoard(data.pipelineId);
|
||||
stageId.value = data.stageId;
|
||||
@@ -397,6 +403,7 @@ async function load() {
|
||||
|
||||
function payload(): CreateDealRequest {
|
||||
const lineItems = toLineInputs();
|
||||
const sendLineItems = lineItems.length > 0 || savedLineCount.value > 0;
|
||||
return {
|
||||
title: title.value,
|
||||
amount:
|
||||
@@ -423,12 +430,12 @@ function payload(): CreateDealRequest {
|
||||
stageId: stageId.value || undefined,
|
||||
customFields: customFields.value,
|
||||
currency: currency.value || 'IRR',
|
||||
lineItems,
|
||||
...(sendLineItems ? { lineItems } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
async function createFollowUp(dealId: string) {
|
||||
if (!isNew.value || !nextDueDate.value) return;
|
||||
if (!nextDueDate.value) return;
|
||||
const due = new Date(`${nextDueDate.value}T${nextDueTime.value || '10:30'}:00`);
|
||||
if (Number.isNaN(due.getTime())) return;
|
||||
await api.post('/activities', {
|
||||
@@ -488,6 +495,11 @@ async function submit() {
|
||||
if (moveStageId) {
|
||||
await api.patch(`/deals/${id.value}/move`, { stageId: moveStageId });
|
||||
}
|
||||
try {
|
||||
await createFollowUp(id.value);
|
||||
} catch {
|
||||
/* deal saved; follow-up is optional */
|
||||
}
|
||||
if (props.embedded) {
|
||||
emit('saved');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user