Skip to content

PM-6364 Date range filters and filtered totals for the Sales Portal - #2319

Merged
jmgasper merged 2 commits into
devfrom
PM-6364
Sep 17, 2026
Merged

jmgasper merged 2 commits into
devfrom
PM-6364

Conversation

@jmgasper

@jmgasper jmgasper commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Implements PM-6364.

Adds a date range section at the top of the Sales Portal so sales and leadership can separate pipeline generation (Created Date) from revenue realization (Close Date), and shows the metrics each filter produces.

Pairs with reports-api-v6#PM-6364, which adds the server-side date range and aggregates. The UI degrades safely against an API that predates it, but needs it deployed for the filter and tiles to do anything.

Why the API had to change

GET {REPORTS_API}/sales paginates server-side over the Salesforce snapshot, so the browser only ever holds one page of rows. Filtering by date in the UI would have produced a record count and totals describing the visible page rather than the result, which is the opposite of what the ticket asks for. The range and the aggregates are therefore computed over the whole received snapshot before pagination.

Date range filter

  • Filter type lists the report's own date/datetime columns, read from live report metadata rather than hard-coded Salesforce field IDs, and opens on Created Date when the report has one.
  • From date / To date are inclusive; either may be left empty for an open-ended range.
  • Apply filter sends the range (unlike search and column filters, which stay debounced). Reset filter clears it without disturbing search, column filters or sorting, and the existing Clear leaves the range intact.
  • An inverted range is reported inline and never sent. A report with no date columns disables the section.

Filtered totals

Tiles above the report show opportunity count, a total per numeric column (pipeline value and revenue projections), and a per-category breakdown such as Stage. A total that sums different currencies renders as a plain number and is labelled as mixed, rather than being presented as one currency. Tiles are hidden when the API returns no summary.

Not included

Requirement 3 lists charts and visualisations under "if possible". This PR delivers the counts, totals and stage/category summaries as numbers; no charting library is introduced into an app that currently has none.

Verification

  • yarn lint on src/apps/sales — clean
  • LOGICAL_ENV=dev yarn run build — succeeds
  • CI=true yarn test:no-watch --runInBand --watch=false sales — 16 passed, including new coverage for date field discovery and defaulting, inclusive and open-ended ranges, inverted-range rejection, reset vs. clear independence, and totals describing the result rather than the page

🤖 Generated with Claude Code

Adds a date range section at the top of the Sales Portal so sales and
leadership can separate pipeline generation, analysed by Created Date, from
revenue realization, analysed by Close Date.

The Filter type dropdown lists the report's own date columns rather than
hard-coded Salesforce field IDs, and opens on Created Date. From and To are
inclusive and either may be left empty. The range applies on Apply filter,
Reset filter clears it without disturbing search, column filters or sorting,
and clearing the report filters leaves the range intact. An inverted range is
reported inline and never sent.

Summary tiles show the metrics the active filters produce: opportunity count,
a total per numeric column, and a per-stage breakdown. The Reports API
computes these over every matching record, so they describe the filtered
result rather than the page on screen, and a cross-currency total is rendered
as a plain number and labelled as mixed. The tiles are hidden when the API
returns no summary, so the page still works against an API that predates it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PM-6363 landed the Salesforce opportunity popup in the same app. The two
features touch different parts of SalesPage, so only the README heading and
the appended test blocks conflicted, and both sides are kept.

The shared fixture now carries PM-6364's stage, amount and date columns, which
the opportunity tests tolerate because they override rows with their own cells
and none of the added values match the 006 opportunity key prefix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jmgasper
jmgasper merged commit 34806a9 into dev Sep 17, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant