task-ep.1.2

This commit is contained in:
phaichayon
2026-07-13 09:49:45 +07:00
parent 9ae4f31f28
commit e96320a24d
28 changed files with 1337 additions and 21 deletions

View File

@@ -1,6 +1,41 @@
import { formatCrmActivityLabel } from '@/features/crm/activity/types';
import type { LeadFollowupSummary } from '@/features/crm/leads/types';
import type { ActivityTimelineItem } from '../../api/types';
export interface LeadFollowupAdapterCandidate {
source: 'lead_followup';
followup: LeadFollowupSummary;
}
export function adaptLeadFollowupCandidate(
candidate: LeadFollowupAdapterCandidate
): ActivityTimelineItem {
const statusLabel =
candidate.followup.followupStatusLabel ??
formatCrmActivityLabel(candidate.followup.followupStatus);
return {
id: candidate.followup.id,
source: 'lead_followup',
sourceLabel: 'Lead Follow-up',
isLegacy: true,
activityId: null,
activityCode: null,
primaryEntityType: 'lead',
primaryEntityId: candidate.followup.leadId,
primaryRecordLabel: null,
activityType: 'follow_up',
activityTypeLabel: 'Follow Up',
subject: candidate.followup.note?.trim() || 'Lead follow-up',
description: candidate.followup.note,
status: candidate.followup.followupStatus,
statusLabel,
occurredAt: candidate.followup.followupDate,
scheduledAt: candidate.followup.followupDate,
dueAt: candidate.followup.nextFollowupDate,
nextAction: null,
ownerName: null,
assignedToName: null,
createdByName: candidate.followup.createdByName
};
}