@accounter/client 0.0.8-alpha-20251029094652-37d24ebe6304860cfa001b18424cc588dbcf064d → 0.0.8-alpha-20251029111239-192c5afd2d66a4d11ea8217039b86666b6fff216
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/assets/{Checkbox-CSPHEKoR.js → Checkbox-BfB2aYmM.js} +2 -2
- package/dist/assets/{MultiSelect-CszuVk07.js → MultiSelect-CGvaXcuH.js} +1 -1
- package/dist/assets/{Pagination-Cp6iKPSu.js → Pagination-D4fkmYTl.js} +1 -1
- package/dist/assets/{Progress-ByaKYSXX.js → Progress-CQs7EuQ2.js} +1 -1
- package/dist/assets/{Table-CQ4GTcIY.js → Table-C2EjuqpH.js} +1 -1
- package/dist/assets/{Typography-Cn08y9HC.js → Typography-bz4ZX5sI.js} +1 -1
- package/dist/assets/{YearPickerInput-BsQymTcP.js → YearPickerInput-CURoIYu6.js} +1 -1
- package/dist/assets/{accordion-CG93-Cqs.js → accordion-DWmBRtUi.js} +1 -1
- package/dist/assets/{accountant-approvals-Dxy1hGw7.js → accountant-approvals-C9FCfRoL.js} +1 -1
- package/dist/assets/{accounter-table-Dgvw-xm_.js → accounter-table-C70NKDaW.js} +1 -1
- package/dist/assets/{addDays-Di-hbHs3.js → addDays-BGYF7FkS.js} +1 -1
- package/dist/assets/{all-charges-DRl4EcMG.js → all-charges-CkPb7TjD.js} +1 -1
- package/dist/assets/{arrow-up-down-Hh3TlLSU.js → arrow-up-down-B-KqfJyD.js} +1 -1
- package/dist/assets/{building-2-DGfYgfU_.js → building-2-BAwr8r-2.js} +1 -1
- package/dist/assets/{business-aamFaOhr.js → business-DLu0ofgu.js} +17 -7
- package/dist/assets/business-extended-info-vAiMQKwm.js +13 -0
- package/dist/assets/{business-header-BphijNiC.js → business-header-B_qcrJW_.js} +1 -1
- package/dist/assets/business-ledger-filters-CNjRVS0K.js +1 -0
- package/dist/assets/business-ledger-single-BrattJvc.js +1 -0
- package/dist/assets/business-trip-DZqft86E.js +1 -0
- package/dist/assets/{charge-D-99eJ1v.js → charge-aBSxCGi3.js} +1 -1
- package/dist/assets/{charges-filters-Dxaf2lVd.js → charges-filters-BRuJ3XbB.js} +1 -1
- package/dist/assets/{charges-ledger-validation-BAY3PYth.js → charges-ledger-validation-DjuvGES2.js} +1 -1
- package/dist/assets/charges-table--gOKotyF.js +62 -0
- package/dist/assets/{chart-DM5P1yGj.js → chart-BSh0rsm7.js} +1 -1
- package/dist/assets/{data-table-pagination-TG7sqb1-.js → data-table-pagination-BCuaIseR.js} +1 -1
- package/dist/assets/download-csv-button-B0eh9bzg.js +1 -0
- package/dist/assets/{editable-business-trip-DlAsZ0aQ.js → editable-business-trip-BLWzKbN3.js} +1 -1
- package/dist/assets/{funnel-BQEGwl1q.js → funnel-XiON1wPY.js} +1 -1
- package/dist/assets/{index-CJEUQmMx.js → index-3Fyx3NBp.js} +1 -1
- package/dist/assets/{index-CIY9x3TF.js → index-B05N38w4.js} +2 -2
- package/dist/assets/{index-DkKTDpFK.js → index-BPLQ_Cjg.js} +1 -1
- package/dist/assets/index-BS5IhG6A.js +1 -0
- package/dist/assets/{index-CzEcZ0Dn.js → index-BVTpNGNk.js} +2 -2
- package/dist/assets/{index-DKjsW6q7.js → index-BYCdqffp.js} +7 -7
- package/dist/assets/{index-BmZql10x.js → index-BdnLryTF.js} +14 -14
- package/dist/assets/{index-CGQclWiq.js → index-BdzdEbUC.js} +1 -1
- package/dist/assets/{index-CXRSu47J.js → index-BwrF7ixX.js} +2 -2
- package/dist/assets/{index-DgbPiRkF.js → index-By2sHbGk.js} +1 -1
- package/dist/assets/{index-ClzPFBOc.js → index-C-RIsd1H.js} +2 -2
- package/dist/assets/{index-NofRnQ8o.js → index-CA6LHUxs.js} +1 -1
- package/dist/assets/{index-CkIv3Veq.js → index-CJP0f2Bm.js} +1 -1
- package/dist/assets/{index-IuUe41KG.js → index-CVNgfFi3.js} +1 -1
- package/dist/assets/{index-Dt4KpoN0.js → index-C_nLGgCr.js} +1 -1
- package/dist/assets/index-Ci8Rcu9T.js +1 -0
- package/dist/assets/{index-CFY-4iKE.js → index-CtDDVAsw.js} +1 -1
- package/dist/assets/{index-DROHY2Kd.js → index-CxE91GPE.js} +1 -1
- package/dist/assets/{index--OgMtW-2.js → index-D7GKOJU4.js} +2 -2
- package/dist/assets/{index-CiXTFJcq.js → index-D9RA6cVt.js} +2 -2
- package/dist/assets/{index-DnFwBDCa.js → index-DOSLXKPY.js} +1 -1
- package/dist/assets/{index-WaN-m0WB.js → index-DaSx2wiU.js} +1 -1
- package/dist/assets/{index-DOh5XsM3.js → index-DbbPcdZ7.js} +2 -2
- package/dist/assets/{index-D9zE4pLO.js → index-Diqx01g3.js} +1 -1
- package/dist/assets/{index-juMfNCjV.js → index-pjJUDHWQ.js} +1 -1
- package/dist/assets/{index.es-BJEu0vdb.js → index.es-BWSz-k0E.js} +1 -1
- package/dist/assets/{insert-business-trip-modal-CXgUJdgl.js → insert-business-trip-modal-Bk-kugZI.js} +2 -2
- package/dist/assets/issue-document-BcWeUsrG.js +1 -0
- package/dist/assets/{list-plus-BlHtPDEN.js → list-plus-DINtfnSi.js} +1 -1
- package/dist/assets/{login-page-DmCLAM1G.js → login-page-DVwxXAvd.js} +1 -1
- package/dist/assets/{match-document-modal-KjnSxB69.js → match-document-modal--iAusdTp.js} +4 -4
- package/dist/assets/{missing-info-charges-BiEeQwER.js → missing-info-charges-CQNTClQ3.js} +1 -1
- package/dist/assets/{modal-dLkQjDNz.js → modal-BzwJJ2TM.js} +1 -1
- package/dist/assets/{page-layout-DxGYaCiw.js → page-layout-NF77oib6.js} +1 -1
- package/dist/assets/{page-not-found-ChLEFKCs.js → page-not-found-Cu_0zp5u.js} +1 -1
- package/dist/assets/{panel-top-open-CWsfFRNu.js → panel-top-open-BApXXBMD.js} +1 -1
- package/dist/assets/{pencil-BEefjySD.js → pencil-CLaFsm6E.js} +1 -1
- package/dist/assets/{report-commentary-row-Cci0ntye.js → report-commentary-row-BGN_tI-P.js} +1 -1
- package/dist/assets/{save-BkV97OA1.js → save-DsE11_Et.js} +1 -1
- package/dist/assets/{similar-transactions-modal-8T9lL2yX.js → similar-transactions-modal-CoZU6FU3.js} +1 -1
- package/dist/assets/sub-DLRNYZyc.js +1 -0
- package/dist/assets/subMonths-Bc9skHhr.js +1 -0
- package/dist/assets/{summary-DzLJ6sUY.js → summary-BasZ3QlN.js} +1 -1
- package/dist/assets/{toggle-expansion-button-BzVlE1kb.js → toggle-expansion-button-DPcDIe-2.js} +1 -1
- package/dist/assets/tooltip-CICdw5IX.js +1 -0
- package/dist/assets/{use-url-query-DV9K0FAR.js → use-url-query-Bp_LkJaa.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/business/balance-section.tsx +26 -0
- package/src/components/business/index.tsx +31 -1
- package/src/components/business/ledger-section.tsx +49 -0
- package/src/components/business/transactions-section.tsx +24 -2
- package/src/components/{business-transactions → business-ledger}/business-extended-info.tsx +25 -27
- package/src/components/{business-transactions/business-transactions-filters.tsx → business-ledger/business-ledger-filters.tsx} +12 -12
- package/src/components/{business-transactions/business-transactions-single.tsx → business-ledger/business-ledger-single.tsx} +13 -13
- package/src/components/{business-transactions → business-ledger}/download-csv.tsx +25 -25
- package/src/components/{business-transactions → business-ledger}/index.tsx +15 -15
- package/src/components/charges/charge-extended-info.tsx +45 -4
- package/src/components/layout/sidelinks.tsx +2 -2
- package/src/components/ledger-table/columns.tsx +4 -4
- package/src/components/ledger-table/index.tsx +152 -181
- package/src/components/reports/conto/custom-node.tsx +1 -1
- package/src/components/reports/trial-balance-report/trial-balance-report-account.tsx +1 -1
- package/src/components/transactions-table/columns.tsx +9 -9
- package/src/components/transactions-table/index.tsx +56 -21
- package/src/gql/gql.ts +30 -12
- package/src/gql/graphql.ts +181 -406
- package/src/router/config.tsx +14 -14
- package/src/router/routes.ts +2 -2
- package/dist/assets/business-extended-info-CeEMIazB.js +0 -13
- package/dist/assets/business-transactions-filters-DYBvDjKs.js +0 -1
- package/dist/assets/business-transactions-single-B77wu9sA.js +0 -1
- package/dist/assets/business-trip-C1cYIMHX.js +0 -1
- package/dist/assets/charges-table-CNWVDMmv.js +0 -62
- package/dist/assets/download-csv-button-jQXIlRax.js +0 -1
- package/dist/assets/index-B-USUC2v.js +0 -1
- package/dist/assets/index-BYfofaiM.js +0 -1
- package/dist/assets/issue-document-BSkWYnI5.js +0 -1
- package/dist/assets/sub-DdivcKGZ.js +0 -1
- package/dist/assets/subMonths-Kz3NJUOL.js +0 -1
- package/dist/assets/tooltip-Ht3m2Q26.js +0 -1
- package/src/app.tsx +0 -108
|
@@ -2,151 +2,81 @@ import { useMemo, useState, type ReactElement } from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
flexRender,
|
|
4
4
|
getCoreRowModel,
|
|
5
|
+
getPaginationRowModel,
|
|
5
6
|
getSortedRowModel,
|
|
6
7
|
useReactTable,
|
|
7
8
|
type SortingState,
|
|
8
9
|
} from '@tanstack/react-table';
|
|
9
10
|
import {
|
|
10
|
-
|
|
11
|
-
type
|
|
11
|
+
LedgerRecordsTableFieldsFragmentDoc,
|
|
12
|
+
type LedgerRecordsTableFieldsFragment,
|
|
12
13
|
} from '../../gql/graphql.js';
|
|
13
14
|
import { getFragmentData, type FragmentType } from '../../gql/index.js';
|
|
14
15
|
import { EMPTY_UUID } from '../../helpers/consts.js';
|
|
16
|
+
import { Button } from '../ui/button.js';
|
|
15
17
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../ui/table.js';
|
|
16
18
|
import { columns } from './columns.js';
|
|
17
19
|
|
|
18
20
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
|
|
19
21
|
/* GraphQL */ `
|
|
20
|
-
fragment
|
|
22
|
+
fragment LedgerRecordsTableFields on LedgerRecord {
|
|
21
23
|
id
|
|
22
|
-
|
|
24
|
+
creditAccount1 {
|
|
23
25
|
__typename
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
creditAccount1 {
|
|
27
|
-
__typename
|
|
28
|
-
id
|
|
29
|
-
name
|
|
30
|
-
}
|
|
31
|
-
creditAccount2 {
|
|
32
|
-
__typename
|
|
33
|
-
id
|
|
34
|
-
name
|
|
35
|
-
}
|
|
36
|
-
debitAccount1 {
|
|
37
|
-
__typename
|
|
38
|
-
id
|
|
39
|
-
name
|
|
40
|
-
}
|
|
41
|
-
debitAccount2 {
|
|
42
|
-
__typename
|
|
43
|
-
id
|
|
44
|
-
name
|
|
45
|
-
}
|
|
46
|
-
creditAmount1 {
|
|
47
|
-
formatted
|
|
48
|
-
currency
|
|
49
|
-
}
|
|
50
|
-
creditAmount2 {
|
|
51
|
-
formatted
|
|
52
|
-
currency
|
|
53
|
-
}
|
|
54
|
-
debitAmount1 {
|
|
55
|
-
formatted
|
|
56
|
-
currency
|
|
57
|
-
}
|
|
58
|
-
debitAmount2 {
|
|
59
|
-
formatted
|
|
60
|
-
currency
|
|
61
|
-
}
|
|
62
|
-
localCurrencyCreditAmount1 {
|
|
63
|
-
formatted
|
|
64
|
-
raw
|
|
65
|
-
}
|
|
66
|
-
localCurrencyCreditAmount2 {
|
|
67
|
-
formatted
|
|
68
|
-
raw
|
|
69
|
-
}
|
|
70
|
-
localCurrencyDebitAmount1 {
|
|
71
|
-
formatted
|
|
72
|
-
raw
|
|
73
|
-
}
|
|
74
|
-
localCurrencyDebitAmount2 {
|
|
75
|
-
formatted
|
|
76
|
-
raw
|
|
77
|
-
}
|
|
78
|
-
invoiceDate
|
|
79
|
-
valueDate
|
|
80
|
-
description
|
|
81
|
-
reference
|
|
82
|
-
}
|
|
83
|
-
... on Ledger @defer {
|
|
84
|
-
validate {
|
|
85
|
-
... on LedgerValidation @defer {
|
|
86
|
-
matches
|
|
87
|
-
differences {
|
|
88
|
-
id
|
|
89
|
-
creditAccount1 {
|
|
90
|
-
__typename
|
|
91
|
-
id
|
|
92
|
-
name
|
|
93
|
-
}
|
|
94
|
-
creditAccount2 {
|
|
95
|
-
__typename
|
|
96
|
-
id
|
|
97
|
-
name
|
|
98
|
-
}
|
|
99
|
-
debitAccount1 {
|
|
100
|
-
__typename
|
|
101
|
-
id
|
|
102
|
-
name
|
|
103
|
-
}
|
|
104
|
-
debitAccount2 {
|
|
105
|
-
__typename
|
|
106
|
-
id
|
|
107
|
-
name
|
|
108
|
-
}
|
|
109
|
-
creditAmount1 {
|
|
110
|
-
formatted
|
|
111
|
-
currency
|
|
112
|
-
}
|
|
113
|
-
creditAmount2 {
|
|
114
|
-
formatted
|
|
115
|
-
currency
|
|
116
|
-
}
|
|
117
|
-
debitAmount1 {
|
|
118
|
-
formatted
|
|
119
|
-
currency
|
|
120
|
-
}
|
|
121
|
-
debitAmount2 {
|
|
122
|
-
formatted
|
|
123
|
-
currency
|
|
124
|
-
}
|
|
125
|
-
localCurrencyCreditAmount1 {
|
|
126
|
-
formatted
|
|
127
|
-
raw
|
|
128
|
-
}
|
|
129
|
-
localCurrencyCreditAmount2 {
|
|
130
|
-
formatted
|
|
131
|
-
raw
|
|
132
|
-
}
|
|
133
|
-
localCurrencyDebitAmount1 {
|
|
134
|
-
formatted
|
|
135
|
-
raw
|
|
136
|
-
}
|
|
137
|
-
localCurrencyDebitAmount2 {
|
|
138
|
-
formatted
|
|
139
|
-
raw
|
|
140
|
-
}
|
|
141
|
-
invoiceDate
|
|
142
|
-
valueDate
|
|
143
|
-
description
|
|
144
|
-
reference
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
26
|
+
id
|
|
27
|
+
name
|
|
149
28
|
}
|
|
29
|
+
creditAccount2 {
|
|
30
|
+
__typename
|
|
31
|
+
id
|
|
32
|
+
name
|
|
33
|
+
}
|
|
34
|
+
debitAccount1 {
|
|
35
|
+
__typename
|
|
36
|
+
id
|
|
37
|
+
name
|
|
38
|
+
}
|
|
39
|
+
debitAccount2 {
|
|
40
|
+
__typename
|
|
41
|
+
id
|
|
42
|
+
name
|
|
43
|
+
}
|
|
44
|
+
creditAmount1 {
|
|
45
|
+
formatted
|
|
46
|
+
currency
|
|
47
|
+
}
|
|
48
|
+
creditAmount2 {
|
|
49
|
+
formatted
|
|
50
|
+
currency
|
|
51
|
+
}
|
|
52
|
+
debitAmount1 {
|
|
53
|
+
formatted
|
|
54
|
+
currency
|
|
55
|
+
}
|
|
56
|
+
debitAmount2 {
|
|
57
|
+
formatted
|
|
58
|
+
currency
|
|
59
|
+
}
|
|
60
|
+
localCurrencyCreditAmount1 {
|
|
61
|
+
formatted
|
|
62
|
+
raw
|
|
63
|
+
}
|
|
64
|
+
localCurrencyCreditAmount2 {
|
|
65
|
+
formatted
|
|
66
|
+
raw
|
|
67
|
+
}
|
|
68
|
+
localCurrencyDebitAmount1 {
|
|
69
|
+
formatted
|
|
70
|
+
raw
|
|
71
|
+
}
|
|
72
|
+
localCurrencyDebitAmount2 {
|
|
73
|
+
formatted
|
|
74
|
+
raw
|
|
75
|
+
}
|
|
76
|
+
invoiceDate
|
|
77
|
+
valueDate
|
|
78
|
+
description
|
|
79
|
+
reference
|
|
150
80
|
}
|
|
151
81
|
`;
|
|
152
82
|
|
|
@@ -166,43 +96,51 @@ function getRowColorByStatus(status?: 'New' | 'Diff' | 'Deleted'): string {
|
|
|
166
96
|
return rowStyle;
|
|
167
97
|
}
|
|
168
98
|
|
|
169
|
-
export type LedgerRecordRow =
|
|
99
|
+
export type LedgerRecordRow = LedgerRecordsTableFieldsFragment & {
|
|
170
100
|
matchingStatus?: 'New' | 'Diff' | 'Deleted';
|
|
171
|
-
diff?:
|
|
101
|
+
diff?: LedgerRecordsTableFieldsFragment;
|
|
172
102
|
};
|
|
173
103
|
|
|
174
104
|
type Props = {
|
|
175
|
-
|
|
105
|
+
ledgerRecordsData: FragmentType<typeof LedgerRecordsTableFieldsFragmentDoc>[];
|
|
106
|
+
ledgerDiffData?: FragmentType<typeof LedgerRecordsTableFieldsFragmentDoc>[];
|
|
107
|
+
matches?: string[];
|
|
176
108
|
};
|
|
177
109
|
|
|
178
|
-
export const LedgerTable = ({
|
|
179
|
-
|
|
110
|
+
export const LedgerTable = ({
|
|
111
|
+
ledgerRecordsData,
|
|
112
|
+
ledgerDiffData,
|
|
113
|
+
matches,
|
|
114
|
+
}: Props): ReactElement => {
|
|
180
115
|
const [sorting, setSorting] = useState<SortingState>([]);
|
|
181
116
|
|
|
182
117
|
const data = useMemo(() => {
|
|
183
|
-
const records
|
|
184
|
-
|
|
118
|
+
const records = ledgerRecordsData.map(recordData =>
|
|
119
|
+
getFragmentData(LedgerRecordsTableFieldsFragmentDoc, recordData),
|
|
120
|
+
);
|
|
121
|
+
const differences = ledgerDiffData?.map(recordData =>
|
|
122
|
+
getFragmentData(LedgerRecordsTableFieldsFragmentDoc, recordData),
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const currentRecords: LedgerRecordRow[] = records.map(record => {
|
|
126
|
+
const diff = differences?.find(diffRecord => diffRecord.id === record.id);
|
|
185
127
|
return {
|
|
186
128
|
...record,
|
|
187
129
|
matchingStatus:
|
|
188
|
-
!
|
|
189
|
-
? undefined
|
|
190
|
-
: diff
|
|
191
|
-
? 'Diff'
|
|
192
|
-
: 'Deleted',
|
|
130
|
+
!matches || matches?.includes(record.id) ? undefined : diff ? 'Diff' : 'Deleted',
|
|
193
131
|
diff,
|
|
194
132
|
};
|
|
195
133
|
});
|
|
196
134
|
const newRecords: LedgerRecordRow[] =
|
|
197
|
-
|
|
135
|
+
differences
|
|
198
136
|
?.filter(record => record.id === EMPTY_UUID)
|
|
199
137
|
.map(record => ({
|
|
200
138
|
...record,
|
|
201
139
|
matchingStatus: 'New',
|
|
202
140
|
})) ?? [];
|
|
203
|
-
|
|
204
|
-
return
|
|
205
|
-
}, [
|
|
141
|
+
currentRecords.push(...newRecords);
|
|
142
|
+
return currentRecords;
|
|
143
|
+
}, [ledgerRecordsData, ledgerDiffData, matches]);
|
|
206
144
|
|
|
207
145
|
const table = useReactTable({
|
|
208
146
|
data,
|
|
@@ -210,49 +148,82 @@ export const LedgerTable = ({ ledgerFragment }: Props): ReactElement => {
|
|
|
210
148
|
getCoreRowModel: getCoreRowModel(),
|
|
211
149
|
onSortingChange: setSorting,
|
|
212
150
|
getSortedRowModel: getSortedRowModel(),
|
|
151
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
213
152
|
state: {
|
|
214
153
|
sorting,
|
|
215
154
|
},
|
|
155
|
+
initialState: {
|
|
156
|
+
pagination: {
|
|
157
|
+
pageIndex: 0,
|
|
158
|
+
pageSize: 10,
|
|
159
|
+
},
|
|
160
|
+
sorting: [
|
|
161
|
+
{
|
|
162
|
+
id: 'invoiceDate',
|
|
163
|
+
desc: true,
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
},
|
|
216
167
|
});
|
|
217
168
|
|
|
218
169
|
return (
|
|
219
|
-
|
|
220
|
-
<
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
{headerGroup.
|
|
224
|
-
|
|
225
|
-
{header.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
</TableRow>
|
|
231
|
-
))}
|
|
232
|
-
</TableHeader>
|
|
233
|
-
<TableBody>
|
|
234
|
-
{table.getRowModel().rows?.length ? (
|
|
235
|
-
table.getRowModel().rows.map(row => (
|
|
236
|
-
<TableRow
|
|
237
|
-
key={row.id}
|
|
238
|
-
data-state={row.getIsSelected() && 'selected'}
|
|
239
|
-
className={getRowColorByStatus(row.original.matchingStatus)}
|
|
240
|
-
>
|
|
241
|
-
{row.getVisibleCells().map(cell => (
|
|
242
|
-
<TableCell key={cell.id}>
|
|
243
|
-
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
244
|
-
</TableCell>
|
|
170
|
+
<>
|
|
171
|
+
<Table>
|
|
172
|
+
<TableHeader>
|
|
173
|
+
{table.getHeaderGroups().map(headerGroup => (
|
|
174
|
+
<TableRow key={headerGroup.id}>
|
|
175
|
+
{headerGroup.headers.map(header => (
|
|
176
|
+
<TableHead className="text-center" key={header.id} colSpan={header.colSpan}>
|
|
177
|
+
{header.isPlaceholder
|
|
178
|
+
? null
|
|
179
|
+
: flexRender(header.column.columnDef.header, header.getContext())}
|
|
180
|
+
</TableHead>
|
|
245
181
|
))}
|
|
246
182
|
</TableRow>
|
|
247
|
-
))
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
183
|
+
))}
|
|
184
|
+
</TableHeader>
|
|
185
|
+
<TableBody>
|
|
186
|
+
{table.getRowModel().rows?.length ? (
|
|
187
|
+
table.getRowModel().rows.map(row => (
|
|
188
|
+
<TableRow
|
|
189
|
+
key={row.id}
|
|
190
|
+
data-state={row.getIsSelected() && 'selected'}
|
|
191
|
+
className={getRowColorByStatus(row.original.matchingStatus)}
|
|
192
|
+
>
|
|
193
|
+
{row.getVisibleCells().map(cell => (
|
|
194
|
+
<TableCell key={cell.id}>
|
|
195
|
+
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
196
|
+
</TableCell>
|
|
197
|
+
))}
|
|
198
|
+
</TableRow>
|
|
199
|
+
))
|
|
200
|
+
) : (
|
|
201
|
+
<TableRow>
|
|
202
|
+
<TableCell colSpan={columns.length} className="h-24 text-center">
|
|
203
|
+
No results.
|
|
204
|
+
</TableCell>
|
|
205
|
+
</TableRow>
|
|
206
|
+
)}
|
|
207
|
+
</TableBody>
|
|
208
|
+
</Table>
|
|
209
|
+
<div className="flex items-center justify-end space-x-2 py-4">
|
|
210
|
+
<Button
|
|
211
|
+
variant="outline"
|
|
212
|
+
size="sm"
|
|
213
|
+
onClick={() => table.previousPage()}
|
|
214
|
+
disabled={!table.getCanPreviousPage()}
|
|
215
|
+
>
|
|
216
|
+
Previous
|
|
217
|
+
</Button>
|
|
218
|
+
<Button
|
|
219
|
+
variant="outline"
|
|
220
|
+
size="sm"
|
|
221
|
+
onClick={() => table.nextPage()}
|
|
222
|
+
disabled={!table.getCanNextPage()}
|
|
223
|
+
>
|
|
224
|
+
Next
|
|
225
|
+
</Button>
|
|
226
|
+
</div>
|
|
227
|
+
</>
|
|
257
228
|
);
|
|
258
229
|
};
|
|
@@ -13,7 +13,7 @@ import IconButton from '@mui/material/IconButton';
|
|
|
13
13
|
import Typography from '@mui/material/Typography';
|
|
14
14
|
import { Currency } from '../../../gql/graphql.js';
|
|
15
15
|
import { getCurrencyFormatter } from '../../../helpers/index.js';
|
|
16
|
-
import { BusinessExtendedInfo } from '../../business-
|
|
16
|
+
import { BusinessExtendedInfo } from '../../business-ledger/business-extended-info.js';
|
|
17
17
|
import { Tooltip } from '../../common/index.js';
|
|
18
18
|
import { Badge } from '../../ui/badge.js';
|
|
19
19
|
import { Button } from '../../ui/button.js';
|
|
@@ -2,7 +2,7 @@ import { useState, type ReactElement } from 'react';
|
|
|
2
2
|
import { PanelTopClose, PanelTopOpen } from 'lucide-react';
|
|
3
3
|
import { Text, Tooltip } from '@mantine/core';
|
|
4
4
|
import type { TrialBalanceTableFieldsFragment } from '../../../gql/graphql.js';
|
|
5
|
-
import { BusinessExtendedInfo } from '../../business-
|
|
5
|
+
import { BusinessExtendedInfo } from '../../business-ledger/business-extended-info.js';
|
|
6
6
|
import { Button } from '../../ui/button.js';
|
|
7
7
|
import { TrialBalanceReportFilters } from './trial-balance-report-filters.js';
|
|
8
8
|
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
|
|
52
52
|
export type TransactionsTableRowType = TransactionForTransactionsTableFieldsFragment & {
|
|
53
53
|
onUpdate: () => void;
|
|
54
|
-
editTransaction: () => void;
|
|
54
|
+
editTransaction: (id: string) => void;
|
|
55
55
|
enableEdit?: boolean;
|
|
56
56
|
enableChargeLink?: boolean;
|
|
57
57
|
};
|
|
@@ -63,7 +63,7 @@ export const columns: ColumnDef<TransactionsTableRowType>[] = [
|
|
|
63
63
|
return (
|
|
64
64
|
<Button
|
|
65
65
|
variant="ghost"
|
|
66
|
-
|
|
66
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
|
67
67
|
>
|
|
68
68
|
Counterparty
|
|
69
69
|
{column.getIsSorted() &&
|
|
@@ -90,7 +90,7 @@ export const columns: ColumnDef<TransactionsTableRowType>[] = [
|
|
|
90
90
|
return (
|
|
91
91
|
<Button
|
|
92
92
|
variant="ghost"
|
|
93
|
-
|
|
93
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
|
94
94
|
>
|
|
95
95
|
Event Date
|
|
96
96
|
{column.getIsSorted() &&
|
|
@@ -117,7 +117,7 @@ export const columns: ColumnDef<TransactionsTableRowType>[] = [
|
|
|
117
117
|
return (
|
|
118
118
|
<Button
|
|
119
119
|
variant="ghost"
|
|
120
|
-
|
|
120
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
|
121
121
|
>
|
|
122
122
|
Debit Date
|
|
123
123
|
{column.getIsSorted() &&
|
|
@@ -139,7 +139,7 @@ export const columns: ColumnDef<TransactionsTableRowType>[] = [
|
|
|
139
139
|
return (
|
|
140
140
|
<Button
|
|
141
141
|
variant="ghost"
|
|
142
|
-
|
|
142
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
|
143
143
|
>
|
|
144
144
|
Amount
|
|
145
145
|
{column.getIsSorted() &&
|
|
@@ -161,7 +161,7 @@ export const columns: ColumnDef<TransactionsTableRowType>[] = [
|
|
|
161
161
|
return (
|
|
162
162
|
<Button
|
|
163
163
|
variant="ghost"
|
|
164
|
-
|
|
164
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
|
165
165
|
>
|
|
166
166
|
Account
|
|
167
167
|
{column.getIsSorted() &&
|
|
@@ -183,7 +183,7 @@ export const columns: ColumnDef<TransactionsTableRowType>[] = [
|
|
|
183
183
|
return (
|
|
184
184
|
<Button
|
|
185
185
|
variant="ghost"
|
|
186
|
-
|
|
186
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
|
187
187
|
>
|
|
188
188
|
Description
|
|
189
189
|
{column.getIsSorted() &&
|
|
@@ -205,7 +205,7 @@ export const columns: ColumnDef<TransactionsTableRowType>[] = [
|
|
|
205
205
|
return (
|
|
206
206
|
<Button
|
|
207
207
|
variant="ghost"
|
|
208
|
-
|
|
208
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
|
209
209
|
>
|
|
210
210
|
Reference#
|
|
211
211
|
{column.getIsSorted() &&
|
|
@@ -230,7 +230,7 @@ export const actionsColumn: ColumnDef<TransactionsTableRowType> = {
|
|
|
230
230
|
if (row.original.enableEdit) {
|
|
231
231
|
return (
|
|
232
232
|
<>
|
|
233
|
-
<EditMiniButton onClick={row.original.editTransaction} />
|
|
233
|
+
<EditMiniButton onClick={() => row.original.editTransaction(row.original.id)} />
|
|
234
234
|
<InsertMiscExpenseModal
|
|
235
235
|
chargeId={row.original.chargeId}
|
|
236
236
|
transactionId={row.original.id}
|
|
@@ -2,6 +2,7 @@ import { useMemo, useState, type ReactElement } from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
flexRender,
|
|
4
4
|
getCoreRowModel,
|
|
5
|
+
getPaginationRowModel,
|
|
5
6
|
getSortedRowModel,
|
|
6
7
|
useReactTable,
|
|
7
8
|
type SortingState,
|
|
@@ -9,6 +10,7 @@ import {
|
|
|
9
10
|
import { TransactionForTransactionsTableFieldsFragmentDoc } from '../../gql/graphql.js';
|
|
10
11
|
import { getFragmentData, type FragmentType } from '../../gql/index.js';
|
|
11
12
|
import { EditTransactionModal } from '../common/index.js';
|
|
13
|
+
import { Button } from '../ui/button.js';
|
|
12
14
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../ui/table.js';
|
|
13
15
|
import { actionsColumn, columns, type TransactionsTableRowType } from './columns.js';
|
|
14
16
|
|
|
@@ -21,37 +23,37 @@ type Props = {
|
|
|
21
23
|
|
|
22
24
|
export const TransactionsTable = ({
|
|
23
25
|
transactionsProps,
|
|
24
|
-
onChange
|
|
26
|
+
onChange,
|
|
25
27
|
enableEdit,
|
|
26
28
|
enableChargeLink,
|
|
27
29
|
}: Props): ReactElement => {
|
|
28
30
|
const [editTransactionId, setEditTransactionId] = useState<string | undefined>(undefined);
|
|
29
31
|
const [sorting, setSorting] = useState<SortingState>([]);
|
|
30
32
|
|
|
31
|
-
const transactions = useMemo(
|
|
32
|
-
()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
33
|
+
const transactions = useMemo(() => {
|
|
34
|
+
console.log('rendering Transactions');
|
|
35
|
+
return transactionsProps.map(rawTransaction => {
|
|
36
|
+
return getFragmentData(TransactionForTransactionsTableFieldsFragmentDoc, rawTransaction);
|
|
37
|
+
});
|
|
38
|
+
}, [transactionsProps]);
|
|
38
39
|
|
|
39
|
-
const data: TransactionsTableRowType[] = useMemo(
|
|
40
|
-
()
|
|
41
|
-
|
|
40
|
+
const data: TransactionsTableRowType[] = useMemo(() => {
|
|
41
|
+
console.log('rendering TransactionsTable data');
|
|
42
|
+
return transactions.map(transaction => {
|
|
43
|
+
return {
|
|
42
44
|
...transaction,
|
|
43
|
-
editTransaction:
|
|
44
|
-
onUpdate: onChange,
|
|
45
|
+
editTransaction: setEditTransactionId,
|
|
46
|
+
onUpdate: onChange || (() => {}),
|
|
45
47
|
enableEdit,
|
|
46
48
|
enableChargeLink,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
);
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}, [transactions, enableEdit, enableChargeLink, onChange]);
|
|
50
52
|
|
|
51
|
-
const tableColumns = useMemo(
|
|
52
|
-
(
|
|
53
|
-
[
|
|
54
|
-
);
|
|
53
|
+
const tableColumns = useMemo(() => {
|
|
54
|
+
console.log('rendering tableColumns');
|
|
55
|
+
return enableEdit || enableChargeLink ? [...columns, actionsColumn] : columns;
|
|
56
|
+
}, [enableEdit, enableChargeLink]);
|
|
55
57
|
|
|
56
58
|
const table = useReactTable({
|
|
57
59
|
data,
|
|
@@ -59,9 +61,22 @@ export const TransactionsTable = ({
|
|
|
59
61
|
getCoreRowModel: getCoreRowModel(),
|
|
60
62
|
onSortingChange: setSorting,
|
|
61
63
|
getSortedRowModel: getSortedRowModel(),
|
|
64
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
62
65
|
state: {
|
|
63
66
|
sorting,
|
|
64
67
|
},
|
|
68
|
+
initialState: {
|
|
69
|
+
pagination: {
|
|
70
|
+
pageIndex: 0,
|
|
71
|
+
pageSize: 100,
|
|
72
|
+
},
|
|
73
|
+
sorting: [
|
|
74
|
+
{
|
|
75
|
+
id: 'eventDate',
|
|
76
|
+
desc: true,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
65
80
|
});
|
|
66
81
|
|
|
67
82
|
return (
|
|
@@ -102,10 +117,30 @@ export const TransactionsTable = ({
|
|
|
102
117
|
)}
|
|
103
118
|
</TableBody>
|
|
104
119
|
</Table>
|
|
120
|
+
{table.getPageCount() > 1 && (
|
|
121
|
+
<div className="flex items-center justify-end space-x-2 py-4">
|
|
122
|
+
<Button
|
|
123
|
+
variant="outline"
|
|
124
|
+
size="sm"
|
|
125
|
+
onClick={() => table.previousPage()}
|
|
126
|
+
disabled={!table.getCanPreviousPage()}
|
|
127
|
+
>
|
|
128
|
+
Previous
|
|
129
|
+
</Button>
|
|
130
|
+
<Button
|
|
131
|
+
variant="outline"
|
|
132
|
+
size="sm"
|
|
133
|
+
onClick={() => table.nextPage()}
|
|
134
|
+
disabled={!table.getCanNextPage()}
|
|
135
|
+
>
|
|
136
|
+
Next
|
|
137
|
+
</Button>
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
105
140
|
<EditTransactionModal
|
|
106
141
|
transactionID={editTransactionId}
|
|
107
142
|
close={() => setEditTransactionId(undefined)}
|
|
108
|
-
onChange={onChange}
|
|
143
|
+
onChange={onChange ?? (() => {})}
|
|
109
144
|
/>
|
|
110
145
|
</>
|
|
111
146
|
);
|