@accounter/client 0.0.8-alpha-20251028123001-a8ce4e53bbde9f6eeded7bfeea650700f6a63130 → 0.0.8-alpha-20251028124234-328844c99a42b68aa9e2f32fd86da80b4832f631
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 +13 -27
- package/dist/assets/{Checkbox-sjgv9dlI.js → Checkbox-BR6kGuhg.js} +2 -2
- package/dist/assets/MultiSelect-BqcJrWnD.js +1 -0
- package/dist/assets/Pagination-6Sv5LXxl.js +1 -0
- package/dist/assets/{Progress-DKypjBbn.js → Progress-7xtiFwK3.js} +1 -1
- package/dist/assets/Table-C5zxD95i.js +1 -0
- package/dist/assets/Typography-CMzSQZKD.js +1 -0
- package/dist/assets/YearPickerInput-CllwSjcn.js +1 -0
- package/dist/assets/{accordion-Cfc9ae4H.js → accordion-CMR2fANH.js} +1 -1
- package/dist/assets/accountant-approvals-BHFXpHHc.js +1 -0
- package/dist/assets/accounter-table-CpeQD4PG.js +1 -0
- package/dist/assets/addDays-DvwuJbUs.js +1 -0
- package/dist/assets/all-charges-At7WJXuW.js +1 -0
- package/dist/assets/{arrow-up-down-DapQ791y.js → arrow-up-down-DPG1l9S1.js} +1 -1
- package/dist/assets/{building-2-B5JpJWrx.js → building-2-BgvPBt2Z.js} +1 -1
- package/dist/assets/business-DKvbSnga.js +32 -0
- package/dist/assets/business-extended-info-7CM8px2e.js +13 -0
- package/dist/assets/{business-header-BK89Rfvy.js → business-header-u2sfE_d8.js} +1 -1
- package/dist/assets/business-transactions-filters-DmpO9Bwo.js +1 -0
- package/dist/assets/business-transactions-single-rF6JbAL7.js +1 -0
- package/dist/assets/business-trip-BGrp09N7.js +1 -0
- package/dist/assets/charge-C-EaA1Xc.js +1 -0
- package/dist/assets/charges-filters-Dq-8QHH-.js +1 -0
- package/dist/assets/charges-ledger-validation-DlkzVow7.js +1 -0
- package/dist/assets/charges-table-Cncs1HLi.js +62 -0
- package/dist/assets/{chart-0bAgDGey.js → chart-ByngRufj.js} +6 -6
- package/dist/assets/create-event-handler-BiA-1lGu.js +1 -0
- package/dist/assets/{data-table-pagination-BgCuddCb.js → data-table-pagination-D4OEFmX_.js} +1 -1
- package/dist/assets/download-csv-button-Df5rDeDc.js +1 -0
- package/dist/assets/editable-business-trip-Bav24z0u.js +16 -0
- package/dist/assets/funnel-BJ71hzoq.js +6 -0
- package/dist/assets/index-BRv0JZw4.js +1 -0
- package/dist/assets/index-BXlS8oD_.js +1 -0
- package/dist/assets/{index-DaSgVGNd.js → index-BetG0HVN.js} +3 -3
- package/dist/assets/index-BplSRMAq.css +1 -0
- package/dist/assets/{index-Dnafld8G.js → index-Bsl7tJp_.js} +16 -16
- package/dist/assets/{index-DLRffFbF.js → index-CLUhAJ3t.js} +7 -7
- package/dist/assets/index-Cix5qjA-.js +2 -0
- package/dist/assets/index-CizLtiES.js +1 -0
- package/dist/assets/index-DKBzv0gc.js +1 -0
- package/dist/assets/index-DR_5jpS4.js +6 -0
- package/dist/assets/index-DTmtILfq.js +1 -0
- package/dist/assets/index-DU0G7FZm.js +1 -0
- package/dist/assets/index-DUWRgLfu.js +9 -0
- package/dist/assets/index-DYZPWG4k.js +2 -0
- package/dist/assets/index-DdUE2_44.js +1 -0
- package/dist/assets/index-De5dvO0S.js +1 -0
- package/dist/assets/index-Des3eR4f.js +1 -0
- package/dist/assets/index-DpYwi5kf.js +6 -0
- package/dist/assets/index-GzyQZkbY.js +1 -0
- package/dist/assets/index-HzLXi-qB.js +1 -0
- package/dist/assets/index-Ji28AZwq.js +1 -0
- package/dist/assets/{index-D92U_VYB.js → index-UMFH47hN.js} +2 -2
- package/dist/assets/index-fuT9duEO.js +1 -0
- package/dist/assets/{index-BBpGo89I.js → index-vChLJwSt.js} +2 -2
- package/dist/assets/index-wck8Xuay.js +1 -0
- package/dist/assets/index-wyU9I4Kz.js +768 -0
- package/dist/assets/{index.es-JpTIgXoh.js → index.es-NphQjU3m.js} +1 -1
- package/dist/assets/insert-business-trip-modal-vS1QrUJz.js +6 -0
- package/dist/assets/issue-document-pIswc_8i.js +1 -0
- package/dist/assets/list-plus-Dy3vzJVy.js +6 -0
- package/dist/assets/login-page-YXRfklK1.js +1 -0
- package/dist/assets/match-document-modal-BPG_hljb.js +16 -0
- package/dist/assets/missing-info-charges-D8dUfChs.js +1 -0
- package/dist/assets/modal-D47umnak.js +1 -0
- package/dist/assets/page-layout-BG0XvWfD.js +1 -0
- package/dist/assets/page-not-found-Cy6oIIb1.js +1 -0
- package/dist/assets/panel-top-open-B1rhJYjQ.js +11 -0
- package/dist/assets/{pencil-CEfu8zQ4.js → pencil-tV0FsM6V.js} +1 -1
- package/dist/assets/report-commentary-row-BL2RkIHq.js +1 -0
- package/dist/assets/{save-Drpbh6u3.js → save-Czmh3tvC.js} +1 -1
- package/dist/assets/similar-transactions-modal-MQeC2gtu.js +1 -0
- package/dist/assets/sub-B4_VmmF9.js +1 -0
- package/dist/assets/subMonths-DG7w6bCY.js +1 -0
- package/dist/assets/summary-DvHtnArZ.js +1 -0
- package/dist/assets/switch-GSloW_Ey.js +1 -0
- package/dist/assets/toggle-expansion-button-lwJYTklN.js +1 -0
- package/dist/assets/tooltip-BbKSwLCX.js +1 -0
- package/dist/assets/use-url-query-CUVSXgm0.js +1 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/components/business/contracts-section.tsx +4 -18
- package/src/components/business-transactions/business-extended-info.tsx +5 -5
- package/src/components/business-transactions/index.tsx +1 -28
- package/src/components/businesses/index.tsx +6 -2
- package/src/components/charges/cells/business-trip.tsx +6 -1
- package/src/components/charges/cells/counterparty.tsx +4 -28
- package/src/components/clients/contracts/modify-contract-dialog.tsx +11 -64
- 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 +2 -1
- package/src/components/common/business-trip-report/parts/uncategorized-transactions.tsx +2 -2
- package/src/components/common/buttons/charge-navigate-button.tsx +12 -11
- package/src/components/common/modals/edit-charge-modal.tsx +2 -2
- 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 +2 -11
- package/src/components/documents-table/cells/debtor.tsx +2 -11
- package/src/components/ledger-table/counterparty-cell.tsx +4 -33
- package/src/components/reports/conto/index.tsx +1 -18
- package/src/components/reports/trial-balance-report/index.tsx +1 -17
- package/src/components/screens/businesses/business.tsx +0 -4
- package/src/components/screens/charges/all-charges.tsx +1 -17
- package/src/components/screens/charges/charge.tsx +0 -4
- package/src/components/screens/reports/balance-report/index.tsx +0 -14
- package/src/components/screens/reports/depreciation-report/index.tsx +0 -14
- package/src/components/transactions-table/cells/counterparty.tsx +2 -23
- package/src/components/transactions-table/cells-legacy/counterparty.tsx +3 -26
- package/src/gql/gql.ts +6 -6
- package/src/gql/graphql.ts +7 -7
- package/src/hooks/use-get-all-contracts.ts +1 -1
- package/src/providers/urql.tsx +2 -2
- package/dist/assets/Typography-CJfovWMc.js +0 -1
- package/dist/assets/accountant-approvals-DhCtddzR.js +0 -1
- package/dist/assets/all-charges-H_xH1cUe.js +0 -1
- package/dist/assets/business-BtKmlUZR.js +0 -32
- package/dist/assets/business-transactions-single-Dv6-AKgI.js +0 -1
- package/dist/assets/business-trip-DIBdq8Jq.js +0 -1
- package/dist/assets/charges-filters-CTMCRKNm.js +0 -1
- package/dist/assets/charges-ledger-validation-c6jklgQz.js +0 -1
- package/dist/assets/editable-business-trip-Cr87pQT-.js +0 -16
- package/dist/assets/index-B8QopG0Z.js +0 -1
- package/dist/assets/index-BVZuWqUd.js +0 -1
- package/dist/assets/index-Bt7NK9UB.js +0 -1
- package/dist/assets/index-CBPTpZHL.css +0 -1
- package/dist/assets/index-CKfzp5hU.js +0 -1
- package/dist/assets/index-CTzkpoqF.js +0 -2
- package/dist/assets/index-CaSs1tPq.js +0 -1
- package/dist/assets/index-Cgl63fgb.js +0 -1
- package/dist/assets/index-ChwFk-6u.js +0 -1
- package/dist/assets/index-CnHbGv9H.js +0 -1
- package/dist/assets/index-CnKUadG6.js +0 -886
- package/dist/assets/index-CpqDv0tU.js +0 -1
- package/dist/assets/index-CtfXFlRt.js +0 -1
- package/dist/assets/index-Cyg6_G-8.js +0 -9
- package/dist/assets/index-b4v6_EXH.js +0 -6
- package/dist/assets/index-f6-rwrBW.js +0 -1
- package/dist/assets/index-mXqFMX5P.js +0 -1
- package/dist/assets/index-sUDYfUlt.js +0 -1
- package/dist/assets/index-tgi4TEs-.js +0 -2
- package/dist/assets/issue-document-CejQASYM.js +0 -1
- package/dist/assets/login-page-ByDrdoxH.js +0 -1
- package/dist/assets/missing-info-charges-DHt03bdz.js +0 -1
- package/dist/assets/page-not-found-Bhi5OU5Q.js +0 -1
- package/dist/assets/report-commentary-row-CmDH8P-d.js +0 -1
- package/dist/assets/sub-DBgZtyi3.js +0 -1
- package/dist/assets/subMonths-J6RX2Vo3.js +0 -1
- package/src/components/charges/helpers.ts +0 -15
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
2
|
import { Link } from 'react-router-dom';
|
|
3
|
-
import
|
|
4
|
-
import { useUrlQuery } from '../../hooks/use-url-query.js';
|
|
5
|
-
import { getBusinessTransactionsHref } from '../business-transactions/index.js';
|
|
3
|
+
import { ROUTES } from '@/router/routes.js';
|
|
6
4
|
|
|
7
5
|
type Props = {
|
|
8
6
|
account?: {
|
|
@@ -16,33 +14,6 @@ type Props = {
|
|
|
16
14
|
};
|
|
17
15
|
|
|
18
16
|
export const CounterpartyCell = ({ account, diffAccount }: Props): ReactElement => {
|
|
19
|
-
const { get } = useUrlQuery();
|
|
20
|
-
|
|
21
|
-
const encodedFilters = get('chargesFilters');
|
|
22
|
-
|
|
23
|
-
const getHref = useCallback(
|
|
24
|
-
(businessID: string) => {
|
|
25
|
-
let currentFilters: ChargeFilter = {};
|
|
26
|
-
if (encodedFilters) {
|
|
27
|
-
try {
|
|
28
|
-
const decoded = decodeURIComponent(encodedFilters);
|
|
29
|
-
const parsed = JSON.parse(decoded);
|
|
30
|
-
currentFilters = parsed as ChargeFilter;
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.error('Failed to parse filters from URL:', error);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return getBusinessTransactionsHref({
|
|
37
|
-
ownerIds: currentFilters.byOwners || [],
|
|
38
|
-
businessIDs: [businessID],
|
|
39
|
-
...(currentFilters.fromDate && { fromDate: currentFilters.fromDate }),
|
|
40
|
-
...(currentFilters.toDate && { toDate: currentFilters.toDate }),
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
[encodedFilters],
|
|
44
|
-
);
|
|
45
|
-
|
|
46
17
|
const isAccountDiff = diffAccount && diffAccount?.id !== account?.id;
|
|
47
18
|
|
|
48
19
|
return (
|
|
@@ -51,7 +22,7 @@ export const CounterpartyCell = ({ account, diffAccount }: Props): ReactElement
|
|
|
51
22
|
<>
|
|
52
23
|
{account && (
|
|
53
24
|
<Link
|
|
54
|
-
to={
|
|
25
|
+
to={ROUTES.BUSINESSES.DETAIL(account.id)}
|
|
55
26
|
target="_blank"
|
|
56
27
|
rel="noreferrer"
|
|
57
28
|
onClick={event => event.stopPropagation()}
|
|
@@ -63,7 +34,7 @@ export const CounterpartyCell = ({ account, diffAccount }: Props): ReactElement
|
|
|
63
34
|
{isAccountDiff && diffAccount && (
|
|
64
35
|
<div className="border-2 border-yellow-500 rounded-md">
|
|
65
36
|
<Link
|
|
66
|
-
to={
|
|
37
|
+
to={ROUTES.BUSINESSES.DETAIL(diffAccount.id)}
|
|
67
38
|
target="_blank"
|
|
68
39
|
rel="noreferrer"
|
|
69
40
|
onClick={event => event.stopPropagation()}
|
|
@@ -19,11 +19,7 @@ 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 {
|
|
23
|
-
ContoReportFilters,
|
|
24
|
-
encodeContoReportFilters,
|
|
25
|
-
type ContoReportFiltersType,
|
|
26
|
-
} from './conto-report-filters.js';
|
|
22
|
+
import { ContoReportFilters, type ContoReportFiltersType } from './conto-report-filters.js';
|
|
27
23
|
import { ManageTemplates } from './conto-report-manage-templates.js';
|
|
28
24
|
import { SaveTemplate } from './conto-report-save-template.js';
|
|
29
25
|
import { DownloadCSV } from './download-csv.js';
|
|
@@ -93,19 +89,6 @@ const BANK_TREE_ROOT_ID = 'bank';
|
|
|
93
89
|
export const REPORT_TREE_ROOT_ID = 'report';
|
|
94
90
|
export const CONTO_REPORT_FILTERS_KEY = 'contoReportFilters';
|
|
95
91
|
|
|
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
|
-
|
|
109
92
|
function buildSortCodeFinancialEntitiesMaps(tree: NodeModel<CustomData>[]) {
|
|
110
93
|
const sortCodeMap = new Map<number, string | number>();
|
|
111
94
|
const financialEntitiesMap = new Map<string, string | number>();
|
|
@@ -7,10 +7,7 @@ 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 {
|
|
11
|
-
encodeTrialBalanceReportFilters,
|
|
12
|
-
TrialBalanceReportFilters,
|
|
13
|
-
} from './trial-balance-report-filters.js';
|
|
10
|
+
import { TrialBalanceReportFilters } from './trial-balance-report-filters.js';
|
|
14
11
|
import { TrialBalanceTable } from './trial-balance-table.js';
|
|
15
12
|
|
|
16
13
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
|
|
@@ -27,19 +24,6 @@ import { TrialBalanceTable } from './trial-balance-table.js';
|
|
|
27
24
|
}
|
|
28
25
|
`;
|
|
29
26
|
|
|
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
|
-
|
|
43
27
|
export const TrialBalanceReport = (): ReactElement => {
|
|
44
28
|
const [isAllOpened, setIsAllOpened] = useState(false);
|
|
45
29
|
const { get } = useUrlQuery();
|
|
@@ -15,10 +15,6 @@ 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
|
-
|
|
22
18
|
export const BusinessScreen = (): ReactElement => {
|
|
23
19
|
const { businessId } = useParams<{ businessId: string }>();
|
|
24
20
|
|
|
@@ -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
|
|
8
|
+
import { ChargesFilters } from '../../charges/charges-filters.js';
|
|
9
9
|
import { ChargesTable } from '../../charges/charges-table.js';
|
|
10
10
|
import {
|
|
11
11
|
EditChargeModal,
|
|
@@ -31,22 +31,6 @@ 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
|
-
|
|
50
34
|
export const AllCharges = (): ReactElement => {
|
|
51
35
|
const { setFiltersContext } = useContext(FiltersContext);
|
|
52
36
|
const [editChargeId, setEditChargeId] = useState<
|
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
BALANCE_REPORT_FILTERS_QUERY_PARAM,
|
|
27
27
|
BalanceReportFilters,
|
|
28
|
-
encodeBalanceReportFilters,
|
|
29
28
|
Periods,
|
|
30
29
|
type BalanceReportFilter,
|
|
31
30
|
type Period,
|
|
@@ -60,19 +59,6 @@ import { ExtendedTransactionsCard } from './extended-transactions.jsx';
|
|
|
60
59
|
}
|
|
61
60
|
`;
|
|
62
61
|
|
|
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
|
-
|
|
76
62
|
const chartConfig = {
|
|
77
63
|
income: {
|
|
78
64
|
label: 'Income',
|
|
@@ -22,7 +22,6 @@ import { DepreciationRecordRow } from './depreciation-record-row.js';
|
|
|
22
22
|
import {
|
|
23
23
|
DEPRECIATION_REPORT_FILTERS_QUERY_PARAM,
|
|
24
24
|
DepreciationReportFilters,
|
|
25
|
-
encodeDepreciationReportFilters,
|
|
26
25
|
} from './depreciation-report-filters.js';
|
|
27
26
|
import { DepreciationSummaryRow } from './depreciation-summary-row.js';
|
|
28
27
|
|
|
@@ -76,19 +75,6 @@ import { DepreciationSummaryRow } from './depreciation-summary-row.js';
|
|
|
76
75
|
}
|
|
77
76
|
`;
|
|
78
77
|
|
|
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
|
-
|
|
92
78
|
export const DepreciationReport = (): ReactElement => {
|
|
93
79
|
const { setFiltersContext } = useContext(FiltersContext);
|
|
94
80
|
const { userContext } = useContext(UserContext);
|
|
@@ -1,11 +1,9 @@
|
|
|
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 { ROUTES } from '@/router/routes.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';
|
|
9
7
|
import { SelectWithSearch, Tooltip } from '../../common/index.js';
|
|
10
8
|
import { InsertBusiness } from '../../common/modals/insert-business.jsx';
|
|
11
9
|
import { SimilarTransactionsModal } from '../../common/modals/similar-transactions-modal.jsx';
|
|
@@ -18,7 +16,6 @@ type Props = {
|
|
|
18
16
|
};
|
|
19
17
|
|
|
20
18
|
export function Counterparty({ transaction, onChange }: Props): ReactElement {
|
|
21
|
-
const { get } = useUrlQuery();
|
|
22
19
|
const {
|
|
23
20
|
id,
|
|
24
21
|
counterparty,
|
|
@@ -58,24 +55,6 @@ export function Counterparty({ transaction, onChange }: Props): ReactElement {
|
|
|
58
55
|
[updateBusiness, onChange],
|
|
59
56
|
);
|
|
60
57
|
|
|
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
|
-
|
|
79
58
|
const { selectableBusinesses: selectOptions, fetching: businessesLoading } = useGetBusinesses();
|
|
80
59
|
|
|
81
60
|
const [selectedBusinessId, setSelectedBusinessId] = useState<string | null>(suggestedId ?? null);
|
|
@@ -87,7 +66,7 @@ export function Counterparty({ transaction, onChange }: Props): ReactElement {
|
|
|
87
66
|
<div className="flex flex-wrap flex-col justify-center">
|
|
88
67
|
{counterparty?.id ? (
|
|
89
68
|
<Link
|
|
90
|
-
to={
|
|
69
|
+
to={ROUTES.BUSINESSES.DETAIL(counterparty.id)}
|
|
91
70
|
target="_blank"
|
|
92
71
|
rel="noreferrer"
|
|
93
72
|
onClick={event => event.stopPropagation()}
|
|
@@ -1,15 +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 {
|
|
5
|
-
|
|
6
|
-
type ChargeFilter,
|
|
7
|
-
} from '../../../gql/graphql.js';
|
|
4
|
+
import { ROUTES } from '@/router/routes.js';
|
|
5
|
+
import { TransactionsTableEntityFieldsFragmentDoc } from '../../../gql/graphql.js';
|
|
8
6
|
import { getFragmentData, type FragmentType } from '../../../gql/index.js';
|
|
9
7
|
import { useGetBusinesses } from '../../../hooks/use-get-businesses.js';
|
|
10
8
|
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';
|
|
13
9
|
import { SelectWithSearch, Tooltip } from '../../common/index.js';
|
|
14
10
|
import { InsertBusiness } from '../../common/modals/insert-business.js';
|
|
15
11
|
import { SimilarTransactionsModal } from '../../common/modals/similar-transactions-modal.js';
|
|
@@ -40,7 +36,6 @@ type Props = {
|
|
|
40
36
|
};
|
|
41
37
|
|
|
42
38
|
export function Counterparty({ data, onChange, enableEdit }: Props): ReactElement {
|
|
43
|
-
const { get } = useUrlQuery();
|
|
44
39
|
const {
|
|
45
40
|
id,
|
|
46
41
|
counterparty,
|
|
@@ -79,24 +74,6 @@ export function Counterparty({ data, onChange, enableEdit }: Props): ReactElemen
|
|
|
79
74
|
[updateBusiness, onChange],
|
|
80
75
|
);
|
|
81
76
|
|
|
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
|
-
|
|
100
77
|
const { selectableBusinesses: selectOptions, fetching: businessesLoading } = useGetBusinesses();
|
|
101
78
|
|
|
102
79
|
const [selectedBusinessId, setSelectedBusinessId] = useState<string | null>(suggestedId ?? null);
|
|
@@ -108,7 +85,7 @@ export function Counterparty({ data, onChange, enableEdit }: Props): ReactElemen
|
|
|
108
85
|
<div className="flex flex-wrap gap-1 items-center justify-center">
|
|
109
86
|
{counterparty?.id ? (
|
|
110
87
|
<Link
|
|
111
|
-
to={
|
|
88
|
+
to={ROUTES.BUSINESSES.DETAIL(counterparty.id)}
|
|
112
89
|
target="_blank"
|
|
113
90
|
rel="noreferrer"
|
|
114
91
|
onClick={event => event.stopPropagation()}
|
package/src/gql/gql.ts
CHANGED
|
@@ -26,7 +26,7 @@ type Documents = {
|
|
|
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 purchaseOrder\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 }\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 purchaseOrder\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,
|
|
@@ -278,7 +278,7 @@ const documents: Documents = {
|
|
|
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 purchaseOrder\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 }\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 purchaseOrder\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,
|
|
@@ -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 purchaseOrder\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 }\n }\n"): (typeof documents)["\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n purchaseOrder\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 }\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 purchaseOrder\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 purchaseOrder\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
|
*/
|