@accounter/client 0.0.8-alpha-20251028124537-8b0946b10a6e597c997017c33fb80fbf674e2feb → 0.0.8-alpha-20251028215158-b475240670e9e6781f4489d82073639fcee594d5
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 +16 -4
- package/dist/assets/{Checkbox-DBiOK2wr.js → Checkbox-CSPHEKoR.js} +2 -2
- package/dist/assets/MultiSelect-CszuVk07.js +1 -0
- package/dist/assets/Pagination-Cp6iKPSu.js +1 -0
- package/dist/assets/{Progress-3b9RPwUr.js → Progress-ByaKYSXX.js} +1 -1
- package/dist/assets/Table-CQ4GTcIY.js +1 -0
- package/dist/assets/Typography-Cn08y9HC.js +1 -0
- package/dist/assets/YearPickerInput-BsQymTcP.js +1 -0
- package/dist/assets/accordion-CG93-Cqs.js +1 -0
- package/dist/assets/accountant-approvals-Dxy1hGw7.js +1 -0
- package/dist/assets/accounter-table-Dgvw-xm_.js +1 -0
- package/dist/assets/addDays-Di-hbHs3.js +1 -0
- package/dist/assets/all-charges-DRl4EcMG.js +1 -0
- package/dist/assets/{arrow-up-down-B3nz1j1G.js → arrow-up-down-Hh3TlLSU.js} +1 -1
- package/dist/assets/{building-2-DyCA1u9z.js → building-2-DGfYgfU_.js} +1 -1
- package/dist/assets/{business-BOAeYn9N.js → business-aamFaOhr.js} +3 -3
- package/dist/assets/business-extended-info-CeEMIazB.js +13 -0
- package/dist/assets/{business-header-Ck0v04Iw.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-D-99eJ1v.js +1 -0
- package/dist/assets/charges-filters-Dxaf2lVd.js +1 -0
- package/dist/assets/charges-ledger-validation-BAY3PYth.js +1 -0
- package/dist/assets/charges-table-CNWVDMmv.js +62 -0
- package/dist/assets/{chart-xV-krckX.js → chart-DM5P1yGj.js} +6 -6
- package/dist/assets/create-event-handler-BiA-1lGu.js +1 -0
- package/dist/assets/{data-table-pagination-BtKmZaSS.js → data-table-pagination-TG7sqb1-.js} +1 -1
- package/dist/assets/download-csv-button-jQXIlRax.js +1 -0
- package/dist/assets/editable-business-trip-DlAsZ0aQ.js +16 -0
- package/dist/assets/funnel-BQEGwl1q.js +6 -0
- package/dist/assets/index--OgMtW-2.js +2 -0
- package/dist/assets/index-B-USUC2v.js +1 -0
- package/dist/assets/index-BYfofaiM.js +1 -0
- package/dist/assets/index-BmZql10x.js +773 -0
- package/dist/assets/index-CFY-4iKE.js +1 -0
- package/dist/assets/index-CGQclWiq.js +1 -0
- package/dist/assets/index-CIY9x3TF.js +6 -0
- package/dist/assets/index-CJEUQmMx.js +1 -0
- package/dist/assets/{index-KFd7K_WR.js → index-CXRSu47J.js} +2 -2
- package/dist/assets/index-CiXTFJcq.js +9 -0
- package/dist/assets/{index-DuBbCD-l.js → index-CkIv3Veq.js} +16 -16
- package/dist/assets/index-ClzPFBOc.js +2 -0
- package/dist/assets/{index-CWM7AEkA.js → index-CzEcZ0Dn.js} +2 -2
- package/dist/assets/index-D9zE4pLO.js +1 -0
- package/dist/assets/{index-C3BnUF_U.js → index-DKjsW6q7.js} +3 -3
- package/dist/assets/index-DOh5XsM3.js +6 -0
- 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-DkKTDpFK.js +1 -0
- package/dist/assets/index-DnFwBDCa.js +1 -0
- package/dist/assets/index-Dt4KpoN0.js +1 -0
- package/dist/assets/{index-DypFylYK.js → index-IuUe41KG.js} +3 -3
- package/dist/assets/index-NofRnQ8o.js +1 -0
- package/dist/assets/index-WaN-m0WB.js +1 -0
- package/dist/assets/index-juMfNCjV.js +1 -0
- package/dist/assets/{index.es-C6nk1zNp.js → index.es-BJEu0vdb.js} +1 -1
- package/dist/assets/insert-business-trip-modal-CXgUJdgl.js +6 -0
- package/dist/assets/issue-document-BSkWYnI5.js +1 -0
- package/dist/assets/list-plus-BlHtPDEN.js +6 -0
- package/dist/assets/login-page-DmCLAM1G.js +1 -0
- package/dist/assets/match-document-modal-KjnSxB69.js +16 -0
- package/dist/assets/missing-info-charges-BiEeQwER.js +1 -0
- package/dist/assets/modal-dLkQjDNz.js +1 -0
- package/dist/assets/page-layout-DxGYaCiw.js +1 -0
- package/dist/assets/page-not-found-ChLEFKCs.js +1 -0
- package/dist/assets/panel-top-open-CWsfFRNu.js +11 -0
- package/dist/assets/{pencil-BHXyXIP9.js → pencil-BEefjySD.js} +1 -1
- package/dist/assets/report-commentary-row-Cci0ntye.js +1 -0
- package/dist/assets/{save-NUZuyPEH.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-DzLJ6sUY.js +1 -0
- package/dist/assets/toggle-expansion-button-BzVlE1kb.js +1 -0
- package/dist/assets/tooltip-Ht3m2Q26.js +1 -0
- package/dist/assets/use-url-query-DV9K0FAR.js +1 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- 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/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/providers/urql.tsx +2 -2
- package/dist/assets/Typography-BjOvYDtJ.js +0 -1
- package/dist/assets/accordion-gDGB9JKa.js +0 -1
- package/dist/assets/accountant-approvals-aQMSAP78.js +0 -1
- package/dist/assets/all-charges-X9R8PfNk.js +0 -1
- package/dist/assets/business-transactions-single-_OIHJEfY.js +0 -1
- package/dist/assets/business-trip-CYZP6qrZ.js +0 -1
- package/dist/assets/charges-filters-Dc9JkkaM.js +0 -1
- package/dist/assets/charges-ledger-validation-BiBZ2pEf.js +0 -1
- package/dist/assets/editable-business-trip-BIRxgXHu.js +0 -16
- package/dist/assets/index-2x_26B9B.js +0 -1
- package/dist/assets/index-4yVbIKWS.js +0 -1
- package/dist/assets/index-B-uojS_H.js +0 -1
- package/dist/assets/index-BFRBCjVk.css +0 -1
- package/dist/assets/index-BVffhJ_X.js +0 -2
- package/dist/assets/index-BZFydPbo.js +0 -1
- package/dist/assets/index-BazMRdI3.js +0 -6
- package/dist/assets/index-BsTpXlvi.js +0 -891
- package/dist/assets/index-CD_kl3oZ.js +0 -1
- package/dist/assets/index-CaXjK2fb.js +0 -2
- package/dist/assets/index-CbJd62Hp.js +0 -1
- package/dist/assets/index-CdKoH7Cz.js +0 -9
- package/dist/assets/index-Crc98w5p.js +0 -1
- package/dist/assets/index-Cs-QBGd0.js +0 -1
- package/dist/assets/index-D2ada9K2.js +0 -1
- package/dist/assets/index-DAkukoD_.js +0 -1
- package/dist/assets/index-DML4EmHc.js +0 -1
- package/dist/assets/index-rwlm4BcW.js +0 -1
- package/dist/assets/index-xA-DiOzv.js +0 -1
- package/dist/assets/issue-document-BezTjH4r.js +0 -1
- package/dist/assets/login-page-I-7tCrbB.js +0 -1
- package/dist/assets/missing-info-charges-BDgEJ4mj.js +0 -1
- package/dist/assets/page-not-found-CIT5vwb-.js +0 -1
- package/dist/assets/report-commentary-row-DHfnYhMN.js +0 -1
- package/dist/assets/sub-3UcXQDsZ.js +0 -1
- package/dist/assets/subMonths-BbuiFsxa.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/providers/urql.tsx
CHANGED
|
@@ -90,7 +90,7 @@ export function UrqlProvider({ children }: { children?: ReactNode }): ReactNode
|
|
|
90
90
|
|
|
91
91
|
useEffect(() => {
|
|
92
92
|
if (!client) {
|
|
93
|
-
navigate(
|
|
93
|
+
navigate(ROUTES.LOGIN, { state: { prevPath: window.location.pathname } });
|
|
94
94
|
}
|
|
95
95
|
return;
|
|
96
96
|
}, [client, navigate]);
|
|
@@ -98,6 +98,6 @@ export function UrqlProvider({ children }: { children?: ReactNode }): ReactNode
|
|
|
98
98
|
return client ? (
|
|
99
99
|
<Provider value={client}>{children}</Provider>
|
|
100
100
|
) : (
|
|
101
|
-
<Navigate to=
|
|
101
|
+
<Navigate to={ROUTES.LOGIN} state={{ prevPath: window.location.pathname }} />
|
|
102
102
|
);
|
|
103
103
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ef as S,eg as K,eh as Z,ei as Q,ej as W,ek as X,d8 as Y,d7 as z,r as k,dc as N,el as ee,j as te,ak as re,dZ as _}from"./index-BsTpXlvi.js";function Me(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const $=e=>e,ne=()=>{let e=$;return{configure(t){e=t},generate(t){return e(t)},reset(){e=$}}},oe=ne(),se={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function U(e,t,r="Mui"){const n=se[t];return n?`${r}-${n}`:`${oe.generate(e)}-${t}`}function ie(e,t,r="Mui"){const n={};return t.forEach(o=>{n[o]=U(e,o,r)}),n}function G(e){const{variants:t,...r}=e,n={variants:t,style:S(r),isProcessed:!0};return n.style===r||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=S(o.style))}),n}const ae=K();function V(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function g(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function le(e){return e?(t,r)=>r[e]:null}function ue(e,t,r){e.theme=he(e.theme)?r:e.theme[t]||e.theme}function A(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(o=>A(e,o,r));if(Array.isArray(n?.variants)){let o;if(n.isProcessed)o=r?g(n.style,r):n.style;else{const{variants:s,...i}=n;o=r?g(S(i),r):i}return I(e,n.variants,[o],r)}return n?.isProcessed?r?g(S(n.style),r):n.style:r?g(S(n),r):n}function I(e,t,r=[],n=void 0){let o;e:for(let s=0;s<t.length;s+=1){const i=t[s];if(typeof i.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!i.props(o))continue}else for(const a in i.props)if(e[a]!==i.props[a]&&e.ownerState?.[a]!==i.props[a])continue e;typeof i.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?g(S(i.style(o)),n):i.style(o))):r.push(n?g(S(i.style),n):i.style)}return r}function ce(e={}){const{themeId:t,defaultTheme:r=ae,rootShouldForwardProp:n=V,slotShouldForwardProp:o=V}=e;function s(a){ue(a,t,r)}return(a,d={})=>{Z(a,u=>u.filter(c=>c!==W));const{name:l,slot:h,skipVariantsResolver:b,skipSx:C,overridesResolver:v=le(ye(h)),...T}=d,w=l&&l.startsWith("Mui")||h?"components":"custom",P=b!==void 0?b:h&&h!=="Root"&&h!=="root"||!1,M=C||!1;let x=V;h==="Root"||h==="root"?x=n:h?x=o:pe(a)&&(x=void 0);const F=Q(a,{shouldForwardProp:x,label:fe(),...T}),q=u=>{if(u.__emotion_real===u)return u;if(typeof u=="function")return function(m){return A(m,u,m.theme.modularCssLayers?w:void 0)};if(X(u)){const c=G(u);return function(y){return c.variants?A(y,c,y.theme.modularCssLayers?w:void 0):y.theme.modularCssLayers?g(c.style,w):c.style}}return u},j=(...u)=>{const c=[],m=u.map(q),y=[];if(c.push(s),l&&v&&y.push(function(f){const p=f.theme.components?.[l]?.styleOverrides;if(!p)return null;const B={};for(const E in p)B[E]=A(f,p[E],f.theme.modularCssLayers?"theme":void 0);return v(f,B)}),l&&!P&&y.push(function(f){const p=f.theme?.components?.[l]?.variants;return p?I(f,p,[],f.theme.modularCssLayers?"theme":void 0):null}),M||y.push(W),Array.isArray(m[0])){const O=m.shift(),f=new Array(c.length).fill(""),R=new Array(y.length).fill("");let p;p=[...f,...O,...R],p.raw=[...f,...O.raw,...R],c.unshift(p)}const J=[...c,...m,...y],L=F(...J);return a.muiName&&(L.muiName=a.muiName),L};return F.withConfig&&(j.withConfig=F.withConfig),j}}function fe(e,t){return void 0}function he(e){for(const t in e)return!1;return!0}function pe(e){return typeof e=="string"&&e.charCodeAt(0)>96}function ye(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}const D={theme:void 0};function de(e){let t,r;return function(o){let s=t;return(s===void 0||o.theme!==r)&&(D.theme=o.theme,s=G(e(D)),t=s,r=o.theme),s}}function me(e,t,r=void 0){const n={};for(const o in e){const s=e[o];let i="",a=!0;for(let d=0;d<s.length;d+=1){const l=s[d];l&&(i+=(a===!0?"":" ")+t(l),a=!1,r&&r[l]&&(i+=" "+r[l]))}n[o]=i}return n}function ge(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const Se=e=>ge(e)&&e!=="classes",ve=ce({themeId:Y,defaultTheme:z,rootShouldForwardProp:Se}),we=de;function Fe(...e){const t=k.useRef(void 0),r=k.useCallback(n=>{const o=e.map(s=>{if(s==null)return null;if(typeof s=="function"){const i=s,a=i(n);return typeof a=="function"?a:()=>{i(null)}}return s.current=n,()=>{s.current=null}});return()=>{o.forEach(s=>s?.())}},e);return k.useMemo(()=>e.every(n=>n==null)?null:n=>{t.current&&(t.current(),t.current=void 0),n!=null&&(t.current=r(n))},e)}function xe(e){return typeof e.main=="string"}function be(e,t=[]){if(!xe(e))return!1;for(const r of t)if(!e.hasOwnProperty(r)||typeof e[r]!="string")return!1;return!0}function Ce(e=[]){return([,t])=>t&&be(t,e)}function Te(e){return U("MuiTypography",e)}ie("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const Pe={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Oe=ee(),Re=e=>{const{align:t,gutterBottom:r,noWrap:n,paragraph:o,variant:s,classes:i}=e,a={root:["root",s,e.align!=="inherit"&&`align${_(t)}`,r&&"gutterBottom",n&&"noWrap",o&&"paragraph"]};return me(a,Te,i)},ke=ve("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.variant&&t[r.variant],r.align!=="inherit"&&t[`align${_(r.align)}`],r.noWrap&&t.noWrap,r.gutterBottom&&t.gutterBottom,r.paragraph&&t.paragraph]}})(we(({theme:e})=>({margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(e.typography).filter(([t,r])=>t!=="inherit"&&r&&typeof r=="object").map(([t,r])=>({props:{variant:t},style:r})),...Object.entries(e.palette).filter(Ce()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,t])=>typeof t=="string").map(([t])=>({props:{color:`text${_(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:t})=>t.align!=="inherit",style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:t})=>t.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:t})=>t.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:t})=>t.paragraph,style:{marginBottom:16}}]}))),H={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},Ve=k.forwardRef(function(t,r){const{color:n,...o}=N({props:t,name:"MuiTypography"}),s=!Pe[n],i=Oe({...o,...s&&{color:n}}),{align:a="inherit",className:d,component:l,gutterBottom:h=!1,noWrap:b=!1,paragraph:C=!1,variant:v="body1",variantMapping:T=H,...w}=i,P={...i,align:a,color:n,className:d,component:l,gutterBottom:h,noWrap:b,paragraph:C,variant:v,variantMapping:T},M=l||(C?"p":T[v]||H[v])||"span",x=Re(P);return te.jsx(ke,{as:M,ref:r,className:re(x.root,d),...w,ownerState:P,style:{...a!=="inherit"&&{"--Typography-textAlign":a},...w.style}})});export{Ve as T,Me as _,ie as a,V as b,me as c,Ce as d,U as g,we as m,ve as s,Fe as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aj as l,j as t,fg as J,fh as Q,fi as O,fj as X,fk as Z,fl as T,fm as ee,fn as oe,fo as M,fp as re,fq as te,fr as ne,p as P,dW as ae}from"./index-BsTpXlvi.js";var d="Accordion",ce=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[k,ie,se]=J(d),[b]=Q(d,[se,O]),E=O(),V=l.forwardRef((e,n)=>{const{type:o,...a}=e,c=a,r=a;return t.jsx(k.Provider,{scope:e.__scopeAccordion,children:o==="multiple"?t.jsx(fe,{...r,ref:n}):t.jsx(pe,{...c,ref:n})})});V.displayName=d;var[H,le]=b(d),[K,de]=b(d,{collapsible:!1}),pe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},collapsible:r=!1,...s}=e,[i,p]=M({prop:o,defaultProp:a??"",onChange:c,caller:d});return t.jsx(H,{scope:e.__scopeAccordion,value:l.useMemo(()=>i?[i]:[],[i]),onItemOpen:p,onItemClose:l.useCallback(()=>r&&p(""),[r,p]),children:t.jsx(K,{scope:e.__scopeAccordion,collapsible:r,children:t.jsx($,{...s,ref:n})})})}),fe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},...r}=e,[s,i]=M({prop:o,defaultProp:a??[],onChange:c,caller:d}),p=l.useCallback(x=>i((u=[])=>[...u,x]),[i]),v=l.useCallback(x=>i((u=[])=>u.filter(h=>h!==x)),[i]);return t.jsx(H,{scope:e.__scopeAccordion,value:s,onItemOpen:p,onItemClose:v,children:t.jsx(K,{scope:e.__scopeAccordion,collapsible:!0,children:t.jsx($,{...r,ref:n})})})}),[ue,C]=b(d),$=l.forwardRef((e,n)=>{const{__scopeAccordion:o,disabled:a,dir:c,orientation:r="vertical",...s}=e,i=l.useRef(null),p=re(i,n),v=ie(o),u=te(c)==="ltr",h=ne(e.onKeyDown,m=>{if(!ce.includes(m.key))return;const B=m.target,I=v().filter(R=>!R.ref.current?.disabled),g=I.findIndex(R=>R.ref.current===B),D=I.length;if(g===-1)return;m.preventDefault();let f=g;const j=0,w=D-1,_=()=>{f=g+1,f>w&&(f=j)},y=()=>{f=g-1,f<j&&(f=w)};switch(m.key){case"Home":f=j;break;case"End":f=w;break;case"ArrowRight":r==="horizontal"&&(u?_():y());break;case"ArrowDown":r==="vertical"&&_();break;case"ArrowLeft":r==="horizontal"&&(u?y():_());break;case"ArrowUp":r==="vertical"&&y();break}const F=f%D;I[F].ref.current?.focus()});return t.jsx(ue,{scope:o,disabled:a,direction:c,orientation:r,children:t.jsx(k.Slot,{scope:o,children:t.jsx(T.div,{...s,"data-orientation":r,ref:p,onKeyDown:a?void 0:h})})})}),A="AccordionItem",[ve,S]=b(A),z=l.forwardRef((e,n)=>{const{__scopeAccordion:o,value:a,...c}=e,r=C(A,o),s=le(A,o),i=E(o),p=X(),v=a&&s.value.includes(a)||!1,x=r.disabled||e.disabled;return t.jsx(ve,{scope:o,open:v,disabled:x,triggerId:p,children:t.jsx(Z,{"data-orientation":r.orientation,"data-state":Y(v),...i,...c,ref:n,disabled:x,open:v,onOpenChange:u=>{u?s.onItemOpen(a):s.onItemClose(a)}})})});z.displayName=A;var L="AccordionHeader",G=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(L,o);return t.jsx(T.h3,{"data-orientation":c.orientation,"data-state":Y(r.open),"data-disabled":r.disabled?"":void 0,...a,ref:n})});G.displayName=L;var N="AccordionTrigger",U=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(N,o),s=de(N,o),i=E(o);return t.jsx(k.ItemSlot,{scope:o,children:t.jsx(ee,{"aria-disabled":r.open&&!s.collapsible||void 0,"data-orientation":c.orientation,id:r.triggerId,...i,...a,ref:n})})});U.displayName=N;var q="AccordionContent",W=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(q,o),s=E(o);return t.jsx(oe,{role:"region","aria-labelledby":r.triggerId,"data-orientation":c.orientation,...s,...a,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});W.displayName=q;function Y(e){return e?"open":"closed"}var xe=V,me=z,ge=G,Ae=U,be=W;function he({...e}){return t.jsx(xe,{"data-slot":"accordion",...e})}function Ie({className:e,...n}){return t.jsx(me,{"data-slot":"accordion-item",className:P("border-b last:border-b-0",e),...n})}function je({className:e,children:n,...o}){return t.jsx(ge,{className:"flex",children:t.jsxs(Ae,{"data-slot":"accordion-trigger",className:P("focus-visible:border-gray-950 focus-visible:ring-gray-950/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180 dark:focus-visible:border-gray-300 dark:focus-visible:ring-gray-300/50",e),...o,children:[n,t.jsx(ae,{className:"text-gray-500 pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200 dark:text-gray-400"})]})})}function we({className:e,children:n,...o}){return t.jsx(be,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...o,children:t.jsx("div",{className:P("pt-0 pb-4",e),children:n})})}export{he as A,Ie as a,we as b,je as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,F as h,u as v,ag as C,ai as A,a as F,j as e,c as P,L as b,fs as y}from"./index-BsTpXlvi.js";import{C as j}from"./charges-filters-Dc9JkkaM.js";import{P as D}from"./Progress-3b9RPwUr.js";import"./sub-3UcXQDsZ.js";import"./subMonths-BbuiFsxa.js";const w=()=>{const{setFiltersContext:c}=t.useContext(h),{get:i}=v(),{userContext:p}=t.useContext(C),[a,x]=t.useState(i("chargesFilters")?JSON.parse(decodeURIComponent(i("chargesFilters"))):{byOwners:p?.context.adminBusinessId?[p?.context.adminBusinessId]:[],sortBy:{field:A.Date,asc:!1},toAnyDate:null,fromAnyDate:null}),[{data:r,fetching:u}]=F({query:y,variables:{filters:a,page:1,limit:999999}}),s=r?.allCharges?.nodes.length??0;let o=0,l=0,n=0;r?.allCharges?.nodes.map(f=>{switch(f.accountantApproval){case"APPROVED":o+=1;break;case"PENDING":l+=1;break;case"UNAPPROVED":n+=1;break}});const d=100*o/s,g=100*l/s,m=100*n/s;return t.useEffect(()=>{c(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(j,{filter:a,setFilter:x,activePage:1,setPage:()=>{},totalPages:1})}))},[r,u,a,c,x]),e.jsx(P,{title:"Accountant Approvals Status",children:u?e.jsx(b,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs("div",{className:"mx-10 mt-5 flex flex-col gap-5",children:[`Total charges: ${s}`,e.jsx(D,{color:"green",radius:"xl",size:"xl",sections:[{value:d,color:"green",label:`${d.toFixed(1)}% (${o})`},{value:g,color:"orange",label:`${g.toFixed(1)}% (${l})`},{value:m,color:"red",label:`${m.toFixed(1)}% (${n})`}]})]})})};export{w as AccountantApprovals};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,F as D,u as E,a as N,j as e,T as b,B as w,P as z,b as O,c as T,L,C as R,E as q,I as B,M as U,A as k}from"./index-BsTpXlvi.js";import{e as Q,C as $}from"./charges-filters-Dc9JkkaM.js";import{M as H}from"./index-CWM7AEkA.js";import"./sub-3UcXQDsZ.js";import"./subMonths-BbuiFsxa.js";import"./Checkbox-DBiOK2wr.js";function Y(l,n){const a=new URLSearchParams;n&&a.append("page",String(n));const o=Q(l);return o&&a.append("chargesFilters",o),`/charges${a.size>0?`?${a}`:""}`}const Z=()=>{const{setFiltersContext:l}=s.useContext(D),[n,a]=s.useState(void 0),[o,g]=s.useState(void 0),[d,x]=s.useState(void 0),[u,j]=s.useState(!1),[r,h]=s.useState([]),{get:m}=E(),[p,M]=s.useState(m("page")?Number(m("page")):1),C=m("chargesFilters"),S=s.useMemo(()=>{if(C)try{return JSON.parse(decodeURIComponent(C))}catch{return}},[C]),[i,v]=s.useState(S),I=s.useCallback((t,A)=>{r.map(f=>f.id).includes(t)?h(r.filter(f=>f.id!==t)):h([...r,{id:t,onChange:A}])},[r]),[{data:c,fetching:P},F]=N({query:k,variables:{filters:i,page:p,limit:100},pause:!0});s.useEffect(()=>{i&&F()},[i,F]);function y(){h([])}return s.useEffect(()=>{l(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx($,{filter:i,setFilter:v,activePage:p,setPage:M,totalPages:c?.allCharges?.pageInfo.totalPages,initiallyOpened:!i}),e.jsx(b,{label:"Expand all accounts",children:e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>j(t=>!t),children:u?e.jsx(z,{className:"size-5"}):e.jsx(O,{className:"size-5"})})}),e.jsx(H,{selected:r,resetMerge:y})]}))},[c,P,i,p,u,l,M,v,j,r,S]),e.jsxs(T,{title:"All Charges",description:"Manage charges",children:[P?e.jsx(L,{className:"h-10 w-10 animate-spin mr-2 self-center"}):c?.allCharges.nodes?e.jsx(R,{setEditChargeId:a,setInsertDocument:g,setMatchDocuments:x,toggleMergeCharge:I,mergeSelectedCharges:new Set(r.map(t=>t.id)),data:c?.allCharges?.nodes,isAllOpened:u}):e.jsx("span",{children:"Please apply filters"}),n&&e.jsx(q,{chargeId:n?.id,close:()=>a(void 0),onChange:n.onChange}),o&&e.jsx(B,{chargeId:o.id,onChange:o.onChange,close:()=>g(void 0)}),d&&e.jsx(U,{chargeId:d.id,ownerId:d.ownerId,setMatchDocuments:()=>x(void 0)})]})};export{Z as AllCharges,Y as getAllChargesHref};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{br as S,u as g,r as m,F as x,a as y,j as o,bv as C,n as T,bw as h,bx as b,aV as n,bi as F,by as v}from"./index-BsTpXlvi.js";const I=({businessId:t})=>{const{businessId:r}=S(),{get:s}=g(),{setFiltersContext:u}=m.useContext(x),l=t||r,[c,d]=m.useState(s("transactionsFilters")?{...JSON.parse(decodeURIComponent(s("transactionsFilters"))),businessIDs:l?[l]:[]}:{businessIDs:l?[l]:[]}),[{data:i,fetching:f}]=y({query:v,variables:{filters:c}});m.useEffect(()=>{u(o.jsx(C,{filter:c,setFilter:d}))},[i,c,u,d]);const p=m.useMemo(()=>i?.businessTransactionsSumFromLedgerRecords.__typename==="CommonError"?[]:i?.businessTransactionsSumFromLedgerRecords.businessTransactionsSum?i.businessTransactionsSumFromLedgerRecords.businessTransactionsSum.sort((e,w)=>e.business.name.localeCompare(w.business.name)):[],[i?.businessTransactionsSumFromLedgerRecords]);return f?o.jsx(T,{}):o.jsx(h,{moreInfo:e=>o.jsx(F,{businessID:e.business.id,filter:c}),striped:!0,highlightOnHover:!0,stickyHeader:!0,items:p,columns:[{title:"Business Name",value:e=>e.business.name},{title:"Debit",value:e=>e.debit.formatted,style:{whiteSpace:"nowrap"}},{title:"Credit",value:e=>e.credit.formatted,style:{whiteSpace:"nowrap"}},{title:"Total",value:e=>e.total.raw&&(e.total.raw<-1e-4||e.total.raw>1e-4)?o.jsx(b,{color:e.total.raw>0?"green":"red",children:e.total.formatted}):e.total.formatted,style:{whiteSpace:"nowrap"}},...a(n.Eur),...a(n.Usd),...a(n.Gbp),...a(n.Cad),...a(n.Jpy),...a(n.Aud),...a(n.Sek)]})};function a(t){return[{title:`${t} Debit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.debit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Credit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.credit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Total`,value:r=>{const s=r.foreignCurrenciesSum.find(u=>u.currency===t);return s?.total?.raw&&(s.total.raw<-1e-4||s.total.raw>1e-4)?o.jsx(b,{color:s.total.raw>0?"green":"red",children:s.total.formatted}):s?.total?.formatted},style:{whiteSpace:"nowrap"}}]}export{I as BusinessTransactionsSingle};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{br as u,r as n,F as p,a as c,j as s,n as x,c as d,bF as l}from"./index-BsTpXlvi.js";import{P as m,C as b,E as T}from"./editable-business-trip-BIRxgXHu.js";const E=({businessTripId:a})=>{const{businessTripId:o}=u(),{setFiltersContext:i}=n.useContext(p),e=a??o??"",[{data:r,fetching:t}]=c({query:l,variables:{businessTripId:e}});return n.useEffect(()=>{i(s.jsx("div",{className:"flex flex-row gap-x-5",children:s.jsx(m,{filename:"business_trip_report"})}))},[r,t,i]),t||!r?.businessTrip?s.jsx(x,{}):s.jsx(d,{title:`Business Trip: ${r.businessTrip.name}`,description:"Manage business trip",children:s.jsx(b,{className:"mt-5",children:e&&s.jsx(T,{tripId:e,isExtended:!0})})})};export{E as BusinessTrip};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c$ as B,r as i,u as R,d2 as W,j as e,d0 as z,s as U,bB as G,B as _,d1 as Q,ag as q,V as J,H as N,ai as D,dj as X,as as $,a1 as K,dk as Y,bQ as h,cj as k,ft as Z,bV as L,bW as O,bR as V,eB as A,ap as x,fu as ee,bh as se,a3 as m,a4 as j,a5 as g,a6 as p,dL as ae,dM as te,dN as ne}from"./index-BsTpXlvi.js";import{s as oe}from"./sub-3UcXQDsZ.js";function le(a){return!a||B(a)?null:encodeURIComponent(JSON.stringify(a))}const re=[{value:D.AbsAmount,label:"Abs Amount"},{value:D.Amount,label:"Amount"},{value:D.Date,label:"Date"}],ce=[{label:"All",value:A.All},{label:"Income",value:A.Income},{label:"Expense",value:A.Expense}];function ie({filter:a,setFilter:w,closeModal:d}){const{userContext:y}=i.useContext(q),o=J({defaultValues:{byOwners:y?.context.adminBusinessId?[y.context.adminBusinessId]:void 0,sortBy:{field:D.Date,asc:!1},toAnyDate:N(new Date,"yyyy-MM-dd"),fromAnyDate:N(oe(new Date,{years:1}),"yyyy-MM-dd"),...a}}),{control:r,handleSubmit:T,watch:C}=o,[b,F]=i.useState(a.sortBy?.asc??!1),[c,u]=i.useState(!!a.sortBy?.field),{selectableFinancialEntities:S,fetching:t}=X(),{selectableTags:v,fetching:I}=$(),E=C("sortBy.field");i.useEffect(()=>{E&&!c?u(!0):!E&&c&&u(!1)},[E,c]);const P=s=>{b!=null&&s.sortBy?.field&&(s.sortBy.asc=b),w(s),d()};function H(){w({}),F(!1),d()}return e.jsxs(e.Fragment,{children:[t?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(K,{...o,children:e.jsxs("form",{onSubmit:T(P),children:[e.jsxs(Y,{cols:2,children:[e.jsx(h,{name:"byOwners",control:r,defaultValue:a.byOwners,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:S,value:s.value??[],disabled:t,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byBusinesses",control:r,defaultValue:a.byBusinesses,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:S,value:s.value??[],disabled:t,label:"Financial Entities",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byTags",control:r,defaultValue:a.byTags,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:v,itemComponent:Z,value:s.value??[],disabled:I,label:"Tags",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0,filter:(l,f,M)=>M.label?.toLowerCase().includes(l.toLowerCase().trim())||M.description?.toLowerCase().includes(l.toLowerCase().trim())})}),e.jsx(h,{name:"fromAnyDate",control:r,defaultValue:a.fromAnyDate,rules:{pattern:{value:L,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(O,{...s,onChange:l=>{const f=l?typeof l=="string"?l:N(l,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"From Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"toAnyDate",control:r,defaultValue:a.toAnyDate,rules:{pattern:{value:L,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(O,{...s,onChange:l=>{const f=l?typeof l=="string"?l:N(l,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"To Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"chargesType",control:r,defaultValue:a.chargesType,render:({field:s,fieldState:n})=>e.jsx(V,{...s,data:ce,value:s.value??A.All,disabled:t,label:"Charge Type",placeholder:"Filter income/expense",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"sortBy.field",control:r,defaultValue:a.sortBy?.field??D.Date,render:({field:s,fieldState:n})=>e.jsx(V,{...s,data:re,label:"Field to sort by",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,rightSectionProps:{style:{width:"5rem"}},withinPortal:!0,rightSection:e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(x,{defaultChecked:a.sortBy?.asc??!1,checked:b??!1,disabled:!c,onCheckedChange:F}),e.jsx("span",{className:"text-xs",children:b?"ASC":"DESC"})]})})}),e.jsx(h,{name:"accountantStatus",control:r,defaultValue:a.accountantStatus,render:({field:s,fieldState:n})=>e.jsx(k,{...s,value:s.value??[],data:ee,disabled:t,label:"Accountant Status",placeholder:"All",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsxs("div",{className:"flex flex-col gap-2 mt-4 rounded-lg border p-3 shadow-sm space-y-2",children:[e.jsx(se,{children:"Missing Information:"}),e.jsx(m,{control:o.control,name:"withoutInvoice",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Invoice"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutInvoice??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutReceipt",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Receipts"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutReceipt??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Documents"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutDocuments??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withOpenDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"With Open Documents"})}),e.jsx(p,{children:e.jsxs(ae,{children:[e.jsx(te,{children:e.jsx(x,{defaultChecked:a.withOpenDocuments??!1,onCheckedChange:s.onChange})}),e.jsx(ne,{children:e.jsx("p",{children:"Show only charges with documents that are currently open"})})]})})]})}),e.jsx(m,{control:o.control,name:"withoutTransactions",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Transactions"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutTransactions??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"unbalanced",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Unbalanced businesses"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.unbalanced??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutLedger",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without ledger"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutLedger??!1,onCheckedChange:s.onChange})})]})})]})]}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",disabled:t||I,className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:H,children:"Clear"}),e.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:d,children:"Cancel"})]})]})})]})}function he({filter:a={},setFilter:w,activePage:d,setPage:y,totalPages:o=1,initiallyOpened:r=!1}){const[T,C]=i.useState(r),[b,F]=i.useState(!B(a)),{get:c,set:u}=R();i.useEffect(()=>{const t=d>1?d.toFixed(0):null,v=c("page");t!==v&&u("page",t)},[d,c,u]),i.useEffect(()=>{const t=le(a),v=c("chargesFilters");t!==v&&(u("chargesFilters",t),u("page"),y(1))},[a,c,u,y]);const S=i.useCallback(t=>{W(t,a)||(w(t),F(!B(t)))},[a,w]);return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(z,{opened:T,onClose:()=>C(!1),content:e.jsx(ie,{filter:a,setFilter:S,closeModal:()=>C(!1)}),modalSize:"xl"}),o>1&&e.jsx(U,{className:"flex-auto",value:d,onChange:y,total:o}),e.jsx(G,{inline:!0,size:16,disabled:!b,children:e.jsx(_,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>C(!0),children:e.jsx(Q,{className:"size-5"})})})]})}export{he as C,ce as c,le as e};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,F as E,u as N,a as P,j as e,T as b,B as w,P as z,b as T,c as W,L as O,C as k,e as B,f as R,g as V,E as A,I as Q,M as U,h as q}from"./index-BsTpXlvi.js";import{C as J}from"./charges-filters-Dc9JkkaM.js";import{M as $}from"./index-CWM7AEkA.js";import{P as G}from"./Progress-3b9RPwUr.js";import"./sub-3UcXQDsZ.js";import"./subMonths-BbuiFsxa.js";import"./Checkbox-DBiOK2wr.js";const se=()=>{const{setFiltersContext:m}=t.useContext(E),[o,x]=t.useState(void 0),[l,C]=t.useState(void 0),[c,p]=t.useState(void 0),[g,f]=t.useState(!1),[a,d]=t.useState([]),{get:F}=N(),h=F("chargesFilters"),I=t.useMemo(()=>{if(h)try{return JSON.parse(decodeURIComponent(h))}catch{return}},[h]),[n,j]=t.useState(I),S=t.useCallback((s,D)=>{a.map(u=>u.id).includes(s)?d(a.filter(u=>u.id!==s)):d([...a,{id:s,onChange:D}])},[a]),[{data:r,fetching:M},v]=P({query:q,variables:{filters:n},pause:!0});function y(){d([])}const i=t.useMemo(()=>r?.chargesWithLedgerChanges?.length?r.chargesWithLedgerChanges[r.chargesWithLedgerChanges.length-1].progress:0,[r?.chargesWithLedgerChanges]),L=t.useCallback(s=>{j(s)},[j]);return t.useEffect(()=>{n&&v()},[n,v]),t.useEffect(()=>{m(e.jsxs("div",{className:"flex flex-row gap-x-5 items-center",children:[e.jsx(G,{value:i,label:`${i?.toFixed(2)}%`,size:"xl",animate:i<100,className:"min-w-52"}),e.jsx(J,{filter:n,setFilter:L,activePage:1,setPage:()=>{},initiallyOpened:!0}),e.jsx(b,{label:"Expand all accounts",children:e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>f(s=>!s),children:g?e.jsx(z,{className:"size-5"}):e.jsx(T,{className:"size-5"})})}),e.jsx($,{selected:a,resetMerge:y})]}))},[r,M,n,g,m,f,a,i,L]),e.jsxs(W,{title:"Charges Ledger Validation",description:"Manage charges",children:[M?e.jsx(O,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs(e.Fragment,{children:[e.jsx(k,{setEditChargeId:x,setInsertDocument:C,setMatchDocuments:p,toggleMergeCharge:S,mergeSelectedCharges:new Set(a.map(s=>s.id)),data:r?.chargesWithLedgerChanges.filter(s=>!!s.charge).map(s=>s.charge)??[],isAllOpened:g}),e.jsxs("div",{className:"flex flex-row justify-center my-2",children:[i>0&&i<100&&e.jsx(B,{}),i===100&&!r?.chargesWithLedgerChanges.filter(s=>!!s.charge).length&&e.jsx(R,{radius:"xl",size:"xl",color:"green",children:e.jsx(V,{})})]})]}),o&&e.jsx(A,{chargeId:o?.id,close:()=>x(void 0),onChange:o.onChange}),l&&e.jsx(Q,{chargeId:l.id,onChange:l.onChange,close:()=>C(void 0)}),c&&e.jsx(U,{chargeId:c.id,ownerId:c.ownerId,setMatchDocuments:()=>p(void 0)})]})};export{se as ChargesLedgerValidation};
|