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.
Global-sales/src/views/ChatHistory.jsx

231 lines
7.4 KiB
React

import { useNavigate } from 'react-router-dom';
import { memo, useCallback, useEffect, useRef, useState } from 'react';
import { Row, Col, Divider, Table, Card, Button, Input, Flex, Layout, Space, Empty, Radio, Select, DatePicker, Form, List, Avatar } from 'antd';
import { StarFilled, ZoomInOutlined, StarOutlined, SearchOutlined } from '@ant-design/icons';
import { ChatList, ChatItem, MessageBox } from 'react-chat-elements';
const { Sider, Content, Header, Footer } = Layout;
const { Search } = Input;
const { RangePicker } = DatePicker;
const data = [
{
2 years ago
title: 'Ann',
avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=0',
msgTime: '03-04 13:45:29',
content:
'Hi, this is Ann from China Highlights travel and it is my pleasure to help your Beijing trip. I have sent you an email with the general idea about you trip. Please check it and if any question or new idea just let me know. We are specailized in customizing tour and I would like to work with you to create a tour itinerary that you like. Look forward to your reply.',
},
{
2 years ago
title: 'David Azhari',
avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=2',
msgTime: '03-04 16:33:08',
content: 'Hi! I just replied to your email saying that I have a few questions and notes',
},
{
2 years ago
title: 'David Azhari',
avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=2',
msgTime: '03-04 16:33:34',
content: 'So first, is it possible for you guys to write a PU Invitation letter for visas or no?',
},
{
2 years ago
title: 'Ann',
avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=0',
msgTime: '03-04 16:33:41',
content: 'you prefer we discuss here or go on by mail ?',
2 years ago
},
{
title: 'David Azhari',
avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=2',
msgTime: '03-04 16:34:03',
content: 'I prefer by mail if its ok with you',
2 years ago
},
{
title: 'Ann',
avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=0',
msgTime: '03-04 16:34:28',
content: 'both is okay ,I am typing mail to you now lol and receive your message here.',
2 years ago
},
{
title: 'David Azhari',
avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=2',
msgTime: '03-05 02:56:37',
content: 'Ok thank you so much',
2 years ago
},
{
title: 'Ann',
avatarUrl: 'https://api.dicebear.com/7.x/miniavs/svg?seed=0',
msgTime: '03-04 16:44:03',
content: 'you are welcome I have sent the mail to you ,please check.it is my pleasure to assist you with your tour.',
},
];
// eslint-disable-next-line react/display-name
const SearchForm = memo(function ({ onSubmit }) {
const [form] = Form.useForm();
function handleSubmit(values) {
onSubmit?.(values);
}
return (
<Form
layout={'inline'}
form={form}
initialValues={{}}
onFinish={handleSubmit}
style={{
maxWidth: 'none',
}}>
<Form.Item label='顾问' name='travel' style={{ width: '200px' }}>
<Select
showSearch
placeholder='请选择'
optionFilterProp='children'
filterOption={(input, option) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase())}
options={[
{
value: '杨新玲',
label: '杨新玲',
},
{
value: '黄雪荣',
label: '黄雪荣',
},
{
value: '骆梅玉',
label: '骆梅玉',
},
{
value: '秦宇尘',
label: '秦宇尘',
},
{
value: '莫梦瑶',
label: '莫梦瑶',
},
{
value: '秦雯萱',
label: '秦雯萱',
},
{
value: '王露加',
label: '王露加',
},
]}
/>
</Form.Item>
<Form.Item label='客人' name='orderLabel' style={{ width: '200px' }}>
<Select
showSearch
placeholder='请选择'
optionFilterProp='children'
filterOption={(input, option) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase())}
options={[
{
value: 'Denise',
label: 'Denise',
},
{
value: 'Kennedy',
label: 'Kennedy',
},
{
value: 'Harsh',
label: 'Harsh',
},
{
value: 'SMLiew',
label: 'SMLiew',
},
{
value: 'See Kok Ching',
label: 'See Kok Ching',
},
{
value: 'Jonathan Michael Lilley',
label: 'Jonathan Michael Lilley',
},
{
value: 'Loan',
label: 'Loan',
},
{
value: 'Leah Belle',
label: 'Leah Belle',
},
{
value: 'Christelle Narvasa',
label: 'Christelle Narvasa',
},
{
value: 'Mai Schaefer',
label: 'Mai Schaefer',
},
]}
/>
</Form.Item>
<Form.Item label='关键词' name='orderNumber'>
<Input placeholder='关键词' allowClear />
</Form.Item>
<Form.Item label='日期' name='startDate'>
<RangePicker />
</Form.Item>
<Form.Item>
<Button type='primary' htmlType='submit'>
搜索
</Button>
</Form.Item>
</Form>
);
});
function ChatHistory() {
const [formValues, setFormValues] = useState({});
const handleSubmit = useCallback((values) => {
setFormValues({ ...values });
}, []);
return (
<>
<SearchForm onSubmit={handleSubmit} />
<Divider plain orientation='left'></Divider>
<Layout hasSider className='h-screen chathistory-wrapper' style={{ maxHeight: 'calc(100% - 279px)', height: 'calc(100% - 279px)' }}>
<Sider width={240} theme={'light'} className='h-full overflow-y-auto' style={{ maxHeight: 'calc(100vh - 279px)', height: 'calc(100vh - 279px)' }}>
<ChatList
className={'__active text-primary '}
dataSource={[
{
alt: 'Jane',
title: 'Jane',
date: new Date(),
letterItem: { id: 'x1', letter: 'Jane' },
},
]}
/>
</Sider>
<Content style={{ maxHeight: 'calc(100vh - 279px)', height: 'calc(100vh - 279px)', minWidth: '360px' }}>
<div className='h-full relative'>
<List
loading={false}
loadMore={() => {
console.log('load more');
}}
className='h-full overflow-y-auto px-2'
itemLayout='vertical'
dataSource={data}
renderItem={(item, index) => (
<List.Item>
<List.Item.Meta avatar={<Avatar src={item.avatarUrl} />} title={item.title} description={item.msgTime} />
<div>{item.content}</div>
</List.Item>
)}
/>
</div>
</Content>
</Layout>
</>
);
}
export default ChatHistory;