@accounter/client 0.0.8-alpha-20251028124234-328844c99a42b68aa9e2f32fd86da80b4832f631 → 0.0.8-alpha-20251028124537-8b0946b10a6e597c997017c33fb80fbf674e2feb
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 +84 -13
- package/dist/assets/{Checkbox-BR6kGuhg.js → Checkbox-DBiOK2wr.js} +3 -3
- package/dist/assets/{Progress-7xtiFwK3.js → Progress-3b9RPwUr.js} +1 -1
- package/dist/assets/Typography-BjOvYDtJ.js +1 -0
- package/dist/assets/accordion-gDGB9JKa.js +1 -0
- package/dist/assets/accountant-approvals-aQMSAP78.js +1 -0
- package/dist/assets/all-charges-X9R8PfNk.js +1 -0
- package/dist/assets/{arrow-up-down-DPG1l9S1.js → arrow-up-down-B3nz1j1G.js} +2 -2
- package/dist/assets/{building-2-BgvPBt2Z.js → building-2-DyCA1u9z.js} +2 -2
- package/dist/assets/business-BOAeYn9N.js +27 -0
- package/dist/assets/{business-header-u2sfE_d8.js → business-header-Ck0v04Iw.js} +1 -1
- package/dist/assets/business-transactions-single-_OIHJEfY.js +1 -0
- package/dist/assets/business-trip-CYZP6qrZ.js +1 -0
- package/dist/assets/charges-filters-Dc9JkkaM.js +1 -0
- package/dist/assets/charges-ledger-validation-BiBZ2pEf.js +1 -0
- package/dist/assets/{chart-ByngRufj.js → chart-xV-krckX.js} +6 -6
- package/dist/assets/{data-table-pagination-D4OEFmX_.js → data-table-pagination-BtKmZaSS.js} +3 -3
- package/dist/assets/editable-business-trip-BIRxgXHu.js +16 -0
- package/dist/assets/index-2x_26B9B.js +1 -0
- package/dist/assets/index-4yVbIKWS.js +1 -0
- package/dist/assets/index-B-uojS_H.js +1 -0
- package/dist/assets/index-BFRBCjVk.css +1 -0
- package/dist/assets/index-BVffhJ_X.js +2 -0
- package/dist/assets/index-BZFydPbo.js +1 -0
- package/dist/assets/index-BazMRdI3.js +6 -0
- package/dist/assets/index-BsTpXlvi.js +891 -0
- package/dist/assets/{index-CLUhAJ3t.js → index-C3BnUF_U.js} +3 -3
- package/dist/assets/index-CD_kl3oZ.js +1 -0
- package/dist/assets/{index-UMFH47hN.js → index-CWM7AEkA.js} +4 -4
- package/dist/assets/index-CaXjK2fb.js +2 -0
- package/dist/assets/index-CbJd62Hp.js +1 -0
- package/dist/assets/index-CdKoH7Cz.js +9 -0
- package/dist/assets/index-Crc98w5p.js +1 -0
- package/dist/assets/index-Cs-QBGd0.js +1 -0
- package/dist/assets/index-D2ada9K2.js +1 -0
- package/dist/assets/index-DAkukoD_.js +1 -0
- package/dist/assets/index-DML4EmHc.js +1 -0
- package/dist/assets/{index-Bsl7tJp_.js → index-DuBbCD-l.js} +22 -22
- package/dist/assets/{index-BetG0HVN.js → index-DypFylYK.js} +3 -3
- package/dist/assets/{index-vChLJwSt.js → index-KFd7K_WR.js} +3 -3
- package/dist/assets/index-rwlm4BcW.js +1 -0
- package/dist/assets/index-xA-DiOzv.js +1 -0
- package/dist/assets/{index.es-NphQjU3m.js → index.es-C6nk1zNp.js} +1 -1
- package/dist/assets/issue-document-BezTjH4r.js +1 -0
- package/dist/assets/login-page-I-7tCrbB.js +1 -0
- package/dist/assets/missing-info-charges-BDgEJ4mj.js +1 -0
- package/dist/assets/page-not-found-CIT5vwb-.js +1 -0
- package/dist/assets/{pencil-tV0FsM6V.js → pencil-BHXyXIP9.js} +2 -2
- package/dist/assets/report-commentary-row-DHfnYhMN.js +1 -0
- package/dist/assets/{save-Czmh3tvC.js → save-NUZuyPEH.js} +2 -2
- package/dist/assets/sub-3UcXQDsZ.js +1 -0
- package/dist/assets/subMonths-BbuiFsxa.js +1 -0
- package/dist/index.html +2 -2
- package/package.json +5 -5
- package/src/components/business/admin-business-section.tsx +74 -36
- package/src/components/business/contracts-section.tsx +25 -4
- package/src/components/business-transactions/business-extended-info.tsx +5 -5
- package/src/components/business-transactions/index.tsx +28 -1
- package/src/components/businesses/index.tsx +2 -6
- package/src/components/charges/cells/business-trip.tsx +1 -6
- package/src/components/charges/cells/counterparty.tsx +28 -4
- package/src/components/charges/helpers.ts +15 -0
- package/src/components/clients/contracts/modify-contract-dialog.tsx +70 -14
- package/src/components/clients/modify-client-dialog.tsx +27 -9
- package/src/components/common/business-trip-report/parts/core-expense-row.tsx +2 -2
- package/src/components/common/business-trip-report/parts/report-header.tsx +1 -2
- package/src/components/common/business-trip-report/parts/uncategorized-transactions.tsx +2 -2
- package/src/components/common/buttons/charge-navigate-button.tsx +11 -12
- package/src/components/common/modals/edit-charge-modal.tsx +2 -2
- package/src/components/common/modals/insert-business.tsx +88 -36
- package/src/components/common/modals/insert-document-modal.tsx +2 -2
- package/src/components/common/modals/match-document-modal.tsx +2 -2
- package/src/components/common/new-documents-list.tsx +2 -2
- package/src/components/documents-table/cells/creditor.tsx +11 -2
- package/src/components/documents-table/cells/debtor.tsx +11 -2
- package/src/components/layout/user-nav.tsx +22 -3
- package/src/components/ledger-table/counterparty-cell.tsx +33 -4
- package/src/components/reports/conto/index.tsx +18 -1
- package/src/components/reports/trial-balance-report/index.tsx +17 -1
- package/src/components/screens/businesses/business.tsx +4 -0
- package/src/components/screens/charges/all-charges.tsx +17 -1
- package/src/components/screens/charges/charge.tsx +4 -0
- package/src/components/screens/reports/balance-report/index.tsx +14 -0
- package/src/components/screens/reports/depreciation-report/index.tsx +14 -0
- package/src/components/transactions-table/cells/counterparty.tsx +23 -2
- package/src/components/transactions-table/cells-legacy/counterparty.tsx +26 -3
- package/src/gql/gql.ts +9 -9
- package/src/gql/graphql.ts +29 -23
- package/src/hooks/use-get-all-contracts.ts +1 -1
- package/src/providers/urql.tsx +2 -2
- package/dist/assets/MultiSelect-BqcJrWnD.js +0 -1
- package/dist/assets/Pagination-6Sv5LXxl.js +0 -1
- package/dist/assets/Table-C5zxD95i.js +0 -1
- package/dist/assets/Typography-CMzSQZKD.js +0 -1
- package/dist/assets/YearPickerInput-CllwSjcn.js +0 -1
- package/dist/assets/accordion-CMR2fANH.js +0 -1
- package/dist/assets/accountant-approvals-BHFXpHHc.js +0 -1
- package/dist/assets/accounter-table-CpeQD4PG.js +0 -1
- package/dist/assets/addDays-DvwuJbUs.js +0 -1
- package/dist/assets/all-charges-At7WJXuW.js +0 -1
- package/dist/assets/business-DKvbSnga.js +0 -32
- package/dist/assets/business-extended-info-7CM8px2e.js +0 -13
- package/dist/assets/business-transactions-filters-DmpO9Bwo.js +0 -1
- package/dist/assets/business-transactions-single-rF6JbAL7.js +0 -1
- package/dist/assets/business-trip-BGrp09N7.js +0 -1
- package/dist/assets/charge-C-EaA1Xc.js +0 -1
- package/dist/assets/charges-filters-Dq-8QHH-.js +0 -1
- package/dist/assets/charges-ledger-validation-DlkzVow7.js +0 -1
- package/dist/assets/charges-table-Cncs1HLi.js +0 -62
- package/dist/assets/create-event-handler-BiA-1lGu.js +0 -1
- package/dist/assets/download-csv-button-Df5rDeDc.js +0 -1
- package/dist/assets/editable-business-trip-Bav24z0u.js +0 -16
- package/dist/assets/funnel-BJ71hzoq.js +0 -6
- package/dist/assets/index-BRv0JZw4.js +0 -1
- package/dist/assets/index-BXlS8oD_.js +0 -1
- package/dist/assets/index-BplSRMAq.css +0 -1
- package/dist/assets/index-Cix5qjA-.js +0 -2
- package/dist/assets/index-CizLtiES.js +0 -1
- package/dist/assets/index-DKBzv0gc.js +0 -1
- package/dist/assets/index-DR_5jpS4.js +0 -6
- package/dist/assets/index-DTmtILfq.js +0 -1
- package/dist/assets/index-DU0G7FZm.js +0 -1
- package/dist/assets/index-DUWRgLfu.js +0 -9
- package/dist/assets/index-DYZPWG4k.js +0 -2
- package/dist/assets/index-DdUE2_44.js +0 -1
- package/dist/assets/index-De5dvO0S.js +0 -1
- package/dist/assets/index-Des3eR4f.js +0 -1
- package/dist/assets/index-DpYwi5kf.js +0 -6
- package/dist/assets/index-GzyQZkbY.js +0 -1
- package/dist/assets/index-HzLXi-qB.js +0 -1
- package/dist/assets/index-Ji28AZwq.js +0 -1
- package/dist/assets/index-fuT9duEO.js +0 -1
- package/dist/assets/index-wck8Xuay.js +0 -1
- package/dist/assets/index-wyU9I4Kz.js +0 -768
- package/dist/assets/insert-business-trip-modal-vS1QrUJz.js +0 -6
- package/dist/assets/issue-document-pIswc_8i.js +0 -1
- package/dist/assets/list-plus-Dy3vzJVy.js +0 -6
- package/dist/assets/login-page-YXRfklK1.js +0 -1
- package/dist/assets/match-document-modal-BPG_hljb.js +0 -16
- package/dist/assets/missing-info-charges-D8dUfChs.js +0 -1
- package/dist/assets/modal-D47umnak.js +0 -1
- package/dist/assets/page-layout-BG0XvWfD.js +0 -1
- package/dist/assets/page-not-found-Cy6oIIb1.js +0 -1
- package/dist/assets/panel-top-open-B1rhJYjQ.js +0 -11
- package/dist/assets/report-commentary-row-BL2RkIHq.js +0 -1
- package/dist/assets/similar-transactions-modal-MQeC2gtu.js +0 -1
- package/dist/assets/sub-B4_VmmF9.js +0 -1
- package/dist/assets/subMonths-DG7w6bCY.js +0 -1
- package/dist/assets/summary-DvHtnArZ.js +0 -1
- package/dist/assets/switch-GSloW_Ey.js +0 -1
- package/dist/assets/toggle-expansion-button-lwJYTklN.js +0 -1
- package/dist/assets/tooltip-BbKSwLCX.js +0 -1
- package/dist/assets/use-url-query-CUVSXgm0.js +0 -1
|
@@ -19,7 +19,11 @@ import { Tooltip } from '../../common/index.js';
|
|
|
19
19
|
import { Button } from '../../ui/button.js';
|
|
20
20
|
import { Label } from '../../ui/label.js';
|
|
21
21
|
import { Switch } from '../../ui/switch.js';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
ContoReportFilters,
|
|
24
|
+
encodeContoReportFilters,
|
|
25
|
+
type ContoReportFiltersType,
|
|
26
|
+
} from './conto-report-filters.js';
|
|
23
27
|
import { ManageTemplates } from './conto-report-manage-templates.js';
|
|
24
28
|
import { SaveTemplate } from './conto-report-save-template.js';
|
|
25
29
|
import { DownloadCSV } from './download-csv.js';
|
|
@@ -89,6 +93,19 @@ const BANK_TREE_ROOT_ID = 'bank';
|
|
|
89
93
|
export const REPORT_TREE_ROOT_ID = 'report';
|
|
90
94
|
export const CONTO_REPORT_FILTERS_KEY = 'contoReportFilters';
|
|
91
95
|
|
|
96
|
+
export function getContoReportHref(filter?: ContoReportFiltersType | null): string {
|
|
97
|
+
const params = new URLSearchParams();
|
|
98
|
+
|
|
99
|
+
const contoReportFilters = encodeContoReportFilters(filter);
|
|
100
|
+
if (contoReportFilters) {
|
|
101
|
+
// Add it as a single encoded parameter
|
|
102
|
+
params.append(CONTO_REPORT_FILTERS_KEY, contoReportFilters);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const queryParams = params.size > 0 ? `?${params}` : '';
|
|
106
|
+
return `/reports/conto${queryParams}`;
|
|
107
|
+
}
|
|
108
|
+
|
|
92
109
|
function buildSortCodeFinancialEntitiesMaps(tree: NodeModel<CustomData>[]) {
|
|
93
110
|
const sortCodeMap = new Map<number, string | number>();
|
|
94
111
|
const financialEntitiesMap = new Map<string, string | number>();
|
|
@@ -7,7 +7,10 @@ import { useUrlQuery } from '../../../hooks/use-url-query.js';
|
|
|
7
7
|
import { FiltersContext } from '../../../providers/filters-context.js';
|
|
8
8
|
import { PageLayout } from '../../layout/page-layout.js';
|
|
9
9
|
import { Button } from '../../ui/button.js';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
encodeTrialBalanceReportFilters,
|
|
12
|
+
TrialBalanceReportFilters,
|
|
13
|
+
} from './trial-balance-report-filters.js';
|
|
11
14
|
import { TrialBalanceTable } from './trial-balance-table.js';
|
|
12
15
|
|
|
13
16
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
|
|
@@ -24,6 +27,19 @@ import { TrialBalanceTable } from './trial-balance-table.js';
|
|
|
24
27
|
}
|
|
25
28
|
`;
|
|
26
29
|
|
|
30
|
+
export function getTrialBalanceReportHref(filter?: TrialBalanceReportFilters | null): string {
|
|
31
|
+
const params = new URLSearchParams();
|
|
32
|
+
|
|
33
|
+
const trialBalanceReportFilters = encodeTrialBalanceReportFilters(filter);
|
|
34
|
+
if (trialBalanceReportFilters) {
|
|
35
|
+
// Add it as a single encoded parameter
|
|
36
|
+
params.append('trialBalanceReportFilters', trialBalanceReportFilters);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const queryParams = params.size > 0 ? `?${params}` : '';
|
|
40
|
+
return `/reports/trial-balance${queryParams}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
27
43
|
export const TrialBalanceReport = (): ReactElement => {
|
|
28
44
|
const [isAllOpened, setIsAllOpened] = useState(false);
|
|
29
45
|
const { get } = useUrlQuery();
|
|
@@ -15,6 +15,10 @@ import { AccounterLoader } from '../../common/index.js';
|
|
|
15
15
|
}
|
|
16
16
|
`;
|
|
17
17
|
|
|
18
|
+
export function getBusinessHref(businessId: string): string {
|
|
19
|
+
return `/businesses/${businessId}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
export const BusinessScreen = (): ReactElement => {
|
|
19
23
|
const { businessId } = useParams<{ businessId: string }>();
|
|
20
24
|
|
|
@@ -5,7 +5,7 @@ import { Tooltip } from '@mantine/core';
|
|
|
5
5
|
import { AllChargesDocument, type ChargeFilter } from '../../../gql/graphql.js';
|
|
6
6
|
import { useUrlQuery } from '../../../hooks/use-url-query.js';
|
|
7
7
|
import { FiltersContext } from '../../../providers/filters-context.js';
|
|
8
|
-
import { ChargesFilters } from '../../charges/charges-filters.js';
|
|
8
|
+
import { ChargesFilters, encodeChargesFilters } from '../../charges/charges-filters.js';
|
|
9
9
|
import { ChargesTable } from '../../charges/charges-table.js';
|
|
10
10
|
import {
|
|
11
11
|
EditChargeModal,
|
|
@@ -31,6 +31,22 @@ import { Button } from '../../ui/button.js';
|
|
|
31
31
|
}
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
|
+
export function getAllChargesHref(filter?: ChargeFilter | null, page?: number): string {
|
|
35
|
+
const params = new URLSearchParams();
|
|
36
|
+
if (page) {
|
|
37
|
+
params.append('page', String(page));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const chargesFilters = encodeChargesFilters(filter);
|
|
41
|
+
if (chargesFilters) {
|
|
42
|
+
// Add it as a single encoded parameter
|
|
43
|
+
params.append('chargesFilters', chargesFilters);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const queryParams = params.size > 0 ? `?${params}` : '';
|
|
47
|
+
return `/charges${queryParams}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
34
50
|
export const AllCharges = (): ReactElement => {
|
|
35
51
|
const { setFiltersContext } = useContext(FiltersContext);
|
|
36
52
|
const [editChargeId, setEditChargeId] = useState<
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
BALANCE_REPORT_FILTERS_QUERY_PARAM,
|
|
27
27
|
BalanceReportFilters,
|
|
28
|
+
encodeBalanceReportFilters,
|
|
28
29
|
Periods,
|
|
29
30
|
type BalanceReportFilter,
|
|
30
31
|
type Period,
|
|
@@ -59,6 +60,19 @@ import { ExtendedTransactionsCard } from './extended-transactions.jsx';
|
|
|
59
60
|
}
|
|
60
61
|
`;
|
|
61
62
|
|
|
63
|
+
export function getBalanceReportHref(filter?: BalanceReportFilter | null): string {
|
|
64
|
+
const params = new URLSearchParams();
|
|
65
|
+
|
|
66
|
+
const balanceReportFilters = encodeBalanceReportFilters(filter);
|
|
67
|
+
if (balanceReportFilters) {
|
|
68
|
+
// Add it as a single encoded parameter
|
|
69
|
+
params.append(BALANCE_REPORT_FILTERS_QUERY_PARAM, balanceReportFilters);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const queryParams = params.size > 0 ? `?${params}` : '';
|
|
73
|
+
return `/reports/balance${queryParams}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
62
76
|
const chartConfig = {
|
|
63
77
|
income: {
|
|
64
78
|
label: 'Income',
|
|
@@ -22,6 +22,7 @@ import { DepreciationRecordRow } from './depreciation-record-row.js';
|
|
|
22
22
|
import {
|
|
23
23
|
DEPRECIATION_REPORT_FILTERS_QUERY_PARAM,
|
|
24
24
|
DepreciationReportFilters,
|
|
25
|
+
encodeDepreciationReportFilters,
|
|
25
26
|
} from './depreciation-report-filters.js';
|
|
26
27
|
import { DepreciationSummaryRow } from './depreciation-summary-row.js';
|
|
27
28
|
|
|
@@ -75,6 +76,19 @@ import { DepreciationSummaryRow } from './depreciation-summary-row.js';
|
|
|
75
76
|
}
|
|
76
77
|
`;
|
|
77
78
|
|
|
79
|
+
export function getDepreciationReportHref(filter?: DepreciationReportFilter | null): string {
|
|
80
|
+
const params = new URLSearchParams();
|
|
81
|
+
|
|
82
|
+
const depreciationReportFilters = encodeDepreciationReportFilters(filter);
|
|
83
|
+
if (depreciationReportFilters) {
|
|
84
|
+
// Add it as a single encoded parameter
|
|
85
|
+
params.append(DEPRECIATION_REPORT_FILTERS_QUERY_PARAM, depreciationReportFilters);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const queryParams = params.size > 0 ? `?${params}` : '';
|
|
89
|
+
return `/reports/depreciation${queryParams}`;
|
|
90
|
+
}
|
|
91
|
+
|
|
78
92
|
export const DepreciationReport = (): ReactElement => {
|
|
79
93
|
const { setFiltersContext } = useContext(FiltersContext);
|
|
80
94
|
const { userContext } = useContext(UserContext);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useCallback, useState, type ReactElement } from 'react';
|
|
2
2
|
import { CheckIcon } from 'lucide-react';
|
|
3
3
|
import { Link } from 'react-router-dom';
|
|
4
|
-
import {
|
|
4
|
+
import type { ChargeFilter } from '../../../gql/graphql.js';
|
|
5
5
|
import { useGetBusinesses } from '../../../hooks/use-get-businesses.js';
|
|
6
6
|
import { useUpdateTransaction } from '../../../hooks/use-update-transaction.js';
|
|
7
|
+
import { useUrlQuery } from '../../../hooks/use-url-query.js';
|
|
8
|
+
import { getBusinessTransactionsHref } from '../../business-transactions/index.js';
|
|
7
9
|
import { SelectWithSearch, Tooltip } from '../../common/index.js';
|
|
8
10
|
import { InsertBusiness } from '../../common/modals/insert-business.jsx';
|
|
9
11
|
import { SimilarTransactionsModal } from '../../common/modals/similar-transactions-modal.jsx';
|
|
@@ -16,6 +18,7 @@ type Props = {
|
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export function Counterparty({ transaction, onChange }: Props): ReactElement {
|
|
21
|
+
const { get } = useUrlQuery();
|
|
19
22
|
const {
|
|
20
23
|
id,
|
|
21
24
|
counterparty,
|
|
@@ -55,6 +58,24 @@ export function Counterparty({ transaction, onChange }: Props): ReactElement {
|
|
|
55
58
|
[updateBusiness, onChange],
|
|
56
59
|
);
|
|
57
60
|
|
|
61
|
+
const encodedFilters = get('chargesFilters');
|
|
62
|
+
|
|
63
|
+
const getHref = useCallback(
|
|
64
|
+
(businessID: string) => {
|
|
65
|
+
const currentFilters = encodedFilters
|
|
66
|
+
? (JSON.parse(decodeURIComponent(encodedFilters as string)) as ChargeFilter)
|
|
67
|
+
: {};
|
|
68
|
+
|
|
69
|
+
return getBusinessTransactionsHref({
|
|
70
|
+
fromDate: currentFilters.fromDate,
|
|
71
|
+
toDate: currentFilters.toDate,
|
|
72
|
+
ownerIds: currentFilters.byOwners,
|
|
73
|
+
businessIDs: [businessID],
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
[encodedFilters],
|
|
77
|
+
);
|
|
78
|
+
|
|
58
79
|
const { selectableBusinesses: selectOptions, fetching: businessesLoading } = useGetBusinesses();
|
|
59
80
|
|
|
60
81
|
const [selectedBusinessId, setSelectedBusinessId] = useState<string | null>(suggestedId ?? null);
|
|
@@ -66,7 +87,7 @@ export function Counterparty({ transaction, onChange }: Props): ReactElement {
|
|
|
66
87
|
<div className="flex flex-wrap flex-col justify-center">
|
|
67
88
|
{counterparty?.id ? (
|
|
68
89
|
<Link
|
|
69
|
-
to={
|
|
90
|
+
to={getHref(counterparty.id)}
|
|
70
91
|
target="_blank"
|
|
71
92
|
rel="noreferrer"
|
|
72
93
|
onClick={event => event.stopPropagation()}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { useCallback, useState, type ReactElement } from 'react';
|
|
2
2
|
import { CheckIcon } from 'lucide-react';
|
|
3
3
|
import { Link } from 'react-router-dom';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
TransactionsTableEntityFieldsFragmentDoc,
|
|
6
|
+
type ChargeFilter,
|
|
7
|
+
} from '../../../gql/graphql.js';
|
|
6
8
|
import { getFragmentData, type FragmentType } from '../../../gql/index.js';
|
|
7
9
|
import { useGetBusinesses } from '../../../hooks/use-get-businesses.js';
|
|
8
10
|
import { useUpdateTransaction } from '../../../hooks/use-update-transaction.js';
|
|
11
|
+
import { useUrlQuery } from '../../../hooks/use-url-query.js';
|
|
12
|
+
import { getBusinessTransactionsHref } from '../../business-transactions/index.js';
|
|
9
13
|
import { SelectWithSearch, Tooltip } from '../../common/index.js';
|
|
10
14
|
import { InsertBusiness } from '../../common/modals/insert-business.js';
|
|
11
15
|
import { SimilarTransactionsModal } from '../../common/modals/similar-transactions-modal.js';
|
|
@@ -36,6 +40,7 @@ type Props = {
|
|
|
36
40
|
};
|
|
37
41
|
|
|
38
42
|
export function Counterparty({ data, onChange, enableEdit }: Props): ReactElement {
|
|
43
|
+
const { get } = useUrlQuery();
|
|
39
44
|
const {
|
|
40
45
|
id,
|
|
41
46
|
counterparty,
|
|
@@ -74,6 +79,24 @@ export function Counterparty({ data, onChange, enableEdit }: Props): ReactElemen
|
|
|
74
79
|
[updateBusiness, onChange],
|
|
75
80
|
);
|
|
76
81
|
|
|
82
|
+
const encodedFilters = get('chargesFilters');
|
|
83
|
+
|
|
84
|
+
const getHref = useCallback(
|
|
85
|
+
(businessID: string) => {
|
|
86
|
+
const currentFilters = encodedFilters
|
|
87
|
+
? (JSON.parse(decodeURIComponent(encodedFilters as string)) as ChargeFilter)
|
|
88
|
+
: {};
|
|
89
|
+
|
|
90
|
+
return getBusinessTransactionsHref({
|
|
91
|
+
fromDate: currentFilters.fromDate,
|
|
92
|
+
toDate: currentFilters.toDate,
|
|
93
|
+
ownerIds: currentFilters.byOwners,
|
|
94
|
+
businessIDs: [businessID],
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
[encodedFilters],
|
|
98
|
+
);
|
|
99
|
+
|
|
77
100
|
const { selectableBusinesses: selectOptions, fetching: businessesLoading } = useGetBusinesses();
|
|
78
101
|
|
|
79
102
|
const [selectedBusinessId, setSelectedBusinessId] = useState<string | null>(suggestedId ?? null);
|
|
@@ -85,7 +108,7 @@ export function Counterparty({ data, onChange, enableEdit }: Props): ReactElemen
|
|
|
85
108
|
<div className="flex flex-wrap gap-1 items-center justify-center">
|
|
86
109
|
{counterparty?.id ? (
|
|
87
110
|
<Link
|
|
88
|
-
to={
|
|
111
|
+
to={getHref(counterparty.id)}
|
|
89
112
|
target="_blank"
|
|
90
113
|
rel="noreferrer"
|
|
91
114
|
onClick={event => event.stopPropagation()}
|
package/src/gql/gql.ts
CHANGED
|
@@ -21,12 +21,12 @@ type Documents = {
|
|
|
21
21
|
"\n query BusinessTripsRowValidation($id: UUID!) {\n businessTrip(id: $id) {\n id\n uncategorizedTransactions {\n transaction {\n ... on Transaction @defer {\n id\n }\n }\n }\n summary {\n ... on BusinessTripSummary @defer {\n errors\n }\n }\n }\n }\n": typeof types.BusinessTripsRowValidationDocument,
|
|
22
22
|
"\n query EditableBusinessTrip($businessTripId: UUID!) {\n businessTrip(id: $businessTripId) {\n id\n ...BusinessTripReportHeaderFields\n ...BusinessTripReportAttendeesFields\n ...BusinessTripUncategorizedTransactionsFields\n ...BusinessTripReportFlightsFields\n ...BusinessTripReportAccommodationsFields\n ...BusinessTripReportTravelAndSubsistenceFields\n ...BusinessTripReportCarRentalFields\n ...BusinessTripReportOtherFields\n ...BusinessTripReportSummaryFields\n ... on BusinessTrip {\n uncategorizedTransactions {\n transaction {\n id\n }\n }\n }\n }\n }\n": typeof types.EditableBusinessTripDocument,
|
|
23
23
|
"\n query BusinessTripsScreen {\n allBusinessTrips {\n id\n name\n dates {\n start\n }\n ...BusinessTripsRowFields\n }\n }\n": typeof types.BusinessTripsScreenDocument,
|
|
24
|
-
"\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n
|
|
24
|
+
"\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n withholdingTaxBookNumber\n withholdingTaxFileNumber\n socialSecurityEmployerId\n taxAdvancesRate\n taxAdvancesId\n registrationDate\n }\n }\n }\n": typeof types.BusinessAdminSectionFragmentDoc,
|
|
25
25
|
"\n fragment BusinessHeader on Business {\n __typename\n id\n name\n createdAt\n isActive\n ... on LtdFinancialEntity {\n governmentId\n adminInfo {\n id\n }\n clientInfo {\n id\n }\n }\n }\n": typeof types.BusinessHeaderFragmentDoc,
|
|
26
26
|
"\n query BusinessChargesSection($page: Int, $limit: Int, $filters: ChargeFilter) {\n allCharges(page: $page, limit: $limit, filters: $filters) {\n nodes {\n id\n ...ChargesTableFields\n }\n pageInfo {\n totalPages\n }\n }\n }\n": typeof types.BusinessChargesSectionDocument,
|
|
27
27
|
"\n fragment BusinessConfigurationSection on Business {\n __typename\n id\n pcn874RecordType\n irsCode\n isActive\n ... on LtdFinancialEntity {\n optionalVAT\n exemptDealer\n isReceiptEnough\n isDocumentsOptional\n sortCode {\n id\n key\n defaultIrsCode\n }\n taxCategory {\n id\n }\n suggestions {\n phrases\n emails\n tags {\n id\n }\n description\n emailListener {\n internalEmailLinks\n emailBody\n attachments\n }\n }\n clientInfo {\n id\n }\n }\n }\n": typeof types.BusinessConfigurationSectionFragmentDoc,
|
|
28
28
|
"\n fragment BusinessContactSection on Business {\n __typename\n id\n ... on LtdFinancialEntity {\n name\n hebrewName\n country\n governmentId\n address\n email\n # localAddress\n phoneNumber\n website\n clientInfo {\n id\n emails\n }\n }\n }\n": typeof types.BusinessContactSectionFragmentDoc,
|
|
29
|
-
"\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n
|
|
29
|
+
"\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n purchaseOrders\n startDate\n endDate\n amount {\n raw\n currency\n }\n billingCycle\n isActive\n product\n documentType\n remarks\n plan\n msCloud\n operationsLimit\n }\n }\n": typeof types.ClientContractsSectionDocument,
|
|
30
30
|
"\n fragment BusinessPage on Business {\n id\n ... on LtdFinancialEntity {\n clientInfo {\n id\n }\n adminInfo {\n id\n }\n }\n ...ClientIntegrationsSection\n ...BusinessHeader\n ...BusinessContactSection\n ...BusinessConfigurationSection\n ...BusinessAdminSection\n }\n": typeof types.BusinessPageFragmentDoc,
|
|
31
31
|
"\n fragment ClientIntegrationsSection on LtdFinancialEntity {\n id\n clientInfo {\n id\n greenInvoiceId\n hiveId\n }\n }\n": typeof types.ClientIntegrationsSectionFragmentDoc,
|
|
32
32
|
"\n query ClientIntegrationsSectionGreenInvoice($clientId: UUID!) {\n greenInvoiceClient(clientId: $clientId) {\n id\n country\n emails\n name\n phone\n taxId\n address\n city\n zip\n fax\n mobile\n }\n }\n": typeof types.ClientIntegrationsSectionGreenInvoiceDocument,
|
|
@@ -211,7 +211,7 @@ type Documents = {
|
|
|
211
211
|
"\n mutation DeleteTag($tagId: UUID!) {\n deleteTag(id: $tagId)\n }\n": typeof types.DeleteTagDocument,
|
|
212
212
|
"\n mutation FetchIncomeDocuments($ownerId: UUID!) {\n fetchIncomeDocuments(ownerId: $ownerId) {\n id\n ...NewFetchedDocumentFields\n }\n }\n": typeof types.FetchIncomeDocumentsDocument,
|
|
213
213
|
"\n query AllClients {\n allClients {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n }\n": typeof types.AllClientsDocument,
|
|
214
|
-
"\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n
|
|
214
|
+
"\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n purchaseOrders\n startDate\n endDate\n remarks\n amount {\n raw\n currency\n formatted\n }\n documentType\n billingCycle\n isActive\n product\n plan\n msCloud\n }\n }\n": typeof types.AllOpenContractsDocument,
|
|
215
215
|
"\n query AllBusinesses {\n allBusinesses {\n nodes {\n id\n name\n }\n }\n }\n": typeof types.AllBusinessesDocument,
|
|
216
216
|
"\n query AllCountries {\n allCountries {\n id\n name\n code\n }\n }\n": typeof types.AllCountriesDocument,
|
|
217
217
|
"\n query AllFinancialEntities {\n allFinancialEntities {\n nodes {\n id\n name\n }\n }\n }\n": typeof types.AllFinancialEntitiesDocument,
|
|
@@ -273,12 +273,12 @@ const documents: Documents = {
|
|
|
273
273
|
"\n query BusinessTripsRowValidation($id: UUID!) {\n businessTrip(id: $id) {\n id\n uncategorizedTransactions {\n transaction {\n ... on Transaction @defer {\n id\n }\n }\n }\n summary {\n ... on BusinessTripSummary @defer {\n errors\n }\n }\n }\n }\n": types.BusinessTripsRowValidationDocument,
|
|
274
274
|
"\n query EditableBusinessTrip($businessTripId: UUID!) {\n businessTrip(id: $businessTripId) {\n id\n ...BusinessTripReportHeaderFields\n ...BusinessTripReportAttendeesFields\n ...BusinessTripUncategorizedTransactionsFields\n ...BusinessTripReportFlightsFields\n ...BusinessTripReportAccommodationsFields\n ...BusinessTripReportTravelAndSubsistenceFields\n ...BusinessTripReportCarRentalFields\n ...BusinessTripReportOtherFields\n ...BusinessTripReportSummaryFields\n ... on BusinessTrip {\n uncategorizedTransactions {\n transaction {\n id\n }\n }\n }\n }\n }\n": types.EditableBusinessTripDocument,
|
|
275
275
|
"\n query BusinessTripsScreen {\n allBusinessTrips {\n id\n name\n dates {\n start\n }\n ...BusinessTripsRowFields\n }\n }\n": types.BusinessTripsScreenDocument,
|
|
276
|
-
"\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n
|
|
276
|
+
"\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n withholdingTaxBookNumber\n withholdingTaxFileNumber\n socialSecurityEmployerId\n taxAdvancesRate\n taxAdvancesId\n registrationDate\n }\n }\n }\n": types.BusinessAdminSectionFragmentDoc,
|
|
277
277
|
"\n fragment BusinessHeader on Business {\n __typename\n id\n name\n createdAt\n isActive\n ... on LtdFinancialEntity {\n governmentId\n adminInfo {\n id\n }\n clientInfo {\n id\n }\n }\n }\n": types.BusinessHeaderFragmentDoc,
|
|
278
278
|
"\n query BusinessChargesSection($page: Int, $limit: Int, $filters: ChargeFilter) {\n allCharges(page: $page, limit: $limit, filters: $filters) {\n nodes {\n id\n ...ChargesTableFields\n }\n pageInfo {\n totalPages\n }\n }\n }\n": types.BusinessChargesSectionDocument,
|
|
279
279
|
"\n fragment BusinessConfigurationSection on Business {\n __typename\n id\n pcn874RecordType\n irsCode\n isActive\n ... on LtdFinancialEntity {\n optionalVAT\n exemptDealer\n isReceiptEnough\n isDocumentsOptional\n sortCode {\n id\n key\n defaultIrsCode\n }\n taxCategory {\n id\n }\n suggestions {\n phrases\n emails\n tags {\n id\n }\n description\n emailListener {\n internalEmailLinks\n emailBody\n attachments\n }\n }\n clientInfo {\n id\n }\n }\n }\n": types.BusinessConfigurationSectionFragmentDoc,
|
|
280
280
|
"\n fragment BusinessContactSection on Business {\n __typename\n id\n ... on LtdFinancialEntity {\n name\n hebrewName\n country\n governmentId\n address\n email\n # localAddress\n phoneNumber\n website\n clientInfo {\n id\n emails\n }\n }\n }\n": types.BusinessContactSectionFragmentDoc,
|
|
281
|
-
"\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n
|
|
281
|
+
"\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n purchaseOrders\n startDate\n endDate\n amount {\n raw\n currency\n }\n billingCycle\n isActive\n product\n documentType\n remarks\n plan\n msCloud\n operationsLimit\n }\n }\n": types.ClientContractsSectionDocument,
|
|
282
282
|
"\n fragment BusinessPage on Business {\n id\n ... on LtdFinancialEntity {\n clientInfo {\n id\n }\n adminInfo {\n id\n }\n }\n ...ClientIntegrationsSection\n ...BusinessHeader\n ...BusinessContactSection\n ...BusinessConfigurationSection\n ...BusinessAdminSection\n }\n": types.BusinessPageFragmentDoc,
|
|
283
283
|
"\n fragment ClientIntegrationsSection on LtdFinancialEntity {\n id\n clientInfo {\n id\n greenInvoiceId\n hiveId\n }\n }\n": types.ClientIntegrationsSectionFragmentDoc,
|
|
284
284
|
"\n query ClientIntegrationsSectionGreenInvoice($clientId: UUID!) {\n greenInvoiceClient(clientId: $clientId) {\n id\n country\n emails\n name\n phone\n taxId\n address\n city\n zip\n fax\n mobile\n }\n }\n": types.ClientIntegrationsSectionGreenInvoiceDocument,
|
|
@@ -463,7 +463,7 @@ const documents: Documents = {
|
|
|
463
463
|
"\n mutation DeleteTag($tagId: UUID!) {\n deleteTag(id: $tagId)\n }\n": types.DeleteTagDocument,
|
|
464
464
|
"\n mutation FetchIncomeDocuments($ownerId: UUID!) {\n fetchIncomeDocuments(ownerId: $ownerId) {\n id\n ...NewFetchedDocumentFields\n }\n }\n": types.FetchIncomeDocumentsDocument,
|
|
465
465
|
"\n query AllClients {\n allClients {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n }\n": types.AllClientsDocument,
|
|
466
|
-
"\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n
|
|
466
|
+
"\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n purchaseOrders\n startDate\n endDate\n remarks\n amount {\n raw\n currency\n formatted\n }\n documentType\n billingCycle\n isActive\n product\n plan\n msCloud\n }\n }\n": types.AllOpenContractsDocument,
|
|
467
467
|
"\n query AllBusinesses {\n allBusinesses {\n nodes {\n id\n name\n }\n }\n }\n": types.AllBusinessesDocument,
|
|
468
468
|
"\n query AllCountries {\n allCountries {\n id\n name\n code\n }\n }\n": types.AllCountriesDocument,
|
|
469
469
|
"\n query AllFinancialEntities {\n allFinancialEntities {\n nodes {\n id\n name\n }\n }\n }\n": types.AllFinancialEntitiesDocument,
|
|
@@ -563,7 +563,7 @@ export function graphql(source: "\n query BusinessTripsScreen {\n allBusines
|
|
|
563
563
|
/**
|
|
564
564
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
565
565
|
*/
|
|
566
|
-
export function graphql(source: "\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n
|
|
566
|
+
export function graphql(source: "\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n withholdingTaxBookNumber\n withholdingTaxFileNumber\n socialSecurityEmployerId\n taxAdvancesRate\n taxAdvancesId\n registrationDate\n }\n }\n }\n"): (typeof documents)["\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n withholdingTaxBookNumber\n withholdingTaxFileNumber\n socialSecurityEmployerId\n taxAdvancesRate\n taxAdvancesId\n registrationDate\n }\n }\n }\n"];
|
|
567
567
|
/**
|
|
568
568
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
569
569
|
*/
|
|
@@ -583,7 +583,7 @@ export function graphql(source: "\n fragment BusinessContactSection on Business
|
|
|
583
583
|
/**
|
|
584
584
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
585
585
|
*/
|
|
586
|
-
export function graphql(source: "\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n
|
|
586
|
+
export function graphql(source: "\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n purchaseOrders\n startDate\n endDate\n amount {\n raw\n currency\n }\n billingCycle\n isActive\n product\n documentType\n remarks\n plan\n msCloud\n operationsLimit\n }\n }\n"): (typeof documents)["\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n purchaseOrders\n startDate\n endDate\n amount {\n raw\n currency\n }\n billingCycle\n isActive\n product\n documentType\n remarks\n plan\n msCloud\n operationsLimit\n }\n }\n"];
|
|
587
587
|
/**
|
|
588
588
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
589
589
|
*/
|
|
@@ -1323,7 +1323,7 @@ export function graphql(source: "\n query AllClients {\n allClients {\n
|
|
|
1323
1323
|
/**
|
|
1324
1324
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1325
1325
|
*/
|
|
1326
|
-
export function graphql(source: "\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n
|
|
1326
|
+
export function graphql(source: "\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n purchaseOrders\n startDate\n endDate\n remarks\n amount {\n raw\n currency\n formatted\n }\n documentType\n billingCycle\n isActive\n product\n plan\n msCloud\n }\n }\n"): (typeof documents)["\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n purchaseOrders\n startDate\n endDate\n remarks\n amount {\n raw\n currency\n formatted\n }\n documentType\n billingCycle\n isActive\n product\n plan\n msCloud\n }\n }\n"];
|
|
1327
1327
|
/**
|
|
1328
1328
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1329
1329
|
*/
|