fix: Approved this month for manager only shows POs that are currently in Approved state #34

Merged
shad0w merged 2 commits from claude/issue-32 into master 2026-06-19 07:10:18 +00:00
Owner

Automated fix by Claude Code for #32.

Closes #32

Review, merge, then create a release tag (vX.Y.Z) to deploy.

Automated fix by Claude Code for #32. Closes #32 Review, merge, then create a release tag (vX.Y.Z) to deploy.
shad0w added 1 commit 2026-06-19 06:38:10 +00:00
The manager dashboard "Approved This Month" card only counted POs whose
current status is MGR_APPROVED, so approvals that had already moved on to
payment, delivery, or closure dropped out of the count. Managers could not
see what happened to the POs they approved this month.

- Count every PO whose `approvedAt` falls in the current month across all
  post-approval statuses (MGR_APPROVED → ... → CLOSED). `approvedAt` is set
  once at approval and persists, so it is the correct anchor.
- Introduce a shared `POST_APPROVAL_STATUSES` constant (includes the
  previously-omitted PARTIALLY_CLOSED). This also fixes Total Approved Spend
  and the vessel/monthly breakdowns, which were silently dropping
  partially-received POs.
- Make the card a link into /history with an approval-date filter applied
  (?approvedFrom=<startOfMonth>) so a click shows the full set with each PO's
  current status, as requested.
- Add `approvedFrom`/`approvedTo` filtering to the history page, its filter
  UI, and the reports export route so the deep-link and exports stay in sync.

Scope note: the count remains org-wide, consistent with every other card on
the manager dashboard.

Adds an integration test covering the moved-on case and the date window.

Fixes #32
shad0w added 1 commit 2026-06-19 07:05:38 +00:00
# Conflicts:
#	App/app/(portal)/history/history-filters.tsx
shad0w merged commit 157b58daf5 into master 2026-06-19 07:10:18 +00:00
Sign in to join this conversation.
No description provided.