You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.2 KiB
React
94 lines
2.2 KiB
React
3 years ago
|
import { useParams } from "react-router-dom";
|
||
|
import { useEffect } from 'react';
|
||
3 years ago
|
import { observer } from "mobx-react";
|
||
3 years ago
|
import { toJS } from "mobx";
|
||
|
import moment from "moment";
|
||
|
import { Row, Col, Space, Button, Table, Tag, Typography, DatePicker } from 'antd';
|
||
3 years ago
|
import { useStore } from '../../stores/StoreContext.js';
|
||
3 years ago
|
|
||
3 years ago
|
const { Title } = Typography;
|
||
|
|
||
3 years ago
|
const reservationListColumns = [
|
||
3 years ago
|
{
|
||
|
title: 'Name',
|
||
|
dataIndex: 'name',
|
||
|
key: 'name',
|
||
|
render: (text) => <a>{text}</a>,
|
||
|
},
|
||
|
{
|
||
|
title: 'Age',
|
||
|
dataIndex: 'age',
|
||
|
key: 'age',
|
||
|
},
|
||
|
{
|
||
|
title: 'Address',
|
||
|
dataIndex: 'address',
|
||
|
key: 'address',
|
||
|
},
|
||
|
{
|
||
|
title: 'Tags',
|
||
|
key: 'tags',
|
||
|
dataIndex: 'tags',
|
||
|
render: (_, { tags }) => (
|
||
|
<>
|
||
|
{tags.map((tag) => {
|
||
|
let color = tag.length > 5 ? 'geekblue' : 'green';
|
||
|
if (tag === 'loser') {
|
||
|
color = 'volcano';
|
||
|
}
|
||
|
return (
|
||
|
<Tag color={color} key={tag}>
|
||
|
{tag.toUpperCase()}
|
||
|
</Tag>
|
||
|
);
|
||
|
})}
|
||
|
</>
|
||
|
),
|
||
|
},
|
||
|
{
|
||
|
title: 'Action',
|
||
|
key: 'action',
|
||
|
render: (_, record) => (
|
||
|
<Space size="middle">
|
||
|
<a>Invite {record.name}</a>
|
||
|
<a>Delete</a>
|
||
|
</Space>
|
||
|
),
|
||
|
},
|
||
|
];
|
||
|
|
||
3 years ago
|
function Newest() {
|
||
3 years ago
|
|
||
3 years ago
|
const { reservationStore } = useStore();
|
||
|
const { reservationList } = reservationStore;
|
||
3 years ago
|
|
||
|
useEffect(() => {
|
||
3 years ago
|
console.info('Newest.useEffect');
|
||
|
}, []);
|
||
3 years ago
|
|
||
|
return (
|
||
|
<Space direction="vertical" style={{ width: '100%' }}>
|
||
3 years ago
|
<Title level={3}>Newest Plans</Title>
|
||
|
<Row gutter={{ md: 24 }} justify="end">
|
||
|
<Col span={6}>
|
||
|
<Space direction="horizontal" style={{ width: '100%' }}>
|
||
|
Group Date:
|
||
|
<DatePicker.RangePicker
|
||
|
allowClear={false}
|
||
|
/>
|
||
|
</Space>
|
||
|
</Col>
|
||
|
<Col span={12}>
|
||
|
<Button type='primary' onClick={() => plan.fetchRecent()}>Search</Button>
|
||
|
</Col>
|
||
|
</Row>
|
||
|
<Row>
|
||
|
<Col span={24}>
|
||
3 years ago
|
<Table columns={reservationListColumns} dataSource={toJS(reservationList)} />
|
||
3 years ago
|
</Col>
|
||
|
</Row>
|
||
3 years ago
|
</Space>
|
||
|
);
|
||
|
}
|
||
|
|
||
3 years ago
|
export default observer(Newest);
|