# Sales Checklist Completed History — Implementation Plan

## Goal

Let a sales user see completed Zoom action-plan tasks beside the remaining tasks for the same lead, and browse a read-only, paginated history of completed tasks across every lead they may access.

## Task 1: Lock the backend contract with tests

Files:

- `tests/Feature/Manage/DashboardChecklistTest.php`
- `routes/web.php`

Verification:

- The dashboard payload includes `completed_items` only for plans that still have open tasks.
- Completed siblings are scoped to the signed-in assignee and current lead visibility.
- The history endpoint is feature-flagged, assignee-scoped, visibility-scoped, approved-plan-only, newest-first, and cursor-paginated.

## Task 2: Implement the dashboard payload and history endpoint

Files:

- `app/Http/Controllers/Manage/DashboardController.php`
- `routes/web.php`

Implementation:

- Query completed siblings separately so plan progress still counts every generated item.
- Return `{uuid, body, done_at}` under each current plan.
- Add a lazy JSON endpoint returning 20 completed rows plus `next_cursor`.

Verification:

- Run the targeted Laravel feature test with PHP 8.4.

## Task 3: Lock client-state behavior with tests

Files:

- `resources/js/utils/actionPlanChecklist.test.js`

Verification:

- A confirmed completion moves the item from `open_items` to `completed_items` before pruning the current plan/lead when its final open step is done.
- A newly completed item can be inserted into an already-loaded history without duplication.

## Task 4: Implement the two-tab checklist UI

Files:

- `resources/js/utils/actionPlanChecklist.js`
- `resources/js/Components/TodaysChecklistModal.vue`
- `resources/js/Pages/Manage/Dashboard.vue`

Implementation:

- Add `Current Tasks` and `Completed History` tabs.
- Render completed siblings read-only under the related current lead/plan.
- Lazy-load history on first visit, support `Load more`, and merge confirmed completions when history is already loaded.
- Keep the dashboard card available as `View history` when no open tasks remain.

Verification:

- Run targeted Vitest tests and frontend lint/build checks.

## Task 5: Integrate and demo-check

- Review the diff for scope and authorization.
- Commit the task changes atomically on `codex/sales-checklist-completed-history`.
- Create a recoverable `dev-chen` backup and cherry-pick only the new task commits.
- Verify the Super Admin and Demo Sales browser views against `petav3.test`.

