-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathTicketList.tsx
69 lines (65 loc) · 1.99 KB
/
TicketList.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
import {
Datagrid,
List,
ReferenceField,
ReferenceInput,
useStore,
} from "react-admin";
import { CustomerAvatar } from "../customers/CustomerAvatar";
import { TicketListAside } from "./TicketListAside";
import { StatusField } from "./StatusField";
import { WithLocks } from "@react-admin/ra-realtime";
import { DateField } from "./DateField";
import { SubjectField } from "./SubjectField";
import { FromField } from "./FromField";
import { ActivityField } from "./ActivityField";
import { TicketReadsWatcher } from "./TicketReadsWatcher";
export const ticketStatusFilters = {
All: {},
Open: { status: "open" },
Pending: { status: "pending" },
Closed: { status: "closed" },
} as { [key: string]: any };
const filters = [
<ReferenceInput source="customer_id" reference="customers" alwaysOn />,
<ReferenceInput source="product_id" reference="products" alwaysOn />,
];
export const TicketList = () => {
const [statusFilter] = useStore(
"resources.tickets.list.statusFilter",
ticketStatusFilters.All
);
return (
<TicketReadsWatcher>
<WithLocks>
<List
sort={{ field: "updated_at", order: "DESC" }}
perPage={25}
filter={statusFilter}
filters={filters}
aside={<TicketListAside />}
>
<Datagrid
rowClick="show"
sx={{
"& .column-lock": {
padding: "6px 0",
"& svg": { verticalAlign: "middle" },
},
}}
>
<ActivityField />
<ReferenceField source="customer_id" reference="customers" label="">
<CustomerAvatar size="small" />
</ReferenceField>
<ReferenceField source="customer_id" reference="customers" />
<DateField source="updated_at" label="Date" textAlign="right" />
<SubjectField />
<FromField />
<StatusField />
</Datagrid>
</List>
</WithLocks>
</TicketReadsWatcher>
);
};