Files
alla-allaos-fullstack/docs/implementation/task-d.6-crm-activity-foundation-audit-log-separation-2026-07-01.md
phaichayon 6d6cd3a6df d.6
2026-07-01 08:44:35 +07:00

3.6 KiB

Task D.6 Implementation Report - 2026-07-01

Scope

  • Separate CRM business Activity semantics from system-generated audit history.
  • Rename CRM detail tabs that currently show system history from Activity to Audit Log.
  • Improve follow-up date input UX with the shared calendar picker and stable YYYY-MM-DD display.
  • Introduce a contract-first CRM Activity foundation without migrating existing follow-up storage in this phase.

Review Summary

Reviewed before implementation:

Changes

  • Added shared audit-log-tab.tsx and types.ts for consistent CRM audit history rendering.
  • Updated lead, opportunity, customer, and quotation detail views to label system history as Audit Log.
  • Enriched CRM audit-log records in lead, opportunity, customer, and quotation services so UI can consume beforeData, afterData, and requestId.
  • Standardized crm-form-controls.tsx and date-picker-field.tsx to show YYYY-MM-DD and allow clearing optional dates.
  • Rebuilt lead-followup-panel.tsx to use the shared date-picker field instead of plain text date entry.
  • Added src/features/crm/activity/types.ts to define future activity entity scope, types, statuses, priorities, permission contracts, and overdue-status derivation.
  • Added activity and audit-log permission keys in rbac.ts.

Verification

  • npm run typecheck -> PASS
  • npm run build -> PASS
  • npm run audit:pdf -> PASS

Known Follow-up

  • Historical lead/opportunity/quotation follow-up rows still live in their existing tables and APIs; only the UX and activity contracts were prepared in this phase.
  • npm run build still emits pre-existing Turbopack warnings about workspace root lockfile detection and NFT tracing around PDF audit/template validation paths. No new blocking build issue was introduced by D.6.

Outcome

Task D.6 now reserves Activity for future MK/Sales business work, presents current system history as Audit Log, improves lead follow-up date entry with a proper calendar picker, and establishes the first reusable contracts for a future CRM activity module.