@accounter/client 0.0.8-alpha-20251029234818-bb69914cb7aaa4859296baa4a256c251158fd15b → 0.0.8-alpha-20251029235231-f14290dbb5dedec255de3cef292d3b4c5c71298e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -16
- package/dist/assets/{Checkbox-ChZFYaBU.js → Checkbox-m4EJFPdR.js} +2 -2
- package/dist/assets/{MultiSelect-h-orVW8D.js → MultiSelect-9iwOrNey.js} +1 -1
- package/dist/assets/{Progress-DVn-HXq3.js → Progress-jpjCOY1T.js} +1 -1
- package/dist/assets/{Table-B88LD0fO.js → Table-KlqUi970.js} +1 -1
- package/dist/assets/{Typography-DSr2wXoh.js → Typography-DcCXHm8f.js} +1 -1
- package/dist/assets/{YearPickerInput-DQjO6Nmm.js → YearPickerInput-CWNdAJVU.js} +1 -1
- package/dist/assets/{accordion-vlJV5349.js → accordion-DyS7JLRn.js} +1 -1
- package/dist/assets/accountant-approvals-BPCEe5wp.js +1 -0
- package/dist/assets/accounter-table-CdLG0nPv.js +1 -0
- package/dist/assets/{addDays-CiW9nfcU.js → addDays-C65N2SCe.js} +1 -1
- package/dist/assets/all-charges-CrhqMOdj.js +1 -0
- package/dist/assets/{arrow-up-down-DCZ98zEE.js → arrow-up-down-B8i8ydxe.js} +1 -1
- package/dist/assets/{building-2-MkMlc3HY.js → building-2-cN3QI06F.js} +1 -1
- package/dist/assets/{business-extended-info-CFdeLUKP.js → business-extended-info-DCsSJJtc.js} +4 -4
- package/dist/assets/{business-header-pPq6w0Xw.js → business-header-HggV7QvE.js} +1 -1
- package/dist/assets/{business-ledger-filters-ClJxXoLC.js → business-ledger-filters-B9SOs3sR.js} +1 -1
- package/dist/assets/business-ledger-single-BYrOpHks.js +1 -0
- package/dist/assets/business-nIHEv4T5.js +37 -0
- package/dist/assets/business-trip-CaVFJEg1.js +1 -0
- package/dist/assets/charge-XVI9hWTT.js +1 -0
- package/dist/assets/charges-filters-D2_BKbWX.js +1 -0
- package/dist/assets/charges-ledger-validation-FYtG72Q6.js +1 -0
- package/dist/assets/{charges-table-eZes2r5b.js → charges-table-BEP9lXbG.js} +6 -6
- package/dist/assets/{chart-BiPB-6_s.js → chart-DrNm6pqY.js} +1 -1
- package/dist/assets/{data-table-pagination-D9orF6C5.js → data-table-pagination-azA1p3g-.js} +1 -1
- package/dist/assets/{download-csv-button-DUWRJL2T.js → download-csv-button-DsnbHQxU.js} +1 -1
- package/dist/assets/{editable-business-trip-BhXW_0XH.js → editable-business-trip-DuwclYZj.js} +2 -2
- package/dist/assets/{funnel-DrJtNpvJ.js → funnel-DT4mmN3u.js} +1 -1
- package/dist/assets/{index-B0hUbUBg.js → index-4EzhixKH.js} +1 -1
- package/dist/assets/index-B7Rl68zJ.js +6 -0
- package/dist/assets/index-BD4s2ucv.css +1 -0
- package/dist/assets/{index-BidQYESH.js → index-BMBj2AP4.js} +2 -2
- package/dist/assets/{index-BNmy1oek.js → index-BPrO70_k.js} +1 -1
- package/dist/assets/index-BTtuW68l.js +1 -0
- package/dist/assets/index-BlKLmORp.js +1 -0
- package/dist/assets/{index--ZcPa6E_.js → index-Bt8Ea12_.js} +1 -1
- package/dist/assets/{index-Dl0o8K5Z.js → index-BzVbeSlP.js} +1 -1
- package/dist/assets/{index-BsEpUd8e.js → index-C1gcTg-z.js} +2 -2
- package/dist/assets/{index-CuoWV8xf.js → index-C3k8jflc.js} +196 -196
- package/dist/assets/index-CXHGrcA4.js +1 -0
- package/dist/assets/{index-DCJnXE5L.js → index-CjH08FXI.js} +1 -1
- package/dist/assets/{index-BG_PTq9Q.js → index-CsarR72G.js} +2 -2
- package/dist/assets/{index-XNTNgbUr.js → index-Cy1QJKqT.js} +1 -1
- package/dist/assets/{index-Crk-yNk8.js → index-DGb4vHzt.js} +1 -1
- package/dist/assets/{index-z10NcX_S.js → index-DKIBrU0J.js} +1 -1
- package/dist/assets/{index-CsYsahJ3.js → index-DTXvsvms.js} +1 -1
- package/dist/assets/{index-CQwkSv45.js → index-DY9WOuok.js} +1 -1
- package/dist/assets/{index-BHVgafF5.js → index-KrbE7--b.js} +1 -1
- package/dist/assets/index-SMnzi7Aw.js +1 -0
- package/dist/assets/{index-DmOniXdt.js → index-SWslvlxa.js} +1 -1
- package/dist/assets/{index-ZqxiihxR.js → index-faGFVNCX.js} +1 -1
- package/dist/assets/index-hM1FptsM.js +1 -0
- package/dist/assets/{index-CKSGCsKO.js → index-mUNwzNlf.js} +1 -1
- package/dist/assets/{index-HAjwT8i6.js → index-s6ijvE1i.js} +2 -2
- package/dist/assets/{index.es-BiiexU-G.js → index.es-BBqsLcyU.js} +1 -1
- package/dist/assets/{insert-business-trip-modal-CkXaCqH7.js → insert-business-trip-modal-DN3T9OON.js} +2 -2
- package/dist/assets/issue-document-lGktP9-p.js +1 -0
- package/dist/assets/{list-plus-BPyHtPSB.js → list-plus-2cRRgK1O.js} +1 -1
- package/dist/assets/{login-page-CGLD1xCA.js → login-page-DSTZWEBe.js} +1 -1
- package/dist/assets/{match-document-modal-BZOEBBCt.js → match-document-modal-DKRuRsKN.js} +4 -4
- package/dist/assets/missing-info-charges-CJZN7U_u.js +1 -0
- package/dist/assets/{modal-CguzFJgR.js → modal-DNhi-EIe.js} +1 -1
- package/dist/assets/{page-layout-jOFfeRt_.js → page-layout-x3aFVsg9.js} +1 -1
- package/dist/assets/{page-not-found-ghVdWRX4.js → page-not-found-KmbtQYNL.js} +1 -1
- package/dist/assets/{panel-top-open-BLNJL6FI.js → panel-top-open-B-b6XxK7.js} +1 -1
- package/dist/assets/{pencil-DePZCoA1.js → pencil-6cV3Nfmi.js} +1 -1
- package/dist/assets/{report-commentary-row-bJgTfAoe.js → report-commentary-row-PIhBXrbg.js} +1 -1
- package/dist/assets/{save-DDATKcb8.js → save-CjO_Dmsz.js} +1 -1
- package/dist/assets/similar-transactions-modal-C7aYlzhE.js +1 -0
- package/dist/assets/{sub-CUQX8erq.js → sub-CMuEnyTg.js} +1 -1
- package/dist/assets/subMonths-Cs2weYkL.js +1 -0
- package/dist/assets/summary-BWbSzpOQ.js +1 -0
- package/dist/assets/{toggle-expansion-button-BarJY9rA.js → toggle-expansion-button-B-4w-oFe.js} +1 -1
- package/dist/assets/tooltip-DG_b_ZsV.js +1 -0
- package/dist/assets/{use-url-query-CMqziw3P.js → use-url-query-BOxCMiZm.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +2 -2
- package/src/components/business/admin-business-section.tsx +103 -282
- package/src/components/business/charges-section.tsx +5 -5
- package/src/components/businesses/businesses-filters.tsx +7 -2
- package/src/components/charges/charges-filters.tsx +8 -3
- package/src/components/common/accounter-table.tsx +1 -3
- package/src/components/common/index.ts +1 -0
- package/src/components/common/pagination.tsx +84 -0
- package/src/components/ledger-table/index.tsx +15 -8
- package/src/components/transactions-table/index.tsx +11 -5
- package/src/components/ui/pagination.tsx +3 -99
- package/src/gql/gql.ts +3 -3
- package/src/gql/graphql.ts +17 -52
- package/dist/assets/Pagination-CraTfR0n.js +0 -1
- package/dist/assets/accountant-approvals-DOxFOZAO.js +0 -1
- package/dist/assets/accounter-table-D9Vunjfy.js +0 -1
- package/dist/assets/all-charges-bPDT5kwM.js +0 -1
- package/dist/assets/business-BIPODXgU.js +0 -37
- package/dist/assets/business-ledger-single-BOtdOkme.js +0 -1
- package/dist/assets/business-trip-6WyqArkv.js +0 -1
- package/dist/assets/charge-BbtacTJ9.js +0 -1
- package/dist/assets/charges-filters-Ir-7TzSP.js +0 -1
- package/dist/assets/charges-ledger-validation-6prUhTM_.js +0 -1
- package/dist/assets/create-event-handler-BiA-1lGu.js +0 -1
- package/dist/assets/index-1EyW0AOu.js +0 -1
- package/dist/assets/index-2OCszu-l.js +0 -1
- package/dist/assets/index-BKcxKTE4.js +0 -1
- package/dist/assets/index-BUJm5I0K.css +0 -1
- package/dist/assets/index-DVm5mt8x.js +0 -6
- package/dist/assets/index-SAaZFNWd.js +0 -1
- package/dist/assets/index-jf6jgMhL.js +0 -1
- package/dist/assets/issue-document-IUlUh6n7.js +0 -1
- package/dist/assets/missing-info-charges-C1QWCAWR.js +0 -1
- package/dist/assets/similar-transactions-modal-BxhD4UyN.js +0 -1
- package/dist/assets/subMonths-QOcbO9QP.js +0 -1
- package/dist/assets/summary-CBR-TMN0.js +0 -1
- package/dist/assets/tooltip-BFYX9MeB.js +0 -1
|
@@ -3,8 +3,8 @@ import { useQuery } from 'urql';
|
|
|
3
3
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card.js';
|
|
4
4
|
import { BusinessChargesSectionDocument, ChargeSortByField } from '@/gql/graphql.js';
|
|
5
5
|
import { UserContext } from '@/providers/user-provider.js';
|
|
6
|
-
import { Pagination } from '@mantine/core';
|
|
7
6
|
import { ChargesTable } from '../charges/charges-table';
|
|
7
|
+
import { Pagination } from '../common/index.js';
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
|
|
10
10
|
/* GraphQL */ `
|
|
@@ -27,7 +27,7 @@ interface Props {
|
|
|
27
27
|
|
|
28
28
|
export function ChargesSection({ businessId }: Props) {
|
|
29
29
|
const { userContext } = useContext(UserContext);
|
|
30
|
-
const [activePage, setActivePage] = useState(
|
|
30
|
+
const [activePage, setActivePage] = useState(0);
|
|
31
31
|
|
|
32
32
|
const [{ data, fetching }] = useQuery({
|
|
33
33
|
query: BusinessChargesSectionDocument,
|
|
@@ -42,8 +42,8 @@ export function ChargesSection({ businessId }: Props) {
|
|
|
42
42
|
},
|
|
43
43
|
byBusinesses: [businessId],
|
|
44
44
|
},
|
|
45
|
-
page: activePage,
|
|
46
|
-
limit:
|
|
45
|
+
page: activePage - 1,
|
|
46
|
+
limit: 10,
|
|
47
47
|
},
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -65,7 +65,7 @@ export function ChargesSection({ businessId }: Props) {
|
|
|
65
65
|
</div>
|
|
66
66
|
{totalPages > 1 && (
|
|
67
67
|
<Pagination
|
|
68
|
-
className="flex-fit"
|
|
68
|
+
className="flex-fit w-fit mx-0"
|
|
69
69
|
value={activePage}
|
|
70
70
|
onChange={setActivePage}
|
|
71
71
|
total={totalPages}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState, type Dispatch, type ReactElement, type SetStateAction } from 'react';
|
|
2
|
-
import { Pagination } from '@mantine/core';
|
|
3
2
|
import { useUrlQuery } from '../../hooks/use-url-query.js';
|
|
3
|
+
import { Pagination } from '../common/index.js';
|
|
4
4
|
import { Input } from '../ui/input.js';
|
|
5
5
|
|
|
6
6
|
interface BusinessesFiltersProps {
|
|
@@ -45,7 +45,12 @@ export function BusinessesFilters({
|
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
47
|
<div className="flex flex-row gap-5 items-center">
|
|
48
|
-
<Pagination
|
|
48
|
+
<Pagination
|
|
49
|
+
className="flex-fit w-fit mx-0"
|
|
50
|
+
value={activePage}
|
|
51
|
+
onChange={setPage}
|
|
52
|
+
total={totalPages}
|
|
53
|
+
/>
|
|
49
54
|
<Input
|
|
50
55
|
className="w-72"
|
|
51
56
|
placeholder="Business Name"
|
|
@@ -11,7 +11,7 @@ import { format, sub } from 'date-fns';
|
|
|
11
11
|
import equal from 'deep-equal';
|
|
12
12
|
import { Filter } from 'lucide-react';
|
|
13
13
|
import { Controller, useForm, type SubmitHandler } from 'react-hook-form';
|
|
14
|
-
import { Indicator, MultiSelect,
|
|
14
|
+
import { Indicator, MultiSelect, Select, SimpleGrid } from '@mantine/core';
|
|
15
15
|
import { DatePickerInput } from '@mantine/dates';
|
|
16
16
|
import { ChargeFilterType, ChargeSortByField, type ChargeFilter } from '../../gql/graphql.js';
|
|
17
17
|
import type { TimelessDateString } from '../../helpers/dates.js';
|
|
@@ -20,7 +20,12 @@ import { useGetFinancialEntities } from '../../hooks/use-get-financial-entities.
|
|
|
20
20
|
import { useGetTags } from '../../hooks/use-get-tags.js';
|
|
21
21
|
import { useUrlQuery } from '../../hooks/use-url-query.js';
|
|
22
22
|
import { UserContext } from '../../providers/user-provider.js';
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
accountantApprovalInputData,
|
|
25
|
+
Pagination,
|
|
26
|
+
PopUpModal,
|
|
27
|
+
SelectTagItem,
|
|
28
|
+
} from '../common/index.js';
|
|
24
29
|
import { Button } from '../ui/button.js';
|
|
25
30
|
import { Form, FormControl, FormField, FormItem, FormLabel } from '../ui/form.js';
|
|
26
31
|
import { Label } from '../ui/label.js';
|
|
@@ -533,7 +538,7 @@ export function ChargesFilters({
|
|
|
533
538
|
/>
|
|
534
539
|
{totalPages > 1 && (
|
|
535
540
|
<Pagination
|
|
536
|
-
className="flex-
|
|
541
|
+
className="flex-fit w-fit mx-0"
|
|
537
542
|
value={activePage}
|
|
538
543
|
onChange={setPage}
|
|
539
544
|
total={totalPages}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
import { Button } from '@/components/ui/button.js';
|
|
3
|
-
import {
|
|
3
|
+
import { Paper, Table } from '@mantine/core';
|
|
4
4
|
|
|
5
5
|
export interface AccounterTableProps<T, U> {
|
|
6
6
|
highlightOnHover?: boolean;
|
|
@@ -16,7 +16,6 @@ export interface AccounterTableProps<T, U> {
|
|
|
16
16
|
moreInfo?: (item: T) => ReactNode;
|
|
17
17
|
showButton?: boolean;
|
|
18
18
|
rowContext?: (item: T) => U | undefined;
|
|
19
|
-
pagination?: PaginationProps;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
export interface AccountTableRow<T, U> {
|
|
@@ -73,7 +72,6 @@ export function AccounterTable<T, U>(props: AccounterTableProps<T, U>): ReactNod
|
|
|
73
72
|
return (
|
|
74
73
|
<>
|
|
75
74
|
<div className="flex flex-row justify-end w-full">
|
|
76
|
-
{props.pagination && <Pagination className="flex-auto" {...props.pagination} />}
|
|
77
75
|
{props.showButton === true ? (
|
|
78
76
|
<Button
|
|
79
77
|
type="button"
|
|
@@ -15,5 +15,6 @@ export * from './loader.js';
|
|
|
15
15
|
export * from './merge-charges/index.js';
|
|
16
16
|
export * from './merge-businesses/index.js';
|
|
17
17
|
export * from './modals/index.js';
|
|
18
|
+
export * from './pagination.js';
|
|
18
19
|
export * from './simple-grid.js';
|
|
19
20
|
export * from './tooltip.js';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PaginationContent,
|
|
3
|
+
PaginationEllipsis,
|
|
4
|
+
PaginationItem,
|
|
5
|
+
PaginationLink,
|
|
6
|
+
PaginationNext,
|
|
7
|
+
PaginationPrevious,
|
|
8
|
+
Pagination as PaginationWrapper,
|
|
9
|
+
} from '@/components/ui/pagination.js';
|
|
10
|
+
|
|
11
|
+
const usePagination = (totalPages: number, currentPage: number): Array<'...' | number> => {
|
|
12
|
+
if (totalPages <= 1) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const pages: Array<'...' | number> = [];
|
|
17
|
+
pages.push(1);
|
|
18
|
+
if (currentPage > 3) {
|
|
19
|
+
pages.push('...');
|
|
20
|
+
}
|
|
21
|
+
if (currentPage > 2) {
|
|
22
|
+
pages.push(currentPage - 1);
|
|
23
|
+
}
|
|
24
|
+
if (currentPage !== 1 && currentPage !== totalPages) {
|
|
25
|
+
pages.push(currentPage);
|
|
26
|
+
}
|
|
27
|
+
if (currentPage < totalPages - 1) {
|
|
28
|
+
pages.push(currentPage + 1);
|
|
29
|
+
}
|
|
30
|
+
if (currentPage < totalPages - 2) {
|
|
31
|
+
pages.push('...');
|
|
32
|
+
}
|
|
33
|
+
pages.push(totalPages);
|
|
34
|
+
return pages;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
interface PaginationProps extends Omit<React.ComponentProps<'nav'>, 'onChange' | 'value'> {
|
|
38
|
+
onChange: (page: number) => void;
|
|
39
|
+
total: number;
|
|
40
|
+
value: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const Pagination = ({ onChange, total, value, ...props }: PaginationProps) => {
|
|
44
|
+
const currentPage = value + 1;
|
|
45
|
+
const pages = usePagination(total, currentPage);
|
|
46
|
+
|
|
47
|
+
if (!pages.length) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<PaginationWrapper {...props}>
|
|
53
|
+
<PaginationContent>
|
|
54
|
+
{/* previous button */}
|
|
55
|
+
<PaginationItem>
|
|
56
|
+
<PaginationPrevious disabled={currentPage <= 1} onClick={() => onChange(value - 1)} />
|
|
57
|
+
</PaginationItem>
|
|
58
|
+
{/* page numbers */}
|
|
59
|
+
{pages.map((page, index) => {
|
|
60
|
+
if (page === '...') {
|
|
61
|
+
return (
|
|
62
|
+
<PaginationItem key={`ellipsis-${index}`}>
|
|
63
|
+
<PaginationEllipsis />
|
|
64
|
+
</PaginationItem>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
const isActive = page === currentPage;
|
|
68
|
+
return (
|
|
69
|
+
<PaginationItem key={`page-${page}`}>
|
|
70
|
+
<PaginationLink onClick={() => onChange(page - 1)} isActive={isActive}>
|
|
71
|
+
{page}
|
|
72
|
+
</PaginationLink>
|
|
73
|
+
</PaginationItem>
|
|
74
|
+
);
|
|
75
|
+
})}
|
|
76
|
+
{/* next button */}
|
|
77
|
+
<PaginationItem>
|
|
78
|
+
<PaginationNext disabled={currentPage >= total} onClick={() => onChange(value + 1)} />
|
|
79
|
+
</PaginationItem>
|
|
80
|
+
</PaginationContent>
|
|
81
|
+
</PaginationWrapper>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
Pagination.displayName = 'Pagination';
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { useMemo, useState, type ReactElement } from 'react';
|
|
2
|
+
import { Pagination } from '@/components/common/index.js';
|
|
3
|
+
import {
|
|
4
|
+
Table,
|
|
5
|
+
TableBody,
|
|
6
|
+
TableCell,
|
|
7
|
+
TableHead,
|
|
8
|
+
TableHeader,
|
|
9
|
+
TableRow,
|
|
10
|
+
} from '@/components/ui/table.js';
|
|
11
|
+
import {
|
|
12
|
+
LedgerRecordsTableFieldsFragmentDoc,
|
|
13
|
+
type LedgerRecordsTableFieldsFragment,
|
|
14
|
+
} from '@/gql/graphql.js';
|
|
15
|
+
import { getFragmentData, type FragmentType } from '@/gql/index.js';
|
|
16
|
+
import { EMPTY_UUID } from '@/helpers/consts.js';
|
|
2
17
|
import {
|
|
3
18
|
flexRender,
|
|
4
19
|
getCoreRowModel,
|
|
@@ -7,14 +22,6 @@ import {
|
|
|
7
22
|
useReactTable,
|
|
8
23
|
type SortingState,
|
|
9
24
|
} from '@tanstack/react-table';
|
|
10
|
-
import {
|
|
11
|
-
LedgerRecordsTableFieldsFragmentDoc,
|
|
12
|
-
type LedgerRecordsTableFieldsFragment,
|
|
13
|
-
} from '../../gql/graphql.js';
|
|
14
|
-
import { getFragmentData, type FragmentType } from '../../gql/index.js';
|
|
15
|
-
import { EMPTY_UUID } from '../../helpers/consts.js';
|
|
16
|
-
import { Pagination } from '../ui/pagination.js';
|
|
17
|
-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../ui/table.js';
|
|
18
25
|
import { columns } from './columns.js';
|
|
19
26
|
|
|
20
27
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { useMemo, useState, type ReactElement } from 'react';
|
|
2
|
+
import { EditTransactionModal, Pagination } from '@/components/common/index.js';
|
|
3
|
+
import {
|
|
4
|
+
Table,
|
|
5
|
+
TableBody,
|
|
6
|
+
TableCell,
|
|
7
|
+
TableHead,
|
|
8
|
+
TableHeader,
|
|
9
|
+
TableRow,
|
|
10
|
+
} from '@/components/ui/table.js';
|
|
11
|
+
import { TransactionForTransactionsTableFieldsFragmentDoc } from '@/gql/graphql.js';
|
|
12
|
+
import { getFragmentData, type FragmentType } from '@/gql/index.js';
|
|
2
13
|
import {
|
|
3
14
|
flexRender,
|
|
4
15
|
getCoreRowModel,
|
|
@@ -7,11 +18,6 @@ import {
|
|
|
7
18
|
useReactTable,
|
|
8
19
|
type SortingState,
|
|
9
20
|
} from '@tanstack/react-table';
|
|
10
|
-
import { TransactionForTransactionsTableFieldsFragmentDoc } from '../../gql/graphql.js';
|
|
11
|
-
import { getFragmentData, type FragmentType } from '../../gql/index.js';
|
|
12
|
-
import { EditTransactionModal } from '../common/index.js';
|
|
13
|
-
import { Pagination } from '../ui/pagination.js';
|
|
14
|
-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../ui/table.js';
|
|
15
21
|
import { actionsColumn, columns, type TransactionsTableRowType } from './columns.js';
|
|
16
22
|
|
|
17
23
|
type Props = {
|
|
@@ -1,89 +1,17 @@
|
|
|
1
1
|
import React, { type ComponentProps } from 'react';
|
|
2
|
-
import { ChevronsLeftIcon, ChevronsRightIcon } from 'lucide-react';
|
|
3
2
|
import { Button } from '@/components/ui/button.js';
|
|
4
3
|
import { cn } from '@/lib/utils.js';
|
|
5
4
|
import { ChevronLeftIcon, ChevronRightIcon, DotsHorizontalIcon } from '@radix-ui/react-icons';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
onChange: (page: number) => void;
|
|
9
|
-
total: number;
|
|
10
|
-
value: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const Pagination = ({ onChange, total, value, ...props }: PaginationProps) => {
|
|
14
|
-
if (total <= 1) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const currentPage = value + 1;
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<PaginationWrapper {...props}>
|
|
21
|
-
<PaginationContent>
|
|
22
|
-
{/* previous button */}
|
|
23
|
-
<PaginationItem>
|
|
24
|
-
<PaginationPrevious disabled={currentPage <= 1} onClick={() => onChange(value - 1)} />
|
|
25
|
-
</PaginationItem>
|
|
26
|
-
|
|
27
|
-
{/* first page button */}
|
|
28
|
-
{total > 3 && currentPage > 1 && (
|
|
29
|
-
<PaginationItem>
|
|
30
|
-
<PaginationLink onClick={() => onChange(0)}>1</PaginationLink>
|
|
31
|
-
</PaginationItem>
|
|
32
|
-
)}
|
|
33
|
-
|
|
34
|
-
{total > 3 && currentPage > 3 && (
|
|
35
|
-
<PaginationItem>
|
|
36
|
-
<PaginationEllipsis />
|
|
37
|
-
</PaginationItem>
|
|
38
|
-
)}
|
|
39
|
-
|
|
40
|
-
{currentPage > 2 && (
|
|
41
|
-
<PaginationItem>
|
|
42
|
-
<PaginationLink onClick={() => onChange(value - 1)}>{currentPage - 1}</PaginationLink>
|
|
43
|
-
</PaginationItem>
|
|
44
|
-
)}
|
|
45
|
-
<PaginationItem>
|
|
46
|
-
<PaginationLink onClick={() => {}} isActive>
|
|
47
|
-
{currentPage}
|
|
48
|
-
</PaginationLink>
|
|
49
|
-
</PaginationItem>
|
|
50
|
-
{currentPage < total - 1 && (
|
|
51
|
-
<PaginationItem>
|
|
52
|
-
<PaginationLink onClick={() => onChange(value + 1)}>{currentPage + 1}</PaginationLink>
|
|
53
|
-
</PaginationItem>
|
|
54
|
-
)}
|
|
55
|
-
|
|
56
|
-
{total > 3 && currentPage < total - 2 && (
|
|
57
|
-
<PaginationItem>
|
|
58
|
-
<PaginationEllipsis />
|
|
59
|
-
</PaginationItem>
|
|
60
|
-
)}
|
|
61
|
-
|
|
62
|
-
{/* last page button */}
|
|
63
|
-
{total > 3 && currentPage < total && (
|
|
64
|
-
<PaginationItem>
|
|
65
|
-
<PaginationLink onClick={() => onChange(total - 1)}>{total}</PaginationLink>
|
|
66
|
-
</PaginationItem>
|
|
67
|
-
)}
|
|
68
|
-
{/* next button */}
|
|
69
|
-
<PaginationItem>
|
|
70
|
-
<PaginationNext disabled={currentPage >= total} onClick={() => onChange(value + 1)} />
|
|
71
|
-
</PaginationItem>
|
|
72
|
-
</PaginationContent>
|
|
73
|
-
</PaginationWrapper>
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
Pagination.displayName = 'Pagination';
|
|
77
|
-
|
|
78
|
-
const PaginationWrapper = ({ className, ...props }: React.ComponentProps<'nav'>) => (
|
|
6
|
+
const Pagination = ({ className, ...props }: React.ComponentProps<'nav'>) => (
|
|
79
7
|
<nav
|
|
80
8
|
role="navigation"
|
|
81
|
-
aria-label="
|
|
9
|
+
aria-label="pagination"
|
|
82
10
|
className={cn('mx-auto flex w-full justify-center', className)}
|
|
83
11
|
{...props}
|
|
84
12
|
/>
|
|
85
13
|
);
|
|
86
|
-
|
|
14
|
+
Pagination.displayName = 'Pagination';
|
|
87
15
|
|
|
88
16
|
const PaginationContent = React.forwardRef<HTMLUListElement, React.ComponentProps<'ul'>>(
|
|
89
17
|
({ className, ...props }, ref) => (
|
|
@@ -135,18 +63,6 @@ const PaginationPrevious = ({
|
|
|
135
63
|
);
|
|
136
64
|
PaginationPrevious.displayName = 'PaginationPrevious';
|
|
137
65
|
|
|
138
|
-
const PaginationFirst = ({ className, ...props }: React.ComponentProps<typeof PaginationLink>) => (
|
|
139
|
-
<PaginationLink
|
|
140
|
-
aria-label="Go to First page"
|
|
141
|
-
size="default"
|
|
142
|
-
className={cn('gap-1 pl-2.5', className)}
|
|
143
|
-
{...props}
|
|
144
|
-
>
|
|
145
|
-
<ChevronsLeftIcon className="h-4 w-4" />
|
|
146
|
-
</PaginationLink>
|
|
147
|
-
);
|
|
148
|
-
PaginationFirst.displayName = 'PaginationFirst';
|
|
149
|
-
|
|
150
66
|
const PaginationNext = ({ className, ...props }: React.ComponentProps<typeof PaginationLink>) => (
|
|
151
67
|
<PaginationLink
|
|
152
68
|
aria-label="Go to next page"
|
|
@@ -159,18 +75,6 @@ const PaginationNext = ({ className, ...props }: React.ComponentProps<typeof Pag
|
|
|
159
75
|
);
|
|
160
76
|
PaginationNext.displayName = 'PaginationNext';
|
|
161
77
|
|
|
162
|
-
const PaginationLast = ({ className, ...props }: React.ComponentProps<typeof PaginationLink>) => (
|
|
163
|
-
<PaginationLink
|
|
164
|
-
aria-label="Go to Last page"
|
|
165
|
-
size="default"
|
|
166
|
-
className={cn('gap-1 pr-2.5', className)}
|
|
167
|
-
{...props}
|
|
168
|
-
>
|
|
169
|
-
<ChevronsRightIcon className="h-4 w-4" />
|
|
170
|
-
</PaginationLink>
|
|
171
|
-
);
|
|
172
|
-
PaginationLast.displayName = 'PaginationLast';
|
|
173
|
-
|
|
174
78
|
const PaginationEllipsis = ({ className, ...props }: React.ComponentProps<'span'>) => (
|
|
175
79
|
<span
|
|
176
80
|
aria-hidden
|
package/src/gql/gql.ts
CHANGED
|
@@ -21,7 +21,7 @@ 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,
|
|
@@ -276,7 +276,7 @@ const documents: Documents = {
|
|
|
276
276
|
"\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,
|
|
277
277
|
"\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,
|
|
278
278
|
"\n query BusinessTripsScreen {\n allBusinessTrips {\n id\n name\n dates {\n start\n }\n ...BusinessTripsRowFields\n }\n }\n": types.BusinessTripsScreenDocument,
|
|
279
|
-
"\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n
|
|
279
|
+
"\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,
|
|
280
280
|
"\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,
|
|
281
281
|
"\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,
|
|
282
282
|
"\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,
|
|
@@ -569,7 +569,7 @@ export function graphql(source: "\n query BusinessTripsScreen {\n allBusines
|
|
|
569
569
|
/**
|
|
570
570
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
571
571
|
*/
|
|
572
|
-
export function graphql(source: "\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n
|
|
572
|
+
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"];
|
|
573
573
|
/**
|
|
574
574
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
575
575
|
*/
|