@accounter/client 0.0.8-alpha-20251029111239-192c5afd2d66a4d11ea8217039b86666b6fff216 → 0.0.8-alpha-20251029124448-6b4f8bc975a23de63429b68d0806022dbfc5b226

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.
Files changed (115) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/assets/{Checkbox-BfB2aYmM.js → Checkbox-Ddw01d64.js} +2 -2
  3. package/dist/assets/{MultiSelect-CGvaXcuH.js → MultiSelect-CBtq6WUv.js} +1 -1
  4. package/dist/assets/{Pagination-D4fkmYTl.js → Pagination-BM-86UO5.js} +1 -1
  5. package/dist/assets/{Progress-CQs7EuQ2.js → Progress-Bda-J3ZH.js} +1 -1
  6. package/dist/assets/{Table-C2EjuqpH.js → Table-CYqAEQfS.js} +1 -1
  7. package/dist/assets/{Typography-bz4ZX5sI.js → Typography--U0GsZ21.js} +1 -1
  8. package/dist/assets/{YearPickerInput-CURoIYu6.js → YearPickerInput-CgU-feeq.js} +1 -1
  9. package/dist/assets/{accordion-DWmBRtUi.js → accordion-B8kebokE.js} +1 -1
  10. package/dist/assets/{accountant-approvals-C9FCfRoL.js → accountant-approvals-CUluc3sH.js} +1 -1
  11. package/dist/assets/{accounter-table-C70NKDaW.js → accounter-table-CM6PQ9Aw.js} +1 -1
  12. package/dist/assets/{addDays-BGYF7FkS.js → addDays-DGlDD_vj.js} +1 -1
  13. package/dist/assets/{all-charges-CkPb7TjD.js → all-charges-DpQS6Xp3.js} +1 -1
  14. package/dist/assets/{arrow-up-down-B-KqfJyD.js → arrow-up-down-C61ge4J5.js} +1 -1
  15. package/dist/assets/{building-2-BAwr8r-2.js → building-2-3KauBrnS.js} +1 -1
  16. package/dist/assets/{business-DLu0ofgu.js → business-RCuQN-RO.js} +7 -17
  17. package/dist/assets/business-extended-info-DmQ7B7-Z.js +13 -0
  18. package/dist/assets/{business-header-B_qcrJW_.js → business-header-B-uHcc1D.js} +1 -1
  19. package/dist/assets/business-transactions-filters-D-Y8vZwZ.js +1 -0
  20. package/dist/assets/business-transactions-single-CEE249QN.js +1 -0
  21. package/dist/assets/business-trip-3kCBQ5MD.js +1 -0
  22. package/dist/assets/{charge-aBSxCGi3.js → charge-D19rkm2C.js} +1 -1
  23. package/dist/assets/{charges-filters-BRuJ3XbB.js → charges-filters-BUFmsiTq.js} +1 -1
  24. package/dist/assets/{charges-ledger-validation-DjuvGES2.js → charges-ledger-validation-OPtbHzXu.js} +1 -1
  25. package/dist/assets/charges-table-D_GDHvFS.js +62 -0
  26. package/dist/assets/{chart-BSh0rsm7.js → chart-iyOBgiH0.js} +1 -1
  27. package/dist/assets/{data-table-pagination-BCuaIseR.js → data-table-pagination-CKN0E29f.js} +1 -1
  28. package/dist/assets/download-csv-button-DZ5cKqkV.js +1 -0
  29. package/dist/assets/{editable-business-trip-BLWzKbN3.js → editable-business-trip-CRiuNdbP.js} +1 -1
  30. package/dist/assets/{funnel-XiON1wPY.js → funnel-BlaCusqP.js} +1 -1
  31. package/dist/assets/{index-BdnLryTF.js → index-B2_EbsaK.js} +191 -191
  32. package/dist/assets/index-B8pzYiEH.js +1 -0
  33. package/dist/assets/{index-DOSLXKPY.js → index-BAGVbiiM.js} +1 -1
  34. package/dist/assets/{index-D7GKOJU4.js → index-BD86tRnn.js} +2 -2
  35. package/dist/assets/{index-C_nLGgCr.js → index-BGh0NOfw.js} +1 -1
  36. package/dist/assets/{index-CtDDVAsw.js → index-BKiLhEyi.js} +1 -1
  37. package/dist/assets/{index-D9RA6cVt.js → index-BNAjS3Tn.js} +2 -2
  38. package/dist/assets/{index-DbbPcdZ7.js → index-BRSlJnxd.js} +2 -2
  39. package/dist/assets/{index-CA6LHUxs.js → index-BoL57v1D.js} +1 -1
  40. package/dist/assets/{index-C-RIsd1H.js → index-C2GP2DWO.js} +2 -2
  41. package/dist/assets/{index-CJP0f2Bm.js → index-CM60VmgR.js} +1 -1
  42. package/dist/assets/index-CRLPoT61.js +6 -0
  43. package/dist/assets/index-CRooGu6R.js +1 -0
  44. package/dist/assets/{index-CxE91GPE.js → index-C_OSDuUb.js} +1 -1
  45. package/dist/assets/{index-CVNgfFi3.js → index-Cc7exUI5.js} +1 -1
  46. package/dist/assets/{index-BwrF7ixX.js → index-Co66MgF6.js} +2 -2
  47. package/dist/assets/{index-BPLQ_Cjg.js → index-CyBAoT0l.js} +1 -1
  48. package/dist/assets/{index-BYCdqffp.js → index-D5tmtR-a.js} +7 -7
  49. package/dist/assets/{index-3Fyx3NBp.js → index-DINxWoMX.js} +1 -1
  50. package/dist/assets/{index-BdzdEbUC.js → index-DIiuo0-v.js} +1 -1
  51. package/dist/assets/{index-Diqx01g3.js → index-DtrRL2jA.js} +1 -1
  52. package/dist/assets/{index-BVTpNGNk.js → index-EaY6ZYvr.js} +2 -2
  53. package/dist/assets/{index-DaSx2wiU.js → index-mMqWkzUL.js} +1 -1
  54. package/dist/assets/{index-pjJUDHWQ.js → index-xLWv_qf6.js} +1 -1
  55. package/dist/assets/{index-By2sHbGk.js → index-yOhbO3fy.js} +1 -1
  56. package/dist/assets/{index.es-BWSz-k0E.js → index.es-CaOIcY7v.js} +1 -1
  57. package/dist/assets/{insert-business-trip-modal-Bk-kugZI.js → insert-business-trip-modal-BwOnvw7X.js} +2 -2
  58. package/dist/assets/issue-document-CzBtBCCO.js +1 -0
  59. package/dist/assets/{list-plus-DINtfnSi.js → list-plus-CGvSlslE.js} +1 -1
  60. package/dist/assets/{login-page-DVwxXAvd.js → login-page-BTcklqv4.js} +1 -1
  61. package/dist/assets/{match-document-modal--iAusdTp.js → match-document-modal-DcL0siQq.js} +4 -4
  62. package/dist/assets/{missing-info-charges-CQNTClQ3.js → missing-info-charges-DfwRkzNe.js} +1 -1
  63. package/dist/assets/{modal-BzwJJ2TM.js → modal-B0uNLang.js} +1 -1
  64. package/dist/assets/{page-layout-NF77oib6.js → page-layout-C0GJoVTR.js} +1 -1
  65. package/dist/assets/{page-not-found-Cu_0zp5u.js → page-not-found-9UX5vsGE.js} +1 -1
  66. package/dist/assets/{panel-top-open-BApXXBMD.js → panel-top-open-BFNhAe3f.js} +1 -1
  67. package/dist/assets/{pencil-CLaFsm6E.js → pencil-9Th5X-OY.js} +1 -1
  68. package/dist/assets/{report-commentary-row-BGN_tI-P.js → report-commentary-row-CNIlhboC.js} +1 -1
  69. package/dist/assets/{save-DsE11_Et.js → save-qtyyZLc5.js} +1 -1
  70. package/dist/assets/{similar-transactions-modal-CoZU6FU3.js → similar-transactions-modal-nk8VHEtX.js} +1 -1
  71. package/dist/assets/sub-fkVv9ghZ.js +1 -0
  72. package/dist/assets/subMonths-5wFmciT1.js +1 -0
  73. package/dist/assets/{summary-BasZ3QlN.js → summary-DuWhfNdL.js} +1 -1
  74. package/dist/assets/{toggle-expansion-button-DPcDIe-2.js → toggle-expansion-button-41Ejffq3.js} +1 -1
  75. package/dist/assets/tooltip-lhMCop8U.js +1 -0
  76. package/dist/assets/{use-url-query-Bp_LkJaa.js → use-url-query-BPzyQB93.js} +1 -1
  77. package/dist/index.html +1 -1
  78. package/package.json +1 -1
  79. package/src/app.tsx +108 -0
  80. package/src/components/business/index.tsx +1 -31
  81. package/src/components/business/transactions-section.tsx +2 -24
  82. package/src/components/{business-ledger → business-transactions}/business-extended-info.tsx +27 -25
  83. package/src/components/{business-ledger/business-ledger-filters.tsx → business-transactions/business-transactions-filters.tsx} +12 -12
  84. package/src/components/{business-ledger/business-ledger-single.tsx → business-transactions/business-transactions-single.tsx} +13 -13
  85. package/src/components/{business-ledger → business-transactions}/download-csv.tsx +25 -25
  86. package/src/components/{business-ledger → business-transactions}/index.tsx +15 -15
  87. package/src/components/charges/charge-extended-info.tsx +4 -45
  88. package/src/components/layout/sidelinks.tsx +2 -2
  89. package/src/components/ledger-table/columns.tsx +4 -4
  90. package/src/components/ledger-table/index.tsx +181 -152
  91. package/src/components/reports/conto/custom-node.tsx +1 -1
  92. package/src/components/reports/trial-balance-report/trial-balance-report-account.tsx +1 -1
  93. package/src/components/transactions-table/columns.tsx +9 -9
  94. package/src/components/transactions-table/index.tsx +21 -56
  95. package/src/gql/gql.ts +12 -30
  96. package/src/gql/graphql.ts +406 -181
  97. package/src/providers/index.ts +4 -0
  98. package/src/router/config.tsx +14 -14
  99. package/src/router/routes.ts +2 -2
  100. package/dist/assets/business-extended-info-vAiMQKwm.js +0 -13
  101. package/dist/assets/business-ledger-filters-CNjRVS0K.js +0 -1
  102. package/dist/assets/business-ledger-single-BrattJvc.js +0 -1
  103. package/dist/assets/business-trip-DZqft86E.js +0 -1
  104. package/dist/assets/charges-table--gOKotyF.js +0 -62
  105. package/dist/assets/download-csv-button-B0eh9bzg.js +0 -1
  106. package/dist/assets/index-B05N38w4.js +0 -6
  107. package/dist/assets/index-BS5IhG6A.js +0 -1
  108. package/dist/assets/index-Ci8Rcu9T.js +0 -1
  109. package/dist/assets/issue-document-BcWeUsrG.js +0 -1
  110. package/dist/assets/sub-DLRNYZyc.js +0 -1
  111. package/dist/assets/subMonths-Bc9skHhr.js +0 -1
  112. package/dist/assets/tooltip-CICdw5IX.js +0 -1
  113. package/src/components/business/balance-section.tsx +0 -26
  114. package/src/components/business/ledger-section.tsx +0 -49
  115. package/src/providers/index.tsx +0 -56
@@ -2,81 +2,151 @@ import { useMemo, useState, type ReactElement } from 'react';
2
2
  import {
3
3
  flexRender,
4
4
  getCoreRowModel,
5
- getPaginationRowModel,
6
5
  getSortedRowModel,
7
6
  useReactTable,
8
7
  type SortingState,
9
8
  } from '@tanstack/react-table';
10
9
  import {
11
- LedgerRecordsTableFieldsFragmentDoc,
12
- type LedgerRecordsTableFieldsFragment,
10
+ TableLedgerRecordsFieldsFragmentDoc,
11
+ type TableLedgerRecordsFieldsFragment,
13
12
  } from '../../gql/graphql.js';
14
13
  import { getFragmentData, type FragmentType } from '../../gql/index.js';
15
14
  import { EMPTY_UUID } from '../../helpers/consts.js';
16
- import { Button } from '../ui/button.js';
17
15
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../ui/table.js';
18
16
  import { columns } from './columns.js';
19
17
 
20
18
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
21
19
  /* GraphQL */ `
22
- fragment LedgerRecordsTableFields on LedgerRecord {
20
+ fragment TableLedgerRecordsFields on Charge {
23
21
  id
24
- creditAccount1 {
22
+ ledger {
25
23
  __typename
26
- id
27
- name
24
+ records {
25
+ id
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
+ }
28
149
  }
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
80
150
  }
81
151
  `;
82
152
 
@@ -96,51 +166,43 @@ function getRowColorByStatus(status?: 'New' | 'Diff' | 'Deleted'): string {
96
166
  return rowStyle;
97
167
  }
98
168
 
99
- export type LedgerRecordRow = LedgerRecordsTableFieldsFragment & {
169
+ export type LedgerRecordRow = TableLedgerRecordsFieldsFragment['ledger']['records'][number] & {
100
170
  matchingStatus?: 'New' | 'Diff' | 'Deleted';
101
- diff?: LedgerRecordsTableFieldsFragment;
171
+ diff?: TableLedgerRecordsFieldsFragment['ledger']['records'][number];
102
172
  };
103
173
 
104
174
  type Props = {
105
- ledgerRecordsData: FragmentType<typeof LedgerRecordsTableFieldsFragmentDoc>[];
106
- ledgerDiffData?: FragmentType<typeof LedgerRecordsTableFieldsFragmentDoc>[];
107
- matches?: string[];
175
+ ledgerFragment: FragmentType<typeof TableLedgerRecordsFieldsFragmentDoc>;
108
176
  };
109
177
 
110
- export const LedgerTable = ({
111
- ledgerRecordsData,
112
- ledgerDiffData,
113
- matches,
114
- }: Props): ReactElement => {
178
+ export const LedgerTable = ({ ledgerFragment }: Props): ReactElement => {
179
+ const { ledger } = getFragmentData(TableLedgerRecordsFieldsFragmentDoc, ledgerFragment);
115
180
  const [sorting, setSorting] = useState<SortingState>([]);
116
181
 
117
182
  const data = useMemo(() => {
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);
183
+ const records: LedgerRecordRow[] = ledger.records.map(record => {
184
+ const diff = ledger.validate?.differences?.find(diffRecord => diffRecord.id === record.id);
127
185
  return {
128
186
  ...record,
129
187
  matchingStatus:
130
- !matches || matches?.includes(record.id) ? undefined : diff ? 'Diff' : 'Deleted',
188
+ !ledger.validate?.matches || ledger.validate.matches?.includes(record.id)
189
+ ? undefined
190
+ : diff
191
+ ? 'Diff'
192
+ : 'Deleted',
131
193
  diff,
132
194
  };
133
195
  });
134
196
  const newRecords: LedgerRecordRow[] =
135
- differences
197
+ ledger?.validate?.differences
136
198
  ?.filter(record => record.id === EMPTY_UUID)
137
199
  .map(record => ({
138
200
  ...record,
139
201
  matchingStatus: 'New',
140
202
  })) ?? [];
141
- currentRecords.push(...newRecords);
142
- return currentRecords;
143
- }, [ledgerRecordsData, ledgerDiffData, matches]);
203
+ records.push(...newRecords);
204
+ return records;
205
+ }, [ledger]);
144
206
 
145
207
  const table = useReactTable({
146
208
  data,
@@ -148,82 +210,49 @@ export const LedgerTable = ({
148
210
  getCoreRowModel: getCoreRowModel(),
149
211
  onSortingChange: setSorting,
150
212
  getSortedRowModel: getSortedRowModel(),
151
- getPaginationRowModel: getPaginationRowModel(),
152
213
  state: {
153
214
  sorting,
154
215
  },
155
- initialState: {
156
- pagination: {
157
- pageIndex: 0,
158
- pageSize: 10,
159
- },
160
- sorting: [
161
- {
162
- id: 'invoiceDate',
163
- desc: true,
164
- },
165
- ],
166
- },
167
216
  });
168
217
 
169
218
  return (
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>
219
+ <Table>
220
+ <TableHeader>
221
+ {table.getHeaderGroups().map(headerGroup => (
222
+ <TableRow key={headerGroup.id}>
223
+ {headerGroup.headers.map(header => (
224
+ <TableHead key={header.id} colSpan={header.colSpan}>
225
+ {header.isPlaceholder
226
+ ? null
227
+ : flexRender(header.column.columnDef.header, header.getContext())}
228
+ </TableHead>
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>
181
245
  ))}
182
246
  </TableRow>
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
- </>
247
+ ))
248
+ ) : (
249
+ <TableRow>
250
+ <TableCell colSpan={columns.length} className="h-24 text-center">
251
+ No results.
252
+ </TableCell>
253
+ </TableRow>
254
+ )}
255
+ </TableBody>
256
+ </Table>
228
257
  );
229
258
  };
@@ -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-ledger/business-extended-info.js';
16
+ import { BusinessExtendedInfo } from '../../business-transactions/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-ledger/business-extended-info.js';
5
+ import { BusinessExtendedInfo } from '../../business-transactions/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: (id: string) => void;
54
+ editTransaction: () => 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
- onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
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
- onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
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
- onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
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
- onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
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
- onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
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
- onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
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
- onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
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(row.original.id)} />
233
+ <EditMiniButton onClick={row.original.editTransaction} />
234
234
  <InsertMiscExpenseModal
235
235
  chargeId={row.original.chargeId}
236
236
  transactionId={row.original.id}
@@ -2,7 +2,6 @@ import { useMemo, useState, type ReactElement } from 'react';
2
2
  import {
3
3
  flexRender,
4
4
  getCoreRowModel,
5
- getPaginationRowModel,
6
5
  getSortedRowModel,
7
6
  useReactTable,
8
7
  type SortingState,
@@ -10,7 +9,6 @@ import {
10
9
  import { TransactionForTransactionsTableFieldsFragmentDoc } from '../../gql/graphql.js';
11
10
  import { getFragmentData, type FragmentType } from '../../gql/index.js';
12
11
  import { EditTransactionModal } from '../common/index.js';
13
- import { Button } from '../ui/button.js';
14
12
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../ui/table.js';
15
13
  import { actionsColumn, columns, type TransactionsTableRowType } from './columns.js';
16
14
 
@@ -23,37 +21,37 @@ type Props = {
23
21
 
24
22
  export const TransactionsTable = ({
25
23
  transactionsProps,
26
- onChange,
24
+ onChange = (): void => void 0,
27
25
  enableEdit,
28
26
  enableChargeLink,
29
27
  }: Props): ReactElement => {
30
28
  const [editTransactionId, setEditTransactionId] = useState<string | undefined>(undefined);
31
29
  const [sorting, setSorting] = useState<SortingState>([]);
32
30
 
33
- const transactions = useMemo(() => {
34
- console.log('rendering Transactions');
35
- return transactionsProps.map(rawTransaction => {
36
- return getFragmentData(TransactionForTransactionsTableFieldsFragmentDoc, rawTransaction);
37
- });
38
- }, [transactionsProps]);
31
+ const transactions = useMemo(
32
+ () =>
33
+ transactionsProps.map(rawTransaction =>
34
+ getFragmentData(TransactionForTransactionsTableFieldsFragmentDoc, rawTransaction),
35
+ ),
36
+ [transactionsProps],
37
+ );
39
38
 
40
- const data: TransactionsTableRowType[] = useMemo(() => {
41
- console.log('rendering TransactionsTable data');
42
- return transactions.map(transaction => {
43
- return {
39
+ const data: TransactionsTableRowType[] = useMemo(
40
+ () =>
41
+ transactions?.map(transaction => ({
44
42
  ...transaction,
45
- editTransaction: setEditTransactionId,
46
- onUpdate: onChange || (() => {}),
43
+ editTransaction: (): void => setEditTransactionId(transaction.id),
44
+ onUpdate: onChange,
47
45
  enableEdit,
48
46
  enableChargeLink,
49
- };
50
- });
51
- }, [transactions, enableEdit, enableChargeLink, onChange]);
47
+ })),
48
+ [transactions, onChange, enableEdit, enableChargeLink],
49
+ );
52
50
 
53
- const tableColumns = useMemo(() => {
54
- console.log('rendering tableColumns');
55
- return enableEdit || enableChargeLink ? [...columns, actionsColumn] : columns;
56
- }, [enableEdit, enableChargeLink]);
51
+ const tableColumns = useMemo(
52
+ () => (enableEdit || enableChargeLink ? [...columns, actionsColumn] : columns),
53
+ [enableEdit, enableChargeLink],
54
+ );
57
55
 
58
56
  const table = useReactTable({
59
57
  data,
@@ -61,22 +59,9 @@ export const TransactionsTable = ({
61
59
  getCoreRowModel: getCoreRowModel(),
62
60
  onSortingChange: setSorting,
63
61
  getSortedRowModel: getSortedRowModel(),
64
- getPaginationRowModel: getPaginationRowModel(),
65
62
  state: {
66
63
  sorting,
67
64
  },
68
- initialState: {
69
- pagination: {
70
- pageIndex: 0,
71
- pageSize: 100,
72
- },
73
- sorting: [
74
- {
75
- id: 'eventDate',
76
- desc: true,
77
- },
78
- ],
79
- },
80
65
  });
81
66
 
82
67
  return (
@@ -117,30 +102,10 @@ export const TransactionsTable = ({
117
102
  )}
118
103
  </TableBody>
119
104
  </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
- )}
140
105
  <EditTransactionModal
141
106
  transactionID={editTransactionId}
142
107
  close={() => setEditTransactionId(undefined)}
143
- onChange={onChange ?? (() => {})}
108
+ onChange={onChange}
144
109
  />
145
110
  </>
146
111
  );