@accounter/client 0.0.8-alpha-20251022132023-9f41aae2ce16f8761101edc548f486cc6ce80333 → 0.0.8-alpha-20251022144027-c9c7a4b309de8a72dfd0ec4f11e63713ad12878f

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +1 -25
  2. package/dist/assets/index-B2UYAO1O.css +1 -0
  3. package/dist/assets/index-CZb2m31K.js +1229 -0
  4. package/dist/assets/{index.es-CL8po8bM.js → index.es-9gVMpHTc.js} +5 -5
  5. package/dist/index.html +2 -2
  6. package/package.json +1 -1
  7. package/src/components/business/admin-business-section.tsx +284 -0
  8. package/src/components/business/index.tsx +22 -0
  9. package/src/components/business-transactions/business-extended-info.tsx +15 -13
  10. package/src/components/business-transactions/business-transactions-single.tsx +3 -3
  11. package/src/components/business-transactions/index.tsx +1 -12
  12. package/src/components/business-trips/business-trip.tsx +3 -3
  13. package/src/components/charges/cells/business-trip.tsx +8 -6
  14. package/src/components/charges/cells/counterparty.tsx +5 -7
  15. package/src/components/common/accounter-table.tsx +5 -6
  16. package/src/components/common/business-trip-report/parts/core-expense-row.tsx +9 -11
  17. package/src/components/common/business-trip-report/parts/uncategorized-transactions.tsx +13 -11
  18. package/src/components/common/buttons/button-with-label.tsx +41 -0
  19. package/src/components/common/buttons/button.tsx +44 -0
  20. package/src/components/common/buttons/index.ts +2 -0
  21. package/src/components/common/buttons/logout-button.tsx +6 -7
  22. package/src/components/common/documents-to-charge-matcher/selection-handler/index.tsx +2 -4
  23. package/src/components/common/documents-to-charge-matcher/selection-handler/wide-filtered-selection.tsx +7 -5
  24. package/src/components/common/forms/edit-document.tsx +10 -21
  25. package/src/components/common/new-documents-list.tsx +8 -10
  26. package/src/components/documents-table/cells/creditor.tsx +4 -11
  27. package/src/components/documents-table/cells/debtor.tsx +4 -11
  28. package/src/components/layout/dashboard-layout.tsx +0 -4
  29. package/src/components/layout/sidelinks.tsx +27 -28
  30. package/src/components/ledger-table/counterparty-cell.tsx +13 -19
  31. package/src/components/login-page.tsx +1 -2
  32. package/src/components/reports/corporate-tax-ruling-compliance-report/index.tsx +3 -3
  33. package/src/components/reports/profit-and-loss-report/index.tsx +3 -3
  34. package/src/components/reports/tax-report/index.tsx +3 -3
  35. package/src/components/screens/businesses/business.tsx +9 -21
  36. package/src/components/screens/charges/charge.tsx +9 -22
  37. package/src/components/transactions-table/cells/counterparty.tsx +2 -9
  38. package/src/components/transactions-table/cells-legacy/counterparty.tsx +2 -9
  39. package/src/gql/gql.ts +15 -3
  40. package/src/gql/graphql.ts +4913 -1559
  41. package/src/hooks/use-update-admin-business.ts +71 -0
  42. package/src/index.tsx +22 -4
  43. package/src/providers/auth-guard.tsx +23 -14
  44. package/src/providers/index.tsx +2 -7
  45. package/src/providers/urql.tsx +12 -7
  46. package/src/providers/user-provider.tsx +2 -3
  47. package/dist/assets/Checkbox-DBF5r7jA.js +0 -6
  48. package/dist/assets/Progress-Cjv9yrat.js +0 -1
  49. package/dist/assets/Typography-DdVppmQe.js +0 -1
  50. package/dist/assets/accordion-DcMd-Til.js +0 -1
  51. package/dist/assets/accountant-approvals-CU_EA64d.js +0 -1
  52. package/dist/assets/all-charges-DKGmrDeD.js +0 -1
  53. package/dist/assets/arrow-up-down-BeIaAKWn.js +0 -6
  54. package/dist/assets/business-EtSaFzKh.js +0 -37
  55. package/dist/assets/business-transactions-single-B0Up2Bs4.js +0 -1
  56. package/dist/assets/business-trip-CmMmdjCh.js +0 -1
  57. package/dist/assets/charges-filters-CqWjSIKI.js +0 -1
  58. package/dist/assets/charges-ledger-validation-DHfLjNlq.js +0 -1
  59. package/dist/assets/chart-D1Y6fN3z.js +0 -74
  60. package/dist/assets/data-table-pagination-BCciANKD.js +0 -11
  61. package/dist/assets/editable-business-trip-VNJjiYOp.js +0 -16
  62. package/dist/assets/graphql-document-dedupe-fragments-ByT8-wlV.js +0 -1
  63. package/dist/assets/index-1L3dEkVN.js +0 -1
  64. package/dist/assets/index-4ZIYAzBJ.js +0 -1
  65. package/dist/assets/index-4r9JDo8p.js +0 -1
  66. package/dist/assets/index-BFHiMLVc.js +0 -1
  67. package/dist/assets/index-BGmhxff9.js +0 -1
  68. package/dist/assets/index-BMcyYDGt.js +0 -11
  69. package/dist/assets/index-BVQkLk5i.js +0 -1
  70. package/dist/assets/index-Bj3HckU6.js +0 -876
  71. package/dist/assets/index-BnQW4CTb.js +0 -1
  72. package/dist/assets/index-C0FVazZA.js +0 -24
  73. package/dist/assets/index-CUDeasQ_.js +0 -1
  74. package/dist/assets/index-Cfm6e2hX.js +0 -1
  75. package/dist/assets/index-Cqz-mRoO.js +0 -17
  76. package/dist/assets/index-Cs7MeC4J.js +0 -137
  77. package/dist/assets/index-CzzfC-dD.css +0 -1
  78. package/dist/assets/index-DABsOOfA.js +0 -1
  79. package/dist/assets/index-DB4BgQdp.js +0 -2
  80. package/dist/assets/index-DV-Q6DUw.js +0 -1
  81. package/dist/assets/index-Dd5ylSyH.js +0 -9
  82. package/dist/assets/index-Dn7p3J8Q.js +0 -1
  83. package/dist/assets/index-Dpk6i3ex.js +0 -6
  84. package/dist/assets/index-EiT4SOpW.js +0 -2
  85. package/dist/assets/index-rcKvu7eR.js +0 -6
  86. package/dist/assets/index-sDbz8nnb.js +0 -1
  87. package/dist/assets/issue-document-CYdlZijI.js +0 -1
  88. package/dist/assets/login-page-CnMdssTN.js +0 -1
  89. package/dist/assets/missing-info-charges-CzeKbCyG.js +0 -1
  90. package/dist/assets/page-not-found-Bsa0DCM4.js +0 -1
  91. package/dist/assets/pencil-BMWYIsZB.js +0 -6
  92. package/dist/assets/report-commentary-row-D9AtKtZx.js +0 -1
  93. package/dist/assets/save-DC_eQcBj.js +0 -11
  94. package/dist/assets/sequential-CAnleQny.js +0 -1
  95. package/dist/assets/similar-charges-by-business-modal-Dmb2ZymF.js +0 -1
  96. package/dist/assets/sub-BIMwxqar.js +0 -1
  97. package/dist/assets/subMonths-B7SR4Lli.js +0 -1
  98. package/src/components/error-boundary.tsx +0 -189
  99. package/src/components/layout/breadcrumbs.tsx +0 -72
  100. package/src/components/layout/document-title.tsx +0 -26
  101. package/src/components/layout/navigation-progress.tsx +0 -52
  102. package/src/components/layout/page-skeleton.tsx +0 -49
  103. package/src/providers/urql-client.ts +0 -86
  104. package/src/router/config.tsx +0 -534
  105. package/src/router/layouts/dashboard-layout.tsx +0 -20
  106. package/src/router/layouts/root-layout.tsx +0 -69
  107. package/src/router/loaders/auth-loader.ts +0 -32
  108. package/src/router/loaders/business-loader.ts +0 -25
  109. package/src/router/loaders/charge-loader.ts +0 -25
  110. package/src/router/loaders/index.ts +0 -17
  111. package/src/router/routes.ts +0 -88
  112. package/src/router/types.ts +0 -68
@@ -0,0 +1,41 @@
1
+ import type { CSSProperties, MouseEventHandler, ReactElement } from 'react';
2
+
3
+ export interface ButtonWithLabelProps {
4
+ onClick?: MouseEventHandler<HTMLButtonElement>;
5
+ type?: 'submit' | 'button';
6
+ style?: CSSProperties;
7
+ target?: string;
8
+ rel?: string;
9
+ title?: string;
10
+ url?: string;
11
+ textLabel?: string;
12
+ }
13
+
14
+ export const ButtonWithLabel = ({
15
+ title,
16
+ url,
17
+ style,
18
+ target,
19
+ textLabel,
20
+ rel,
21
+ type = 'button',
22
+ onClick,
23
+ }: ButtonWithLabelProps): ReactElement => {
24
+ return (
25
+ <div>
26
+ <label className="text-sm font-medium text-gray-700">{textLabel}</label>
27
+ <div>
28
+ <button
29
+ style={style}
30
+ type={type}
31
+ onClick={onClick}
32
+ className="bg-gray-100 border focus:ring-2 focus:ring-indigo-200 focus:bg-transparent hover:bg-indigo-500 hover:text-white text-base outline-hidden text-gray-700 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out sm:text-sm rounded-md"
33
+ >
34
+ <a rel={rel} target={target} href={url} type={type}>
35
+ {title}
36
+ </a>
37
+ </button>
38
+ </div>
39
+ </div>
40
+ );
41
+ };
@@ -0,0 +1,44 @@
1
+ import type {
2
+ ButtonHTMLAttributes,
3
+ CSSProperties,
4
+ DetailedHTMLProps,
5
+ MouseEventHandler,
6
+ ReactElement,
7
+ } from 'react';
8
+
9
+ export interface Props
10
+ extends DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
11
+ onClick?: MouseEventHandler<HTMLButtonElement>;
12
+ herf?: string;
13
+ type?: 'submit' | 'button';
14
+ style?: CSSProperties;
15
+ target?: string;
16
+ rel?: string;
17
+ title?: string;
18
+ url?: string;
19
+ }
20
+
21
+ export const Button = ({
22
+ title,
23
+ herf,
24
+ style,
25
+ target,
26
+ rel,
27
+ type = 'button',
28
+ onClick,
29
+ ...props
30
+ }: Props): ReactElement => {
31
+ return (
32
+ <button
33
+ style={style}
34
+ type={type}
35
+ onClick={onClick}
36
+ className="cursor: pointer text-align: center flex ml-auto text-white bg-indigo-500 border-0 py-1.5 px-3 focus:outline-hidden hover:bg-indigo-600 rounded-sm;"
37
+ {...props}
38
+ >
39
+ <a rel={rel} target={target} href={herf} type={type}>
40
+ {title}
41
+ </a>
42
+ </button>
43
+ );
44
+ };
@@ -1,3 +1,5 @@
1
+ export * from './button.js';
2
+ export * from './button-with-label.js';
1
3
  export * from './charge-navigate-button.js';
2
4
  export * from './close-document-button.js';
3
5
  export * from './confirm-mini-button.js';
@@ -1,20 +1,19 @@
1
- import { useContext, type ReactElement } from 'react';
1
+ import { useCallback, useContext, type ReactElement } from 'react';
2
2
  import { useNavigate } from 'react-router-dom';
3
3
  import { AuthContext } from '../../../providers/auth-guard.js';
4
- import { ROUTES } from '../../../router/routes.js';
5
4
  import { Button } from '../../ui/button.js';
6
5
 
7
6
  export function LogoutButton(): ReactElement {
8
7
  const navigate = useNavigate();
9
8
  const { authService } = useContext(AuthContext);
10
9
 
11
- const handleLogout = async (): Promise<void> => {
12
- await authService.logout();
13
- navigate(ROUTES.LOGIN);
14
- };
10
+ const onLogout = useCallback(() => {
11
+ authService.logout();
12
+ navigate('/login');
13
+ }, [navigate, authService]);
15
14
 
16
15
  return (
17
- <Button variant="ghost" onClick={handleLogout}>
16
+ <Button variant="ghost" onClick={onLogout}>
18
17
  Log out
19
18
  </Button>
20
19
  );
@@ -1,5 +1,4 @@
1
1
  import { useMemo, useState, type ReactElement } from 'react';
2
- import { Button } from '@/components/ui/button.js';
3
2
  import {
4
3
  ChargeToMatchDocumentsFieldsFragmentDoc,
5
4
  DocumentsToMatchFieldsFragmentDoc,
@@ -10,6 +9,7 @@ import { getFragmentData, type FragmentType } from '../../../../gql/index.js';
10
9
  import { useUpdateDocument } from '../../../../hooks/use-update-document.js';
11
10
  import { FormLabel } from '../../../ui/form.js';
12
11
  import { Switch } from '../../../ui/switch.js';
12
+ import { Button } from '../../index.js';
13
13
  import { StrictFilteredSelection } from './strict-filtered-selection.js';
14
14
  import { WideFilteredSelection } from './wide-filtered-selection.js';
15
15
 
@@ -165,9 +165,7 @@ export function SelectionHandler({ chargeProps, documentsProps, onDone }: Props)
165
165
  <Switch checked={filterSuggestions} onCheckedChange={setFilterSuggestions} />
166
166
  </div>
167
167
  )}
168
- <Button disabled={selectedDocuments.length === 0} onClick={onExecuteMatch}>
169
- Accept
170
- </Button>
168
+ <Button title="Accept" disabled={selectedDocuments.length === 0} onClick={onExecuteMatch} />
171
169
  </div>
172
170
  <div>
173
171
  {filterSuggestions ? (
@@ -1,11 +1,10 @@
1
1
  import { useState, type ReactElement } from 'react';
2
- import { Button } from '@/components/ui/button.js';
3
2
  import { Image } from '@mantine/core';
4
3
  import {
5
4
  type ChargeToMatchDocumentsFieldsFragment,
6
5
  type DocumentsToMatchFieldsFragment,
7
6
  } from '../../../../gql/graphql.js';
8
- import { AccounterTable, PopUpModal } from '../../index.js';
7
+ import { AccounterTable, Button, PopUpModal } from '../../index.js';
9
8
 
10
9
  interface Props {
11
10
  documents: Exclude<
@@ -54,9 +53,12 @@ export function WideFilteredSelection({
54
53
  title: 'File',
55
54
  value: doc =>
56
55
  doc.file && (
57
- <a href={doc.file?.toString()} target="_blank" rel="noreferrer">
58
- <Button>Open Link</Button>
59
- </a>
56
+ <Button
57
+ target="_blank"
58
+ rel="noreferrer"
59
+ herf={doc.file?.toString()}
60
+ title="Open Link"
61
+ />
60
62
  ),
61
63
  },
62
64
  { title: 'Date', value: doc => ('date' in doc ? doc.date : null) },
@@ -1,15 +1,12 @@
1
1
  import { useEffect, useState, type ReactElement } from 'react';
2
2
  import { useForm, type SubmitHandler } from 'react-hook-form';
3
- import { Link } from 'react-router-dom';
4
3
  import { useQuery } from 'urql';
5
- import { Button } from '@/components/ui/button.js';
6
- import { Label } from '@/components/ui/label.js';
7
4
  import { Drawer, Image, Loader } from '@mantine/core';
8
5
  import { EditDocumentDocument, type UpdateDocumentFieldsInput } from '../../../gql/graphql.js';
9
6
  import { relevantDataPicker, type MakeBoolean } from '../../../helpers/form.js';
10
7
  import { useUpdateDocument } from '../../../hooks/use-update-document.js';
11
8
  import { Form } from '../../ui/form.js';
12
- import { ImageMagnifier, SimpleGrid } from '../index.js';
9
+ import { ButtonWithLabel, ImageMagnifier, SimpleGrid } from '../index.js';
13
10
  import { ModifyDocumentFields } from './modify-document-fields.js';
14
11
 
15
12
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
@@ -109,29 +106,21 @@ export const EditDocument = ({ documentId, onDone, onChange }: Props): ReactElem
109
106
  <form onSubmit={handleSubmit(onSubmit)}>
110
107
  <SimpleGrid cols={4}>
111
108
  <ModifyDocumentFields document={document} formManager={formManager} />
112
-
113
- <div className="space-y-2">
114
- <Label htmlFor="file">File</Label>
115
- <Link
116
- to={document?.file?.toString() || ''}
117
- target="_blank"
118
- rel="noreferrer"
119
- className="flex flex-col items-center justify-center mt-5"
120
- >
121
- <Button variant="outline" className="w-full mb-2">
122
- Open File
123
- </Button>
124
- </Link>
125
- </div>
109
+ <ButtonWithLabel
110
+ target="_blank"
111
+ textLabel="File"
112
+ url={document?.file?.toString()}
113
+ title="Open Link"
114
+ />
126
115
  </SimpleGrid>
127
116
  <div className="flex justify-center mt-5">
128
- <Button
117
+ <button
129
118
  type="submit"
130
- variant="default"
119
+ className="inline-flex cursor-pointer justify-center py-2 px-4 w-2/12 border border-transparent shadow-xs text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
131
120
  disabled={fetching || Object.keys(dirtyFields).length === 0}
132
121
  >
133
122
  Save
134
- </Button>
123
+ </button>
135
124
  </div>
136
125
  </form>
137
126
  </Form>
@@ -1,5 +1,5 @@
1
1
  import type { ReactElement } from 'react';
2
- import { Link } from 'react-router-dom';
2
+ import { NavLink } from '@mantine/core';
3
3
  import { NewFetchedDocumentFieldsFragmentDoc } from '../../gql/graphql.js';
4
4
  import { getFragmentData, type FragmentType } from '../../gql/index.js';
5
5
  import { getChargeHref } from '../screens/charges/charge.js';
@@ -32,16 +32,14 @@ export const NewDocumentsList = ({ data }: Props): ReactElement => {
32
32
  {documents
33
33
  .filter(({ charge }) => charge)
34
34
  .map(doc => (
35
- <Link
35
+ <NavLink
36
36
  key={doc.id}
37
- to={getChargeHref(doc.charge!.id)}
38
- target="_blank"
39
- rel="noreferrer"
40
- onClick={event => event.stopPropagation()}
41
- className="inline-flex items-center font-semibold"
42
- >
43
- {`${doc.charge!.counterparty?.name ?? 'Unknown'} - ${doc.charge!.userDescription}`}
44
- </Link>
37
+ label={`${doc.charge!.counterparty?.name ?? 'Unknown'} - ${doc.charge!.userDescription}`}
38
+ onClick={(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
39
+ event.stopPropagation();
40
+ window.open(getChargeHref(doc.charge!.id), '_blank', 'noreferrer');
41
+ }}
42
+ />
45
43
  ))}
46
44
  </div>
47
45
  );
@@ -1,10 +1,9 @@
1
1
  import { useCallback, useMemo, useState, type ReactElement } from 'react';
2
- import { Link } from 'react-router-dom';
3
2
  import { DocumentType } from '@/gql/graphql.js';
4
3
  import { useGetBusinesses } from '@/hooks/use-get-businesses.js';
5
4
  import { useUpdateDocument } from '@/hooks/use-update-document.js';
6
5
  import { useUrlQuery } from '@/hooks/use-url-query.js';
7
- import { Indicator } from '@mantine/core';
6
+ import { Indicator, NavLink } from '@mantine/core';
8
7
  import { getBusinessHref } from '../../charges/helpers.js';
9
8
  import { ConfirmMiniButton, InsertBusiness, SelectWithSearch } from '../../common/index.js';
10
9
  import type { DocumentsTableRowType } from '../columns.js';
@@ -105,15 +104,9 @@ export const Creditor = ({ document, onChange }: Props): ReactElement => {
105
104
  <Indicator inline size={12} disabled={!isError} color="red" zIndex="auto">
106
105
  {shouldHaveCreditor &&
107
106
  (id ? (
108
- <Link
109
- to={getHref(id)}
110
- target="_blank"
111
- rel="noreferrer"
112
- onClick={event => event.stopPropagation()}
113
- className="inline-flex items-center font-semibold"
114
- >
115
- {name}
116
- </Link>
107
+ <a href={getHref(id)} target="_blank" rel="noreferrer">
108
+ <NavLink label={name} className="[&>*>.mantine-NavLink-label]:font-semibold" />
109
+ </a>
117
110
  ) : (
118
111
  <SelectWithSearch
119
112
  options={selectableBusinesses}
@@ -1,7 +1,6 @@
1
1
  import { useCallback, useMemo, useState, type ReactElement } from 'react';
2
- import { Link } from 'react-router-dom';
3
2
  import { useGetBusinesses } from '@/hooks/use-get-businesses.js';
4
- import { Indicator } from '@mantine/core';
3
+ import { Indicator, NavLink } from '@mantine/core';
5
4
  import { DocumentType } from '../../../gql/graphql.js';
6
5
  import { useUpdateDocument } from '../../../hooks/use-update-document.js';
7
6
  import { useUrlQuery } from '../../../hooks/use-url-query.js';
@@ -101,15 +100,9 @@ export const Debtor = ({ document, onChange }: Props): ReactElement => {
101
100
  <Indicator inline size={12} disabled={!isError} color="red" zIndex="auto">
102
101
  {shouldHaveDebtor &&
103
102
  (id ? (
104
- <Link
105
- to={getHref(id)}
106
- target="_blank"
107
- rel="noreferrer"
108
- onClick={event => event.stopPropagation()}
109
- className="inline-flex items-center font-semibold"
110
- >
111
- {name}
112
- </Link>
103
+ <a href={getHref(id)} target="_blank" rel="noreferrer">
104
+ <NavLink label={name} className="[&>*>.mantine-NavLink-label]:font-semibold" />
105
+ </a>
113
106
  ) : (
114
107
  <SelectWithSearch
115
108
  options={selectableBusinesses}
@@ -1,9 +1,7 @@
1
1
  import type { ReactElement } from 'react';
2
2
  import { useSidebar } from '../../hooks/use-sidebar.js';
3
- import { Breadcrumbs } from './breadcrumbs.js';
4
3
  import { Footer } from './footer.js';
5
4
  import { Header } from './header.js';
6
- import { NavigationProgress } from './navigation-progress.js';
7
5
  import { Sidebar } from './sidebar.js';
8
6
 
9
7
  type DashboardLayoutProps = {
@@ -16,14 +14,12 @@ export function DashboardLayout({ children, filtersContext }: DashboardLayoutPro
16
14
 
17
15
  return (
18
16
  <main>
19
- <NavigationProgress />
20
17
  <Header />
21
18
  <div className="flex h-screen overflow-hidden bg-gray-100">
22
19
  <Sidebar />
23
20
  <div
24
21
  className={`overflow-scroll flex flex-col justify-start gap-10 z-0 my-20 pl-10 flex-1 ${isMinimized ? 'pr-10' : 'pr-5'} transition-all`}
25
22
  >
26
- <Breadcrumbs />
27
23
  {children}
28
24
  </div>
29
25
  </div>
@@ -26,7 +26,6 @@ import {
26
26
  Scale,
27
27
  Tags,
28
28
  } from 'lucide-react';
29
- import { ROUTES } from '../../router/routes.js';
30
29
 
31
30
  export interface NavLink {
32
31
  title: string;
@@ -50,19 +49,19 @@ export const sidelinks: SideLink[] = [
50
49
  {
51
50
  title: 'All Charges',
52
51
  label: '',
53
- href: ROUTES.CHARGES.ALL,
52
+ href: '/charges',
54
53
  icon: <Receipt size={18} />,
55
54
  },
56
55
  {
57
56
  title: 'Missing Info Charges',
58
57
  label: '',
59
- href: ROUTES.CHARGES.MISSING_INFO,
58
+ href: '/charges/missing-info',
60
59
  icon: <RectangleEllipsis size={18} />,
61
60
  },
62
61
  {
63
62
  title: 'Ledger Validation',
64
63
  label: '',
65
- href: ROUTES.CHARGES.LEDGER_VALIDATION,
64
+ href: '/charges/ledger-validation',
66
65
  icon: <BookOpenCheck size={18} />,
67
66
  },
68
67
  ],
@@ -76,73 +75,73 @@ export const sidelinks: SideLink[] = [
76
75
  {
77
76
  title: 'VAT Monthly Report',
78
77
  label: '',
79
- href: ROUTES.REPORTS.VAT_MONTHLY,
78
+ href: '/reports/vat-monthly',
80
79
  icon: <Receipt size={18} />,
81
80
  },
82
81
  {
83
82
  title: 'Trial Balance Report',
84
83
  label: '',
85
- href: ROUTES.REPORTS.TRIAL_BALANCE,
84
+ href: '/reports/trial-balance',
86
85
  icon: <Scale size={18} />,
87
86
  },
88
87
  {
89
88
  title: 'Conto Report',
90
89
  label: '',
91
- href: ROUTES.REPORTS.CONTO,
90
+ href: '/reports/conto',
92
91
  icon: <Puzzle size={18} />,
93
92
  },
94
93
  {
95
94
  title: 'Profit and Loss Report',
96
95
  label: '',
97
- href: ROUTES.REPORTS.PROFIT_AND_LOSS(),
96
+ href: '/reports/profit-and-loss',
98
97
  icon: <HandCoins size={18} />,
99
98
  },
100
99
  {
101
100
  title: 'Tax Report',
102
101
  label: '',
103
- href: ROUTES.REPORTS.TAX(),
102
+ href: '/reports/tax',
104
103
  icon: <ParkingMeter size={18} />,
105
104
  },
106
105
  {
107
106
  title: 'Corporate Tax Ruling Compliance Report',
108
107
  label: '',
109
- href: ROUTES.REPORTS.CORPORATE_TAX_RULING_COMPLIANCE(),
108
+ href: '/reports/corporate-tax-ruling-compliance',
110
109
  icon: <ParkingMeter size={18} />,
111
110
  },
112
111
  {
113
112
  title: 'Depreciation Report',
114
113
  label: '',
115
- href: ROUTES.REPORTS.DEPRECIATION,
114
+ href: '/reports/depreciation',
116
115
  icon: <ChartColumnDecreasing size={18} />,
117
116
  },
118
117
  {
119
118
  title: 'Shaam 6111 Report',
120
119
  label: '',
121
- href: ROUTES.REPORTS.SHAAM_6111,
120
+ href: '/reports/shaam6111',
122
121
  icon: <HandCoins size={18} />,
123
122
  },
124
123
  {
125
124
  title: 'Accountant Approvals',
126
125
  label: '',
127
- href: ROUTES.ACCOUNTANT_APPROVALS,
126
+ href: '/accountant-approvals',
128
127
  icon: <Calculator size={18} />,
129
128
  },
130
129
  {
131
130
  title: 'Yearly Ledger Report',
132
131
  label: '',
133
- href: ROUTES.REPORTS.YEARLY_LEDGER,
132
+ href: '/reports/yearly-ledger',
134
133
  icon: <Rows4 size={18} />,
135
134
  },
136
135
  {
137
136
  title: 'Transactions Balance',
138
137
  label: '',
139
- href: ROUTES.REPORTS.BALANCE,
138
+ href: '/reports/balance',
140
139
  icon: <ChartNoAxesCombined size={18} />,
141
140
  },
142
141
  {
143
142
  title: 'Validate Reports',
144
143
  label: '',
145
- href: ROUTES.REPORTS.VALIDATE_REPORTS,
144
+ href: '/reports/validate-reports',
146
145
  icon: <CheckCheck size={18} />,
147
146
  },
148
147
  {
@@ -161,25 +160,25 @@ export const sidelinks: SideLink[] = [
161
160
  {
162
161
  title: 'Businesses',
163
162
  label: '',
164
- href: ROUTES.BUSINESSES.ALL,
163
+ href: '/businesses',
165
164
  icon: <Factory size={18} />,
166
165
  },
167
166
  {
168
167
  title: 'Business Transactions',
169
168
  label: '',
170
- href: ROUTES.BUSINESSES.TRANSACTIONS,
169
+ href: '/businesses/transactions',
171
170
  icon: <ArrowLeftRight size={18} />,
172
171
  },
173
172
  {
174
173
  title: 'Tax Categories',
175
174
  label: '',
176
- href: ROUTES.TAX_CATEGORIES,
175
+ href: '/tax-categories',
177
176
  icon: <ArrowDown01 size={18} />,
178
177
  },
179
178
  {
180
179
  title: 'Sort Codes',
181
180
  label: '',
182
- href: ROUTES.SORT_CODES,
181
+ href: '/sort-codes',
183
182
  icon: <Book size={18} />,
184
183
  },
185
184
  ],
@@ -191,7 +190,7 @@ export const sidelinks: SideLink[] = [
191
190
  icon: <Files size={18} />,
192
191
  sub: [
193
192
  {
194
- href: ROUTES.DOCUMENTS.ALL,
193
+ href: '/documents',
195
194
  title: 'All Documents',
196
195
  label: '',
197
196
  icon: <Files size={18} />,
@@ -199,19 +198,19 @@ export const sidelinks: SideLink[] = [
199
198
  {
200
199
  title: 'Issue Documents',
201
200
  label: '',
202
- href: ROUTES.DOCUMENTS.ISSUE_DOCUMENTS,
201
+ href: '/documents/issue-documents',
203
202
  icon: <FilePen size={18} />,
204
203
  },
205
204
  {
206
205
  title: 'Issue Document',
207
206
  label: '',
208
- href: ROUTES.DOCUMENTS.ISSUE_DOCUMENT,
207
+ href: '/documents/issue-document',
209
208
  icon: <FilePen size={18} />,
210
209
  },
211
210
  ],
212
211
  },
213
212
  {
214
- href: ROUTES.BUSINESS_TRIPS.ALL,
213
+ href: '/business-trips',
215
214
  title: 'Business Trips',
216
215
  label: '',
217
216
  icon: <PlaneTakeoff size={18} />,
@@ -225,25 +224,25 @@ export const sidelinks: SideLink[] = [
225
224
  {
226
225
  title: 'Main',
227
226
  label: '',
228
- href: ROUTES.CHARTS.MAIN,
227
+ href: '/charts/',
229
228
  icon: <BarChartBig size={18} />,
230
229
  },
231
230
  {
232
231
  title: 'Monthly Income/Expense',
233
232
  label: '',
234
- href: ROUTES.CHARTS.MONTHLY_INCOME_EXPENSE,
233
+ href: '/charts/monthly-income-expense',
235
234
  icon: <BarChartBig size={18} />,
236
235
  },
237
236
  ],
238
237
  },
239
238
  {
240
- href: ROUTES.SALARIES,
239
+ href: '/salaries',
241
240
  title: 'Salaries',
242
241
  label: '',
243
242
  icon: <BadgeDollarSign size={18} />,
244
243
  },
245
244
  {
246
- href: ROUTES.TAGS,
245
+ href: '/tags',
247
246
  title: 'Tags',
248
247
  label: '',
249
248
  icon: <Tags size={18} />,
@@ -1,5 +1,5 @@
1
1
  import { useCallback, type ReactElement } from 'react';
2
- import { Link } from 'react-router-dom';
2
+ import { NavLink } from '@mantine/core';
3
3
  import type { ChargeFilter } from '../../gql/graphql.js';
4
4
  import { useUrlQuery } from '../../hooks/use-url-query.js';
5
5
  import { getBusinessTransactionsHref } from '../business-transactions/index.js';
@@ -50,27 +50,21 @@ export const CounterpartyCell = ({ account, diffAccount }: Props): ReactElement
50
50
  {(account || isAccountDiff) && (
51
51
  <>
52
52
  {account && (
53
- <Link
54
- to={getHref(account.id)}
55
- target="_blank"
56
- rel="noreferrer"
57
- onClick={event => event.stopPropagation()}
58
- className={`inline-flex items-center font-semibold ${isAccountDiff ? 'line-through' : ''}`}
59
- >
60
- {account.name}
61
- </Link>
53
+ <a href={getHref(account.id)} target="_blank" rel="noreferrer">
54
+ <NavLink
55
+ label={account.name}
56
+ className={`[&>*>.mantine-NavLink-label]:font-semibold ${isAccountDiff ? 'line-through' : ''}`}
57
+ />
58
+ </a>
62
59
  )}
63
60
  {isAccountDiff && diffAccount && (
64
61
  <div className="border-2 border-yellow-500 rounded-md">
65
- <Link
66
- to={getHref(diffAccount.id)}
67
- target="_blank"
68
- rel="noreferrer"
69
- onClick={event => event.stopPropagation()}
70
- className="inline-flex items-center font-semibold"
71
- >
72
- {diffAccount.name}
73
- </Link>
62
+ <a href={getHref(diffAccount.id)} target="_blank" rel="noreferrer">
63
+ <NavLink
64
+ label={diffAccount.name}
65
+ className="[&>*>.mantine-NavLink-label]:font-semibold"
66
+ />
67
+ </a>
74
68
  </div>
75
69
  )}
76
70
  </>
@@ -5,7 +5,6 @@ import { toast } from 'sonner';
5
5
  import { z } from 'zod';
6
6
  import { zodResolver } from '@hookform/resolvers/zod';
7
7
  import { AuthContext } from '../providers/auth-guard.js';
8
- import { ROUTES } from '../router/routes.js';
9
8
  import { Button } from './ui/button.js';
10
9
  import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from './ui/form.js';
11
10
  import { Input } from './ui/input.js';
@@ -33,7 +32,7 @@ export function LoginPage(): ReactElement {
33
32
  function onSubmit(values: z.infer<typeof formSchema>) {
34
33
  try {
35
34
  authService.login(values.username, values.password).then(_user => {
36
- navigate(ROUTES.HOME);
35
+ navigate('/');
37
36
  });
38
37
  toast.success('Success', {
39
38
  description: 'You have successfully logged in.',
@@ -1,6 +1,6 @@
1
1
  import { useContext, useEffect, useState, type ReactElement } from 'react';
2
2
  import { Loader2 } from 'lucide-react';
3
- import { useParams } from 'react-router-dom';
3
+ import { useMatch } from 'react-router-dom';
4
4
  import { useQuery } from 'urql';
5
5
  import { Indicator, Table, Tooltip } from '@mantine/core';
6
6
  import { CorporateTaxRulingComplianceReportDocument, Currency } from '../../../gql/graphql.js';
@@ -109,10 +109,10 @@ function multipleOptionalFormatter(amounts: number[], currency: Currency) {
109
109
  }
110
110
 
111
111
  export const CorporateTaxRulingComplianceReport = (): ReactElement => {
112
- const { year: yearFromUrl } = useParams<{ year: string }>();
112
+ const match = useMatch('/reports/corporate-tax-ruling-compliance/:year');
113
113
  const { setFiltersContext } = useContext(FiltersContext);
114
114
  const [years, setYears] = useState<number[]>(
115
- yearFromUrl ? [Number(yearFromUrl)] : [new Date().getFullYear()],
115
+ (match ? [Number(match.params.year)] : undefined) ?? [new Date().getFullYear()],
116
116
  );
117
117
 
118
118
  // fetch data