payment-kit 1.13.124 → 1.13.126
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/blocklet.yml +1 -1
- package/package.json +4 -4
- package/src/components/invoice/action.tsx +1 -2
- package/src/components/passport/actions.tsx +1 -2
- package/src/components/passport/assign.tsx +1 -3
- package/src/components/payment-intent/actions.tsx +1 -2
- package/src/components/payment-link/actions.tsx +1 -2
- package/src/components/pricing-table/actions.tsx +1 -2
- package/src/components/product/actions.tsx +1 -2
- package/src/components/subscription/actions/index.tsx +1 -2
- package/src/components/subscription/items/usage-records.tsx +1 -2
- package/src/components/{portal/subscription → subscription/portal}/actions.tsx +1 -2
- package/src/components/{portal/subscription → subscription/portal}/list.tsx +8 -3
- package/src/pages/admin/products/prices/actions.tsx +1 -2
- package/src/pages/customer/index.tsx +8 -3
- package/src/pages/customer/subscription/detail.tsx +1 -1
- package/src/components/confirm.tsx +0 -39
- package/src/components/portal/invoice/list.tsx +0 -124
- /package/src/components/{portal/subscription → subscription/portal}/cancel.tsx +0 -0
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.126",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "cross-env COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@arcblock/jwt": "^1.18.108",
|
|
51
51
|
"@arcblock/ux": "^2.9.19",
|
|
52
52
|
"@blocklet/logger": "1.16.23-beta-aeb9f5bd",
|
|
53
|
-
"@blocklet/payment-react": "1.13.
|
|
53
|
+
"@blocklet/payment-react": "1.13.126",
|
|
54
54
|
"@blocklet/sdk": "1.16.23-beta-aeb9f5bd",
|
|
55
55
|
"@blocklet/ui-react": "^2.9.19",
|
|
56
56
|
"@blocklet/uploader": "^0.0.67",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@abtnode/types": "1.16.23-beta-aeb9f5bd",
|
|
112
112
|
"@arcblock/eslint-config-ts": "^0.2.4",
|
|
113
|
-
"@blocklet/payment-types": "1.13.
|
|
113
|
+
"@blocklet/payment-types": "1.13.126",
|
|
114
114
|
"@types/cookie-parser": "^1.4.6",
|
|
115
115
|
"@types/cors": "^2.8.17",
|
|
116
116
|
"@types/dotenv-flow": "^3.3.3",
|
|
@@ -149,5 +149,5 @@
|
|
|
149
149
|
"parser": "typescript"
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "efeb0d3762e61e2a6642330b86a41aa4f0847f36"
|
|
153
153
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import { api, formatError } from '@blocklet/payment-react';
|
|
3
|
+
import { ConfirmDialog, api, formatError } from '@blocklet/payment-react';
|
|
4
4
|
import type { TInvoiceExpanded } from '@blocklet/payment-types';
|
|
5
5
|
import { useSetState } from 'ahooks';
|
|
6
6
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -8,7 +8,6 @@ import type { LiteralUnion } from 'type-fest';
|
|
|
8
8
|
|
|
9
9
|
import Actions from '../actions';
|
|
10
10
|
import ClickBoundary from '../click-boundary';
|
|
11
|
-
import ConfirmDialog from '../confirm';
|
|
12
11
|
|
|
13
12
|
type Props = {
|
|
14
13
|
data: TInvoiceExpanded;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import { api, formatError } from '@blocklet/payment-react';
|
|
3
|
+
import { ConfirmDialog, api, formatError } from '@blocklet/payment-react';
|
|
4
4
|
import { useSetState } from 'ahooks';
|
|
5
5
|
|
|
6
6
|
import Actions from '../actions';
|
|
7
7
|
import ClickBoundary from '../click-boundary';
|
|
8
|
-
import ConfirmDialog from '../confirm';
|
|
9
8
|
|
|
10
9
|
type Props = {
|
|
11
10
|
data: any;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import { api } from '@blocklet/payment-react';
|
|
3
|
+
import { ConfirmDialog, api } from '@blocklet/payment-react';
|
|
4
4
|
import { Alert, Box, CircularProgress, MenuItem, Select, Typography } from '@mui/material';
|
|
5
5
|
import { useRequest } from 'ahooks';
|
|
6
6
|
import { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import ConfirmDialog from '../confirm';
|
|
9
|
-
|
|
10
8
|
const fetchData = (): Promise<any[]> => {
|
|
11
9
|
return api.get('/api/passports').then((res) => res.data);
|
|
12
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import { api, formatError } from '@blocklet/payment-react';
|
|
3
|
+
import { ConfirmDialog, api, formatError } from '@blocklet/payment-react';
|
|
4
4
|
import type { TPaymentIntentExpanded } from '@blocklet/payment-types';
|
|
5
5
|
import { useSetState } from 'ahooks';
|
|
6
6
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -8,7 +8,6 @@ import type { LiteralUnion } from 'type-fest';
|
|
|
8
8
|
|
|
9
9
|
import Actions from '../actions';
|
|
10
10
|
import ClickBoundary from '../click-boundary';
|
|
11
|
-
import ConfirmDialog from '../confirm';
|
|
12
11
|
|
|
13
12
|
type Props = {
|
|
14
13
|
data: TPaymentIntentExpanded;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import { api, formatError } from '@blocklet/payment-react';
|
|
3
|
+
import { ConfirmDialog, api, formatError } from '@blocklet/payment-react';
|
|
4
4
|
import type { TPaymentLinkExpanded } from '@blocklet/payment-types';
|
|
5
5
|
import { useSetState } from 'ahooks';
|
|
6
6
|
import Copy from 'copy-to-clipboard';
|
|
@@ -9,7 +9,6 @@ import { joinURL } from 'ufo';
|
|
|
9
9
|
|
|
10
10
|
import Actions from '../actions';
|
|
11
11
|
import ClickBoundary from '../click-boundary';
|
|
12
|
-
import ConfirmDialog from '../confirm';
|
|
13
12
|
import AssignPassportDialog from '../passport/assign';
|
|
14
13
|
import RenamePaymentLink from './rename';
|
|
15
14
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import { api, formatError } from '@blocklet/payment-react';
|
|
3
|
+
import { ConfirmDialog, api, formatError } from '@blocklet/payment-react';
|
|
4
4
|
import type { TPricingTableExpanded } from '@blocklet/payment-types';
|
|
5
5
|
import { useSetState } from 'ahooks';
|
|
6
6
|
import Copy from 'copy-to-clipboard';
|
|
@@ -9,7 +9,6 @@ import { joinURL } from 'ufo';
|
|
|
9
9
|
|
|
10
10
|
import Actions from '../actions';
|
|
11
11
|
import ClickBoundary from '../click-boundary';
|
|
12
|
-
import ConfirmDialog from '../confirm';
|
|
13
12
|
import AssignPassportDialog from '../passport/assign';
|
|
14
13
|
import RenamePricingTable from './rename';
|
|
15
14
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import { api, formatError } from '@blocklet/payment-react';
|
|
3
|
+
import { ConfirmDialog, api, formatError } from '@blocklet/payment-react';
|
|
4
4
|
import type { TProduct } from '@blocklet/payment-types';
|
|
5
5
|
import { useSetState } from 'ahooks';
|
|
6
6
|
import type { LiteralUnion } from 'type-fest';
|
|
7
7
|
|
|
8
8
|
import Actions from '../actions';
|
|
9
9
|
import ClickBoundary from '../click-boundary';
|
|
10
|
-
import ConfirmDialog from '../confirm';
|
|
11
10
|
import AssignPassportDialog from '../passport/assign';
|
|
12
11
|
import EditProduct from './edit';
|
|
13
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import { api, formatError } from '@blocklet/payment-react';
|
|
3
|
+
import { ConfirmDialog, api, formatError } from '@blocklet/payment-react';
|
|
4
4
|
import type { TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
5
5
|
import { useSetState } from 'ahooks';
|
|
6
6
|
import { FormProvider, useForm, useFormContext } from 'react-hook-form';
|
|
@@ -9,7 +9,6 @@ import type { LiteralUnion } from 'type-fest';
|
|
|
9
9
|
|
|
10
10
|
import Actions from '../../actions';
|
|
11
11
|
import ClickBoundary from '../../click-boundary';
|
|
12
|
-
import ConfirmDialog from '../../confirm';
|
|
13
12
|
import SubscriptionCancelForm from './cancel';
|
|
14
13
|
import SubscriptionPauseForm from './pause';
|
|
15
14
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import { api, formatToDatetime } from '@blocklet/payment-react';
|
|
2
|
+
import { ConfirmDialog, api, formatToDatetime } from '@blocklet/payment-react';
|
|
3
3
|
import type { TUsageRecord } from '@blocklet/payment-types';
|
|
4
4
|
import { Alert, Box, Button, CircularProgress } from '@mui/material';
|
|
5
5
|
import { useRequest } from 'ahooks';
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import ConfirmDialog from '../../confirm';
|
|
9
8
|
import Table from '../../table';
|
|
10
9
|
|
|
11
10
|
const fetchData = (subscriptionId: string, id: string): Promise<{ list: TUsageRecord[]; count: number }> => {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
3
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
4
|
-
import { api, formatError, formatToDate, getSubscriptionAction } from '@blocklet/payment-react';
|
|
4
|
+
import { ConfirmDialog, api, formatError, formatToDate, getSubscriptionAction } from '@blocklet/payment-react';
|
|
5
5
|
import type { TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
6
6
|
import { Button, Stack } from '@mui/material';
|
|
7
7
|
import { useRequest, useSetState } from 'ahooks';
|
|
8
8
|
import { FormProvider, useForm, useFormContext } from 'react-hook-form';
|
|
9
9
|
import { useNavigate } from 'react-router-dom';
|
|
10
10
|
|
|
11
|
-
import ConfirmDialog from '../../confirm';
|
|
12
11
|
import CustomerCancelForm from './cancel';
|
|
13
12
|
|
|
14
13
|
type Props = {
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Status,
|
|
5
|
+
api,
|
|
6
|
+
formatPrice,
|
|
7
|
+
getSubscriptionStatusColor,
|
|
8
|
+
getSubscriptionTimeSummary,
|
|
9
|
+
} from '@blocklet/payment-react';
|
|
4
10
|
import type { Paginated, TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
5
11
|
import { Avatar, AvatarGroup, Box, Button, CircularProgress, Stack, StackProps, Typography } from '@mui/material';
|
|
6
12
|
import { useInfiniteScroll } from 'ahooks';
|
|
7
13
|
|
|
8
|
-
import
|
|
9
|
-
import SubscriptionDescription from '../../subscription/description';
|
|
14
|
+
import SubscriptionDescription from '../description';
|
|
10
15
|
import SubscriptionActions from './actions';
|
|
11
16
|
|
|
12
17
|
const fetchData = (params: Record<string, any> = {}): Promise<Paginated<TSubscriptionExpanded>> => {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import { api, formatError } from '@blocklet/payment-react';
|
|
3
|
+
import { ConfirmDialog, api, formatError } from '@blocklet/payment-react';
|
|
4
4
|
import type { TPrice } from '@blocklet/payment-types';
|
|
5
5
|
import { useSetState } from 'ahooks';
|
|
6
6
|
import noop from 'lodash/noop';
|
|
7
7
|
import { useNavigate } from 'react-router-dom';
|
|
8
8
|
|
|
9
9
|
import Actions from '../../../../components/actions';
|
|
10
|
-
import ConfirmDialog from '../../../../components/confirm';
|
|
11
10
|
import EditPrice from '../../../../components/product/edit-price';
|
|
12
11
|
|
|
13
12
|
type Props = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import { formatError } from '@blocklet/payment-react';
|
|
3
|
+
import { CustomerInvoiceList, CustomerPaymentList, formatError } from '@blocklet/payment-react';
|
|
4
4
|
import type { TCustomerExpanded } from '@blocklet/payment-types';
|
|
5
5
|
import { Edit } from '@mui/icons-material';
|
|
6
6
|
import { Alert, Box, Button, CircularProgress, Grid, Stack } from '@mui/material';
|
|
@@ -11,9 +11,8 @@ import { useNavigate } from 'react-router-dom';
|
|
|
11
11
|
|
|
12
12
|
import EditCustomer from '../../components/customer/edit';
|
|
13
13
|
import InfoRow from '../../components/info-row';
|
|
14
|
-
import CustomerInvoiceList from '../../components/portal/invoice/list';
|
|
15
|
-
import CurrentSubscriptions from '../../components/portal/subscription/list';
|
|
16
14
|
import SectionHeader from '../../components/section/header';
|
|
15
|
+
import CurrentSubscriptions from '../../components/subscription/portal/list';
|
|
17
16
|
import { useSessionContext } from '../../contexts/session';
|
|
18
17
|
import api from '../../libs/api';
|
|
19
18
|
|
|
@@ -88,6 +87,12 @@ export default function CustomerHome() {
|
|
|
88
87
|
<CustomerInvoiceList customer_id={data.id} />
|
|
89
88
|
</Box>
|
|
90
89
|
</Box>
|
|
90
|
+
<Box className="section">
|
|
91
|
+
<SectionHeader title={t('payment.customer.payments')} mb={0} />
|
|
92
|
+
<Box className="section-body">
|
|
93
|
+
<CustomerPaymentList customer_id={data.id} />
|
|
94
|
+
</Box>
|
|
95
|
+
</Box>
|
|
91
96
|
</Root>
|
|
92
97
|
</Grid>
|
|
93
98
|
<Grid item xs={12} md={4}>
|
|
@@ -12,11 +12,11 @@ import TxLink from '../../../components/blockchain/tx';
|
|
|
12
12
|
import Currency from '../../../components/currency';
|
|
13
13
|
import InfoRow from '../../../components/info-row';
|
|
14
14
|
import InvoiceList from '../../../components/invoice/list';
|
|
15
|
-
import SubscriptionActions from '../../../components/portal/subscription/actions';
|
|
16
15
|
import SectionHeader from '../../../components/section/header';
|
|
17
16
|
import SubscriptionDescription from '../../../components/subscription/description';
|
|
18
17
|
import SubscriptionItemList from '../../../components/subscription/items';
|
|
19
18
|
import SubscriptionMetrics from '../../../components/subscription/metrics';
|
|
19
|
+
import SubscriptionActions from '../../../components/subscription/portal/actions';
|
|
20
20
|
import SubscriptionStatus from '../../../components/subscription/status';
|
|
21
21
|
|
|
22
22
|
const fetchData = (id: string | undefined): Promise<TSubscriptionExpanded> => {
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Confirm } from '@arcblock/ux/lib/Dialog';
|
|
2
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import { Typography } from '@mui/material';
|
|
4
|
-
import type { EventHandler } from 'react';
|
|
5
|
-
|
|
6
|
-
export default function ConfirmDialog({
|
|
7
|
-
onConfirm,
|
|
8
|
-
onCancel,
|
|
9
|
-
title,
|
|
10
|
-
message,
|
|
11
|
-
loading,
|
|
12
|
-
}: {
|
|
13
|
-
onConfirm: EventHandler<any>;
|
|
14
|
-
onCancel: EventHandler<any>;
|
|
15
|
-
title: string | React.ReactNode;
|
|
16
|
-
message: string | React.ReactNode;
|
|
17
|
-
loading?: boolean;
|
|
18
|
-
}) {
|
|
19
|
-
const { t } = useLocaleContext();
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Confirm
|
|
23
|
-
open
|
|
24
|
-
title={title}
|
|
25
|
-
onConfirm={onConfirm}
|
|
26
|
-
onCancel={onCancel}
|
|
27
|
-
confirmButton={{
|
|
28
|
-
text: t('common.confirm'),
|
|
29
|
-
props: { color: 'error', size: 'small', variant: 'contained', disabled: !!loading },
|
|
30
|
-
}}
|
|
31
|
-
cancelButton={{ text: t('common.cancel'), props: { color: 'inherit', size: 'small' } }}>
|
|
32
|
-
<Typography>{message}</Typography>
|
|
33
|
-
</Confirm>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ConfirmDialog.defaultProps = {
|
|
38
|
-
loading: false,
|
|
39
|
-
};
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/no-unstable-nested-components */
|
|
2
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import { Status, api, formatToDate } from '@blocklet/payment-react';
|
|
4
|
-
import type { Paginated, TInvoiceExpanded } from '@blocklet/payment-types';
|
|
5
|
-
import { Box, Button, CircularProgress, Stack, Typography } from '@mui/material';
|
|
6
|
-
import { fromUnitToToken } from '@ocap/util';
|
|
7
|
-
import { useInfiniteScroll } from 'ahooks';
|
|
8
|
-
import { Link } from 'react-router-dom';
|
|
9
|
-
|
|
10
|
-
import { getInvoiceStatusColor } from '../../../libs/util';
|
|
11
|
-
|
|
12
|
-
const groupByDate = (items: TInvoiceExpanded[]) => {
|
|
13
|
-
const grouped: { [key: string]: TInvoiceExpanded[] } = {};
|
|
14
|
-
items.forEach((item) => {
|
|
15
|
-
const date = new Date(item.created_at).toLocaleDateString();
|
|
16
|
-
if (!grouped[date]) {
|
|
17
|
-
grouped[date] = [];
|
|
18
|
-
}
|
|
19
|
-
grouped[date]?.push(item);
|
|
20
|
-
});
|
|
21
|
-
return grouped;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const fetchData = (params: Record<string, any> = {}): Promise<Paginated<TInvoiceExpanded>> => {
|
|
25
|
-
const search = new URLSearchParams();
|
|
26
|
-
Object.keys(params).forEach((key) => {
|
|
27
|
-
search.set(key, String(params[key]));
|
|
28
|
-
});
|
|
29
|
-
return api.get(`/api/invoices?${search.toString()}`).then((res) => res.data);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
type Props = {
|
|
33
|
-
customer_id: string;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const pageSize = 10;
|
|
37
|
-
|
|
38
|
-
export default function CustomerInvoiceList({ customer_id }: Props) {
|
|
39
|
-
const { t } = useLocaleContext();
|
|
40
|
-
|
|
41
|
-
const { data, loadMore, loadingMore, loading } = useInfiniteScroll<Paginated<TInvoiceExpanded>>(
|
|
42
|
-
(d) => {
|
|
43
|
-
const page = d ? Math.ceil(d.list.length / pageSize) + 1 : 1;
|
|
44
|
-
return fetchData({ page, pageSize, status: 'open,paid,uncollectible', customer_id });
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
reloadDeps: [customer_id],
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
if (loading || !data) {
|
|
52
|
-
return <CircularProgress />;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (data && data.list.length === 0) {
|
|
56
|
-
return (
|
|
57
|
-
<Typography color="text.secondary">
|
|
58
|
-
{customer_id ? t('payment.customer.invoice.empty') : t('admin.invoice.empty')}
|
|
59
|
-
</Typography>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const hasMore = data && data.list.length < data.count;
|
|
64
|
-
|
|
65
|
-
const grouped = groupByDate(data.list);
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<Stack direction="column" gap={1} sx={{ mt: 1 }}>
|
|
69
|
-
{Object.entries(grouped).map(([date, invoices]) => (
|
|
70
|
-
<Box key={date}>
|
|
71
|
-
<Typography sx={{ fontWeight: 'bold', color: 'text.secondary', mt: 2, mb: 1 }}>{date}</Typography>
|
|
72
|
-
{invoices.map((invoice) => (
|
|
73
|
-
<Stack
|
|
74
|
-
key={invoice.id}
|
|
75
|
-
direction={{
|
|
76
|
-
xs: 'column',
|
|
77
|
-
sm: 'row',
|
|
78
|
-
}}
|
|
79
|
-
sx={{ my: 1 }}
|
|
80
|
-
gap={{
|
|
81
|
-
xs: 0.5,
|
|
82
|
-
sm: 1.5,
|
|
83
|
-
md: 3,
|
|
84
|
-
}}
|
|
85
|
-
flexWrap="nowrap">
|
|
86
|
-
<Box flex={3}>
|
|
87
|
-
<Link to={`/customer/invoice/${invoice.id}`}>
|
|
88
|
-
<Typography component="span">{invoice.number}</Typography>
|
|
89
|
-
</Link>
|
|
90
|
-
</Box>
|
|
91
|
-
<Box flex={3}>
|
|
92
|
-
<Typography>{formatToDate(invoice.created_at)}</Typography>
|
|
93
|
-
</Box>
|
|
94
|
-
<Box flex={2}>
|
|
95
|
-
<Typography textAlign="right">
|
|
96
|
-
{fromUnitToToken(invoice.total, invoice.paymentCurrency.decimal)}
|
|
97
|
-
{invoice.paymentCurrency.symbol}
|
|
98
|
-
</Typography>
|
|
99
|
-
</Box>
|
|
100
|
-
<Box flex={2}>
|
|
101
|
-
<Status label={invoice.status} color={getInvoiceStatusColor(invoice.status)} />
|
|
102
|
-
</Box>
|
|
103
|
-
<Box flex={4}>
|
|
104
|
-
<Typography>{invoice.description || invoice.id}</Typography>
|
|
105
|
-
</Box>
|
|
106
|
-
</Stack>
|
|
107
|
-
))}
|
|
108
|
-
</Box>
|
|
109
|
-
))}
|
|
110
|
-
<Box>
|
|
111
|
-
{hasMore && (
|
|
112
|
-
<Button variant="text" type="button" color="inherit" onClick={loadMore} disabled={loadingMore}>
|
|
113
|
-
{loadingMore
|
|
114
|
-
? t('common.loadingMore', { resource: t('admin.invoices') })
|
|
115
|
-
: t('common.loadMore', { resource: t('admin.invoices') })}
|
|
116
|
-
</Button>
|
|
117
|
-
)}
|
|
118
|
-
{!hasMore && data.count > pageSize && (
|
|
119
|
-
<Typography color="text.secondary">{t('common.noMore', { resource: t('admin.invoices') })}</Typography>
|
|
120
|
-
)}
|
|
121
|
-
</Box>
|
|
122
|
-
</Stack>
|
|
123
|
-
);
|
|
124
|
-
}
|
|
File without changes
|