-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
/
Copy pathInvoiceList.tsx
85 lines (80 loc) · 2.49 KB
/
InvoiceList.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import * as React from 'react';
import {
List,
DatagridConfigurable,
TextField,
DateField,
ReferenceField,
NumberField,
DateInput,
TopToolbar,
ExportButton,
SelectColumnsButton,
ReferenceInput,
FilterButton,
} from 'react-admin';
import FullNameField from '../visitors/FullNameField';
import AddressField from '../visitors/AddressField';
import InvoiceShow from './InvoiceShow';
const listFilters = [
<DateInput source="date_gte" alwaysOn />,
<DateInput source="date_lte" alwaysOn />,
<ReferenceInput source="customer_id" reference="customers" />,
<ReferenceInput source="order_id" reference="orders" />,
];
const ListActions = () => (
<TopToolbar>
<FilterButton />
<SelectColumnsButton />
<ExportButton />
</TopToolbar>
);
const InvoiceList = () => (
<List
filters={listFilters}
perPage={25}
sort={{ field: 'date', order: 'DESC' }}
actions={<ListActions />}
>
<DatagridConfigurable
rowClick="expand"
expand={<InvoiceShow />}
sx={{
'& .column-customer_id': {
display: { xs: 'none', md: 'table-cell' },
},
'& .column-total_ex_taxes': {
display: { xs: 'none', md: 'table-cell' },
},
'& .column-delivery_fees': {
display: { xs: 'none', md: 'table-cell' },
},
'& .column-taxes': {
display: { xs: 'none', md: 'table-cell' },
},
}}
>
<TextField source="id" />
<DateField source="date" />
<ReferenceField source="customer_id" reference="customers">
<FullNameField source="last_name" />
</ReferenceField>
<ReferenceField
source="customer_id"
reference="customers"
link={false}
label="resources.invoices.fields.address"
>
<AddressField />
</ReferenceField>
<ReferenceField source="order_id" reference="orders">
<TextField source="reference" />
</ReferenceField>
<NumberField source="total_ex_taxes" />
<NumberField source="delivery_fees" />
<NumberField source="taxes" />
<NumberField source="total" />
</DatagridConfigurable>
</List>
);
export default InvoiceList;