@accounter/client 0.0.8-alpha-20251029232510-4bc0c8b8c08a26f0c27788725ae584e515236d20 → 0.0.8-alpha-20251029233659-8fb74309c9f1de4f20423db029c5740e2df4bb5d
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 -15
- package/dist/assets/{Checkbox-Cmx4P-eR.js → Checkbox-CSPHEKoR.js} +2 -2
- package/dist/assets/{MultiSelect-tfWMeMsf.js → MultiSelect-CszuVk07.js} +1 -1
- package/dist/assets/{Pagination-p2BVFuhf.js → Pagination-Cp6iKPSu.js} +1 -1
- package/dist/assets/{Progress-BwoJerOb.js → Progress-ByaKYSXX.js} +1 -1
- package/dist/assets/{Table-Cve82Lq5.js → Table-CQ4GTcIY.js} +1 -1
- package/dist/assets/{Typography-CAgQOS4U.js → Typography-Cn08y9HC.js} +1 -1
- package/dist/assets/{YearPickerInput-BPVLgEAY.js → YearPickerInput-BsQymTcP.js} +1 -1
- package/dist/assets/{accordion-Ca5XgpUz.js → accordion-CG93-Cqs.js} +1 -1
- package/dist/assets/accountant-approvals-Dxy1hGw7.js +1 -0
- package/dist/assets/{accounter-table-CBlUbpQl.js → accounter-table-Dgvw-xm_.js} +1 -1
- package/dist/assets/{addDays-ClGDfhvI.js → addDays-Di-hbHs3.js} +1 -1
- package/dist/assets/{all-charges-DV7V8QJ6.js → all-charges-DRl4EcMG.js} +1 -1
- package/dist/assets/{arrow-up-down-DMdWvrmz.js → arrow-up-down-Hh3TlLSU.js} +1 -1
- package/dist/assets/{building-2-Y3dys8Pf.js → building-2-DGfYgfU_.js} +1 -1
- package/dist/assets/business-aamFaOhr.js +27 -0
- package/dist/assets/business-extended-info-CeEMIazB.js +13 -0
- package/dist/assets/{business-header-S5R7Fq8P.js → business-header-BphijNiC.js} +1 -1
- package/dist/assets/business-transactions-filters-DYBvDjKs.js +1 -0
- package/dist/assets/business-transactions-single-B77wu9sA.js +1 -0
- package/dist/assets/business-trip-C1cYIMHX.js +1 -0
- package/dist/assets/{charge-C79C95t6.js → charge-D-99eJ1v.js} +1 -1
- package/dist/assets/{charges-filters-RFRXF1Oa.js → charges-filters-Dxaf2lVd.js} +1 -1
- package/dist/assets/{charges-ledger-validation-DTglElRA.js → charges-ledger-validation-BAY3PYth.js} +1 -1
- package/dist/assets/charges-table-CNWVDMmv.js +62 -0
- package/dist/assets/{chart-2MG3qLL8.js → chart-DM5P1yGj.js} +1 -1
- package/dist/assets/{data-table-pagination-Dhmbf7BR.js → data-table-pagination-TG7sqb1-.js} +1 -1
- package/dist/assets/download-csv-button-jQXIlRax.js +1 -0
- package/dist/assets/{editable-business-trip-BlqinsvU.js → editable-business-trip-DlAsZ0aQ.js} +2 -2
- package/dist/assets/{funnel-B2plvroD.js → funnel-BQEGwl1q.js} +1 -1
- package/dist/assets/{index-Csdsjvrl.js → index--OgMtW-2.js} +2 -2
- package/dist/assets/index-B-USUC2v.js +1 -0
- package/dist/assets/index-BYfofaiM.js +1 -0
- package/dist/assets/{index-C6OmHOHr.js → index-BmZql10x.js} +213 -213
- package/dist/assets/{index-Bs4RBq4h.js → index-CFY-4iKE.js} +1 -1
- package/dist/assets/{index-C4gCwrJJ.js → index-CGQclWiq.js} +1 -1
- package/dist/assets/index-CIY9x3TF.js +6 -0
- package/dist/assets/{index-arYAg9nt.js → index-CJEUQmMx.js} +1 -1
- package/dist/assets/{index-DKZGNBg3.js → index-CXRSu47J.js} +2 -2
- package/dist/assets/{index-DemO-kJJ.js → index-CiXTFJcq.js} +2 -2
- package/dist/assets/{index-CSEktEoZ.js → index-CkIv3Veq.js} +7 -7
- package/dist/assets/{index-BRNnfzgV.js → index-ClzPFBOc.js} +2 -2
- package/dist/assets/{index-qMYyjtmt.js → index-CzEcZ0Dn.js} +2 -2
- package/dist/assets/{index-HG5RXBPG.js → index-D9zE4pLO.js} +1 -1
- package/dist/assets/{index-DZ6Bqs7R.js → index-DKjsW6q7.js} +7 -7
- package/dist/assets/{index-C0ZATVhv.js → index-DOh5XsM3.js} +2 -2
- package/dist/assets/index-DROHY2Kd.js +1 -0
- package/dist/assets/index-DWXHJxFq.css +1 -0
- package/dist/assets/index-DgbPiRkF.js +1 -0
- package/dist/assets/{index-5R7-0kTp.js → index-DkKTDpFK.js} +1 -1
- package/dist/assets/{index-Cn4t95Q9.js → index-DnFwBDCa.js} +1 -1
- package/dist/assets/index-Dt4KpoN0.js +1 -0
- package/dist/assets/{index-BdRubi2c.js → index-IuUe41KG.js} +1 -1
- package/dist/assets/{index-eIVAASqp.js → index-NofRnQ8o.js} +1 -1
- package/dist/assets/{index-P9_YuS6e.js → index-WaN-m0WB.js} +1 -1
- package/dist/assets/index-juMfNCjV.js +1 -0
- package/dist/assets/{index.es-BrfHJ6Yj.js → index.es-BJEu0vdb.js} +1 -1
- package/dist/assets/{insert-business-trip-modal-COXHjjIY.js → insert-business-trip-modal-CXgUJdgl.js} +2 -2
- package/dist/assets/issue-document-BSkWYnI5.js +1 -0
- package/dist/assets/{list-plus-DbuCDPM8.js → list-plus-BlHtPDEN.js} +1 -1
- package/dist/assets/{login-page-ChNFTZLU.js → login-page-DmCLAM1G.js} +1 -1
- package/dist/assets/{match-document-modal-Cp2DKG3j.js → match-document-modal-KjnSxB69.js} +4 -4
- package/dist/assets/{missing-info-charges-IUzXIDY1.js → missing-info-charges-BiEeQwER.js} +1 -1
- package/dist/assets/{modal-CCAYjiOC.js → modal-dLkQjDNz.js} +1 -1
- package/dist/assets/{page-layout-DpwpZHY3.js → page-layout-DxGYaCiw.js} +1 -1
- package/dist/assets/{page-not-found-NbOMK1Jv.js → page-not-found-ChLEFKCs.js} +1 -1
- package/dist/assets/{panel-top-open-CNX1-h4c.js → panel-top-open-CWsfFRNu.js} +1 -1
- package/dist/assets/{pencil-Z4i9z0vF.js → pencil-BEefjySD.js} +1 -1
- package/dist/assets/{report-commentary-row-C4I-ATEX.js → report-commentary-row-Cci0ntye.js} +1 -1
- package/dist/assets/{save-D0kOxdMh.js → save-BkV97OA1.js} +1 -1
- package/dist/assets/similar-transactions-modal-8T9lL2yX.js +1 -0
- package/dist/assets/sub-DdivcKGZ.js +1 -0
- package/dist/assets/subMonths-Kz3NJUOL.js +1 -0
- package/dist/assets/{summary-CkpRtdVA.js → summary-DzLJ6sUY.js} +1 -1
- package/dist/assets/{toggle-expansion-button-Babot8nj.js → toggle-expansion-button-BzVlE1kb.js} +1 -1
- package/dist/assets/tooltip-Ht3m2Q26.js +1 -0
- package/dist/assets/{use-url-query-BSUiacze.js → use-url-query-DV9K0FAR.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/app.tsx +108 -0
- package/src/components/business/admin-business-section.tsx +103 -299
- package/src/components/business/index.tsx +1 -33
- package/src/components/business/transactions-section.tsx +2 -24
- package/src/components/{business-ledger → business-transactions}/business-extended-info.tsx +27 -25
- package/src/components/{business-ledger/business-ledger-filters.tsx → business-transactions/business-transactions-filters.tsx} +12 -12
- package/src/components/{business-ledger/business-ledger-single.tsx → business-transactions/business-transactions-single.tsx} +13 -13
- package/src/components/{business-ledger → business-transactions}/download-csv.tsx +25 -25
- package/src/components/{business-ledger → business-transactions}/index.tsx +15 -15
- package/src/components/charges/charge-extended-info.tsx +4 -45
- package/src/components/layout/sidelinks.tsx +2 -2
- package/src/components/ledger-table/columns.tsx +4 -4
- package/src/components/ledger-table/index.tsx +181 -141
- 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/tags/index.tsx +2 -4
- package/src/components/transactions-table/columns.tsx +9 -9
- package/src/components/transactions-table/index.tsx +21 -43
- package/src/gql/gql.ts +15 -33
- package/src/gql/graphql.ts +423 -234
- package/src/providers/index.tsx +56 -0
- package/src/router/config.tsx +14 -14
- package/src/router/routes.ts +2 -2
- package/dist/assets/accountant-approvals-BXTzXE96.js +0 -1
- package/dist/assets/business-CRd0ns94.js +0 -37
- package/dist/assets/business-extended-info-BKVk3weU.js +0 -13
- package/dist/assets/business-ledger-filters-C_x4y5uJ.js +0 -1
- package/dist/assets/business-ledger-single-Dku8gbU9.js +0 -1
- package/dist/assets/business-trip-CB51p6xt.js +0 -1
- package/dist/assets/charges-table-D3WwcB50.js +0 -62
- package/dist/assets/download-csv-button-BQSz29rY.js +0 -1
- package/dist/assets/index--xgmdJzW.js +0 -1
- package/dist/assets/index-BUJm5I0K.css +0 -1
- package/dist/assets/index-BgLtHIxa.js +0 -1
- package/dist/assets/index-CIdZZL-X.js +0 -1
- package/dist/assets/index-DA3Ccstm.js +0 -1
- package/dist/assets/index-DhRIY5eN.js +0 -1
- package/dist/assets/index-aEEtRfbo.js +0 -1
- package/dist/assets/index-nshyF-PE.js +0 -6
- package/dist/assets/issue-document-CBKTg1VC.js +0 -1
- package/dist/assets/similar-transactions-modal-DgD48GZ2.js +0 -1
- package/dist/assets/sub-BAZr7Qdd.js +0 -1
- package/dist/assets/subMonths-Df-03cZk.js +0 -1
- package/dist/assets/tooltip-DStdzzhK.js +0 -1
- package/src/components/business/balance-section.tsx +0 -26
- package/src/components/business/ledger-section.tsx +0 -49
- package/src/components/ui/pagination.tsx +0 -194
- package/src/providers/index.ts +0 -4
|
@@ -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
|
-
|
|
12
|
-
type
|
|
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 { Pagination } from '../ui/pagination.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
|
|
20
|
+
fragment TableLedgerRecordsFields on Charge {
|
|
23
21
|
id
|
|
24
|
-
|
|
22
|
+
ledger {
|
|
25
23
|
__typename
|
|
26
|
-
|
|
27
|
-
|
|
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 =
|
|
169
|
+
export type LedgerRecordRow = TableLedgerRecordsFieldsFragment['ledger']['records'][number] & {
|
|
100
170
|
matchingStatus?: 'New' | 'Diff' | 'Deleted';
|
|
101
|
-
diff?:
|
|
171
|
+
diff?: TableLedgerRecordsFieldsFragment['ledger']['records'][number];
|
|
102
172
|
};
|
|
103
173
|
|
|
104
174
|
type Props = {
|
|
105
|
-
|
|
106
|
-
ledgerDiffData?: FragmentType<typeof LedgerRecordsTableFieldsFragmentDoc>[];
|
|
107
|
-
matches?: string[];
|
|
175
|
+
ledgerFragment: FragmentType<typeof TableLedgerRecordsFieldsFragmentDoc>;
|
|
108
176
|
};
|
|
109
177
|
|
|
110
|
-
export const LedgerTable = ({
|
|
111
|
-
|
|
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 =
|
|
119
|
-
|
|
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)
|
|
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
|
-
|
|
142
|
-
return
|
|
143
|
-
}, [
|
|
203
|
+
records.push(...newRecords);
|
|
204
|
+
return records;
|
|
205
|
+
}, [ledger]);
|
|
144
206
|
|
|
145
207
|
const table = useReactTable({
|
|
146
208
|
data,
|
|
@@ -148,71 +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
|
-
<
|
|
172
|
-
|
|
173
|
-
{
|
|
174
|
-
|
|
175
|
-
{
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
<Pagination
|
|
211
|
-
value={table.getState().pagination.pageIndex}
|
|
212
|
-
total={table.getPageCount()}
|
|
213
|
-
onChange={page => table.setPageIndex(page)}
|
|
214
|
-
/>
|
|
215
|
-
</div>
|
|
216
|
-
</>
|
|
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>
|
|
217
257
|
);
|
|
218
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-
|
|
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-
|
|
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
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useContext,
|
|
1
|
+
import { useCallback, useContext, useState, type ReactElement } from 'react';
|
|
2
2
|
import { ListPlus, Loader2, Trash2 } from 'lucide-react';
|
|
3
3
|
import { useQuery } from 'urql';
|
|
4
4
|
import { AllTagsScreenDocument } from '../../gql/graphql.js';
|
|
@@ -32,9 +32,7 @@ export const TagsManager = (): ReactElement => {
|
|
|
32
32
|
const { addTag } = useAddTag();
|
|
33
33
|
const { deleteTag } = useDeleteTag();
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
setFiltersContext(null);
|
|
37
|
-
}, [setFiltersContext]);
|
|
35
|
+
setFiltersContext(null);
|
|
38
36
|
|
|
39
37
|
const allTags = sortTags(data?.allTags ?? []);
|
|
40
38
|
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
|
|
52
52
|
export type TransactionsTableRowType = TransactionForTransactionsTableFieldsFragment & {
|
|
53
53
|
onUpdate: () => void;
|
|
54
|
-
editTransaction: (
|
|
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={
|
|
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 { Pagination } from '../ui/pagination.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,35 +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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
42
|
-
|
|
39
|
+
const data: TransactionsTableRowType[] = useMemo(
|
|
40
|
+
() =>
|
|
41
|
+
transactions?.map(transaction => ({
|
|
43
42
|
...transaction,
|
|
44
|
-
editTransaction: setEditTransactionId,
|
|
45
|
-
onUpdate: onChange
|
|
43
|
+
editTransaction: (): void => setEditTransactionId(transaction.id),
|
|
44
|
+
onUpdate: onChange,
|
|
46
45
|
enableEdit,
|
|
47
46
|
enableChargeLink,
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
})),
|
|
48
|
+
[transactions, onChange, enableEdit, enableChargeLink],
|
|
49
|
+
);
|
|
51
50
|
|
|
52
|
-
const tableColumns = useMemo(
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const tableColumns = useMemo(
|
|
52
|
+
() => (enableEdit || enableChargeLink ? [...columns, actionsColumn] : columns),
|
|
53
|
+
[enableEdit, enableChargeLink],
|
|
54
|
+
);
|
|
55
55
|
|
|
56
56
|
const table = useReactTable({
|
|
57
57
|
data,
|
|
@@ -59,22 +59,9 @@ export const TransactionsTable = ({
|
|
|
59
59
|
getCoreRowModel: getCoreRowModel(),
|
|
60
60
|
onSortingChange: setSorting,
|
|
61
61
|
getSortedRowModel: getSortedRowModel(),
|
|
62
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
63
62
|
state: {
|
|
64
63
|
sorting,
|
|
65
64
|
},
|
|
66
|
-
initialState: {
|
|
67
|
-
pagination: {
|
|
68
|
-
pageIndex: 0,
|
|
69
|
-
pageSize: 100,
|
|
70
|
-
},
|
|
71
|
-
sorting: [
|
|
72
|
-
{
|
|
73
|
-
id: 'eventDate',
|
|
74
|
-
desc: true,
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
65
|
});
|
|
79
66
|
|
|
80
67
|
return (
|
|
@@ -115,19 +102,10 @@ export const TransactionsTable = ({
|
|
|
115
102
|
)}
|
|
116
103
|
</TableBody>
|
|
117
104
|
</Table>
|
|
118
|
-
{table.getPageCount() > 1 && (
|
|
119
|
-
<div className="flex items-center justify-end space-x-2 py-4">
|
|
120
|
-
<Pagination
|
|
121
|
-
value={table.getState().pagination.pageIndex}
|
|
122
|
-
total={table.getPageCount()}
|
|
123
|
-
onChange={page => table.setPageIndex(page)}
|
|
124
|
-
/>
|
|
125
|
-
</div>
|
|
126
|
-
)}
|
|
127
105
|
<EditTransactionModal
|
|
128
106
|
transactionID={editTransactionId}
|
|
129
107
|
close={() => setEditTransactionId(undefined)}
|
|
130
|
-
onChange={onChange
|
|
108
|
+
onChange={onChange}
|
|
131
109
|
/>
|
|
132
110
|
</>
|
|
133
111
|
);
|