Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ function RMGroupsPageContent() {
const exportMutation = useExportRMGroups()

const handleExport = () => {
// Export respects the active_filter only (search is UI-level; the backend
// Export RPC intentionally does not accept search params).
exportMutation.mutate({ activeFilter: filters.activeFilter })
// Export honors active_filter + search from the list-page filters.
// Selected-mode (group_head_ids) is exposed via the BFF route for
// programmatic callers; the list page itself doesn't expose multi-select
// export (yet) — Filtered + All cover the bulk-migration workflow.
exportMutation.mutate({
activeFilter: filters.activeFilter,
search: filters.search,
})
}

// Use isFetching (not isLoading) so background refetches triggered on
Expand Down
13 changes: 12 additions & 1 deletion src/app/api/v1/finance/rm-groups/export/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ export async function GET(request: NextRequest) {
const metadata = createMetadataFromRequest(request)
const client = getRmGroupClient()

// Comma-separated list of group_head_id UUIDs for the "Selected" mode.
const idsParam = searchParams.get("group_head_ids") || searchParams.get("groupHeadIds") || ""
const groupHeadIds = idsParam
? idsParam
.split(",")
.map((s) => s.trim())
.filter(Boolean)
: []
const response = await client.exportRMGroups(
{
activeFilter: Number(searchParams.get("activeFilter") || searchParams.get("active_filter")) || 0,
activeFilter:
Number(searchParams.get("activeFilter") || searchParams.get("active_filter")) || 0,
search: searchParams.get("search") || "",
groupHeadIds,
},
metadata
)
Expand Down
6 changes: 6 additions & 0 deletions src/types/finance/rm-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ export interface ListUngroupedItemsParams {

export interface ExportRMGroupsParams {
activeFilter?: ActiveFilter
/** Free-text search across code/name/description (Filtered mode). */
search?: string
/** Explicit group_head_id list (Selected mode). When non-empty overrides
* activeFilter and search at the backend. Sent as `group_head_ids` query
* param (comma-separated UUIDs). */
groupHeadIds?: string[]
}

// Form data for group head create/edit
Expand Down
54 changes: 52 additions & 2 deletions src/types/generated/finance/v1/rm_group.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading