From 2f6afc7d09ac9297d78c729e8abfd69907a721c1 Mon Sep 17 00:00:00 2001 From: "Joseph T. French" Date: Sat, 3 Oct 2026 18:57:44 -0500 Subject: [PATCH] feat(close): settle changed transactions in the Closing Book A transaction that changed at the source after it was posted holds the close, and until now the app could only say so. The Closing Book gains a Changed transactions panel beside Reconciliations: each change shows what was posted against what the source says now, with the difference by account, and is settled as a restate, a catch-up or marked as handled. - A treatment the ledger would refuse is disabled with the reason, and marking a change as handled requires a note. - A change settled elsewhere drops off the list; one that changed again mid-review is shown again with its newer figures. - The close blocker on the period hub links to the panel and says how many changes hold this close. --- .../ChangedTransactionsPanel.test.tsx | 491 ++++++++++++++ .../close/__tests__/PeriodClosePanel.test.tsx | 33 + .../close/__tests__/StructureSidebar.test.tsx | 46 ++ .../ledger/close/__tests__/content.test.tsx | 105 ++- .../components/ChangedTransactionsPanel.tsx | 642 ++++++++++++++++++ .../close/components/PeriodClosePanel.tsx | 28 +- .../close/components/StructureSidebar.tsx | 5 + src/app/(app)/ledger/close/content.tsx | 51 +- 8 files changed, 1392 insertions(+), 9 deletions(-) create mode 100644 src/app/(app)/ledger/close/__tests__/ChangedTransactionsPanel.test.tsx create mode 100644 src/app/(app)/ledger/close/components/ChangedTransactionsPanel.tsx diff --git a/src/app/(app)/ledger/close/__tests__/ChangedTransactionsPanel.test.tsx b/src/app/(app)/ledger/close/__tests__/ChangedTransactionsPanel.test.tsx new file mode 100644 index 00000000..0ff64593 --- /dev/null +++ b/src/app/(app)/ledger/close/__tests__/ChangedTransactionsPanel.test.tsx @@ -0,0 +1,491 @@ +import { fireEvent, render, screen, waitFor } from '@testing-library/react' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mockListEventBlocks = vi.fn() +const mockPreviewReconcilingItem = vi.fn() +const mockResolveReconcilingItem = vi.fn() + +vi.mock('@robosystems/core', () => ({ + clients: { + ledger: { + listEventBlocks: (...args: any[]) => mockListEventBlocks(...args), + previewReconcilingItem: (...args: any[]) => + mockPreviewReconcilingItem(...args), + resolveReconcilingItem: (...args: any[]) => + mockResolveReconcilingItem(...args), + }, + }, + LoadingState: () => ( +
+ Loading +
+ ), +})) + +vi.mock('flowbite-react', () => ({ + Button: ({ children, onClick, disabled }: any) => ( + + ), + Label: ({ children, htmlFor }: any) => ( + + ), + Spinner: () => , + Table: ({ children }: any) => {children}
, + TableBody: ({ children }: any) => {children}, + TableCell: ({ children }: any) => {children}, + TableHead: ({ children }: any) => {children}, + TableHeadCell: ({ children }: any) => {children}, + TableRow: ({ children }: any) => {children}, + Textarea: ({ value, onChange, id }: any) => ( +