2024-02-16 11:09:15 +00:00
|
|
|
import { t } from '@lingui/macro';
|
2024-02-20 08:01:06 +00:00
|
|
|
import { Button, Input, Table, Tag, DatePicker, Form, Modal, Select, Space, Checkbox } from 'antd';
|
2024-02-16 11:09:15 +00:00
|
|
|
import { useState } from 'react';
|
|
|
|
import { Layout } from 'antd';
|
2024-02-20 08:01:06 +00:00
|
|
|
import {
|
|
|
|
EditOutlined, DownloadOutlined, CheckCircleOutlined,
|
|
|
|
ClockCircleOutlined,
|
|
|
|
ArrowLeftOutlined,
|
|
|
|
ArrowRightOutlined,
|
|
|
|
FullscreenOutlined,
|
|
|
|
FullscreenExitOutlined,
|
|
|
|
} from '@ant-design/icons';
|
2024-02-16 11:09:15 +00:00
|
|
|
import FileViewer from '@cyntler/react-doc-viewer';
|
2024-02-20 08:01:06 +00:00
|
|
|
import styled from 'styled-components';
|
2024-02-16 11:09:15 +00:00
|
|
|
const { Sider, Content } = Layout;
|
2024-01-31 04:08:20 +00:00
|
|
|
|
2024-02-16 11:09:15 +00:00
|
|
|
const siderStyle: React.CSSProperties = {
|
|
|
|
backgroundColor: '#fafafa',
|
|
|
|
padding: 10,
|
|
|
|
width: 200,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-02-20 08:01:06 +00:00
|
|
|
const StyledTable = styled(Table)`
|
|
|
|
& .sbt-table-cell {
|
|
|
|
padding: 4px!important;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
const StyledEditOutlined = styled(EditOutlined)`
|
|
|
|
& {
|
|
|
|
color: #6666ff;
|
|
|
|
margin-left: 8px;
|
|
|
|
}
|
|
|
|
&:hover {
|
|
|
|
color: #0000ff;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
2024-02-16 11:09:15 +00:00
|
|
|
const fileList = [
|
|
|
|
{
|
|
|
|
name: "invoice.pdf",
|
|
|
|
url: "/dummpy.pdf",
|
|
|
|
type: "invoice",
|
|
|
|
isBadQuality: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "invoice.pdf",
|
|
|
|
url: "/dummpy.pdf",
|
|
|
|
type: "imei",
|
|
|
|
isBadQuality: true,
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
const dataSource = [
|
|
|
|
{
|
2024-02-20 08:01:06 +00:00
|
|
|
key: 'retailer_name',
|
2024-02-16 11:09:15 +00:00
|
|
|
value: 'Mike',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '2',
|
|
|
|
value: 'Mike',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
value: 'Mike',
|
|
|
|
},
|
2024-02-20 08:01:06 +00:00
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
value: 'Mike',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
value: 'Mike',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
value: 'Mike',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
value: 'Mike',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
value: 'Mike',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
value: 'Mike',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
value: 'Mike',
|
|
|
|
},
|
2024-02-16 11:09:15 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
{
|
|
|
|
title: 'Key',
|
|
|
|
dataIndex: 'key',
|
|
|
|
key: 'key',
|
|
|
|
},
|
2024-02-20 08:01:06 +00:00
|
|
|
{
|
|
|
|
title: 'Accuracy',
|
|
|
|
dataIndex: 'acc',
|
|
|
|
key: 'acc',
|
|
|
|
render: (text, record) => {
|
|
|
|
return <div>100%</div>;
|
|
|
|
},
|
|
|
|
},
|
2024-02-16 11:09:15 +00:00
|
|
|
{
|
|
|
|
title: 'Predicted',
|
|
|
|
dataIndex: 'value',
|
|
|
|
key: 'value',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Submitted',
|
|
|
|
dataIndex: 'value',
|
|
|
|
key: 'value',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Revised',
|
|
|
|
dataIndex: 'value',
|
|
|
|
key: 'value',
|
2024-02-20 08:01:06 +00:00
|
|
|
render: (text, record) => {
|
|
|
|
return (
|
|
|
|
<div style={{
|
|
|
|
display: 'flex',
|
|
|
|
lineHeight: '2',
|
|
|
|
}}>
|
|
|
|
{text}
|
|
|
|
<StyledEditOutlined />
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
|
2024-02-16 11:09:15 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
const FileCard = ({ file, isSelected, onClick }) => {
|
|
|
|
return (
|
|
|
|
<div style={{
|
|
|
|
border: '1px solid #ccc',
|
|
|
|
width: '200px',
|
2024-02-19 04:02:21 +00:00
|
|
|
backgroundColor: isSelected ? '#d4ecff' : '#fff',
|
2024-02-16 11:09:15 +00:00
|
|
|
padding: '4px 8px',
|
|
|
|
marginRight: '4px',
|
2024-02-20 08:01:06 +00:00
|
|
|
marginTop: '2px',
|
|
|
|
position: 'relative',
|
|
|
|
height: '100px',
|
2024-02-16 11:09:15 +00:00
|
|
|
}} onClick={onClick}>
|
|
|
|
<div>
|
|
|
|
<span style={{
|
|
|
|
fontSize: '12px',
|
|
|
|
color: '#333',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
padding: '4px 8px',
|
2024-02-20 08:01:06 +00:00
|
|
|
cursor: 'default',
|
2024-02-16 11:09:15 +00:00
|
|
|
}}>{file.type.toUpperCase()}</span>
|
|
|
|
<span style={{
|
|
|
|
fontSize: '12px',
|
|
|
|
color: '#aaa',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
padding: '4px 8px',
|
2024-02-20 08:01:06 +00:00
|
|
|
cursor: 'default',
|
2024-02-16 11:09:15 +00:00
|
|
|
}}>{file.name}</span>
|
|
|
|
</div>
|
2024-02-20 08:01:06 +00:00
|
|
|
<div style={{
|
|
|
|
padding: '4px',
|
|
|
|
position: 'absolute',
|
|
|
|
bottom: 2,
|
|
|
|
right: 2,
|
|
|
|
}}>
|
|
|
|
<Button style={{
|
|
|
|
margin: '4px 2px',
|
|
|
|
}}>
|
|
|
|
Review
|
|
|
|
</Button>
|
|
|
|
<Button style={{
|
|
|
|
margin: '4px 2px',
|
|
|
|
}}>
|
|
|
|
<DownloadOutlined />
|
|
|
|
</Button>
|
|
|
|
</div>
|
2024-02-16 11:09:15 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2024-02-20 08:01:06 +00:00
|
|
|
const ReviewPage = () => {
|
|
|
|
const [fullscreen, setFullscreen] = useState(false);
|
|
|
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
2024-02-16 11:09:15 +00:00
|
|
|
const [selectedFileId, setSelectedFileId] = useState(0);
|
|
|
|
const selectFileByIndex = (index) => {
|
|
|
|
setSelectedFileId(index);
|
|
|
|
};
|
2024-02-20 08:01:06 +00:00
|
|
|
const [filterDateRange, setFilterDateRange] = useState(null);
|
|
|
|
const [filterSubsidiaries, setFilterSubsidiaries] = useState('');
|
|
|
|
const [filterReviewState, setFilterReviewState] = useState('');
|
2024-02-16 11:09:15 +00:00
|
|
|
|
|
|
|
return (
|
2024-02-20 08:01:06 +00:00
|
|
|
<div style={fullscreen ? {
|
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
backgroundColor: '#fff',
|
|
|
|
zIndex: 1000,
|
|
|
|
} : {
|
|
|
|
height: '100%',
|
|
|
|
}}>
|
|
|
|
<Button onClick={() => {
|
|
|
|
setFullscreen(!fullscreen);
|
|
|
|
}}>
|
|
|
|
{fullscreen ? <FullscreenExitOutlined /> : <FullscreenOutlined />}
|
|
|
|
{fullscreen ? 'Exit Fullscreen' : 'Enter Fullscreen'}
|
|
|
|
</Button>
|
2024-02-16 11:09:15 +00:00
|
|
|
<Layout style={{
|
2024-02-20 08:01:06 +00:00
|
|
|
overflow: 'auto',
|
2024-02-16 11:09:15 +00:00
|
|
|
width: '100%',
|
2024-02-20 08:01:06 +00:00
|
|
|
height: '100%',
|
2024-02-16 11:09:15 +00:00
|
|
|
maxWidth: '100%',
|
2024-02-20 08:01:06 +00:00
|
|
|
minHeight: '60%',
|
|
|
|
maxHeight: '60%',
|
2024-02-16 11:09:15 +00:00
|
|
|
display: 'flex',
|
|
|
|
padding: '8px',
|
|
|
|
}}>
|
2024-02-20 08:01:06 +00:00
|
|
|
<Content style={{
|
|
|
|
textAlign: 'center',
|
|
|
|
color: '#fff',
|
|
|
|
backgroundColor: '#efefef',
|
|
|
|
height: '100%',
|
|
|
|
display: 'flex',
|
|
|
|
flexDirection: 'row',
|
|
|
|
}}>
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
width: "200px",
|
|
|
|
display: "flex",
|
|
|
|
flexDirection: "column",
|
|
|
|
flexGrow: 0,
|
|
|
|
}}>
|
|
|
|
<h2
|
|
|
|
style={{
|
|
|
|
color: "#333",
|
|
|
|
padding: 10,
|
|
|
|
fontWeight: 'bold'
|
|
|
|
}}
|
|
|
|
>Files ({fileList.length})</h2>
|
|
|
|
{fileList.map((file, index) => (
|
|
|
|
<FileCard key={index} file={file} isSelected={index === selectedFileId} onClick={
|
|
|
|
() => {
|
|
|
|
setSelectedFileId(index);
|
|
|
|
}
|
|
|
|
} />
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
<div style={{
|
|
|
|
border: "1px solid #ccc",
|
2024-02-19 04:02:21 +00:00
|
|
|
flexGrow: 1,
|
2024-02-20 08:01:06 +00:00
|
|
|
height: '100%',
|
2024-02-19 04:02:21 +00:00
|
|
|
}}>
|
2024-02-20 08:01:06 +00:00
|
|
|
<FileViewer documents={
|
|
|
|
[
|
|
|
|
{ uri: "/dummy.pdf" }
|
|
|
|
]
|
|
|
|
} config={{
|
|
|
|
header: {
|
|
|
|
disableHeader: true,
|
|
|
|
disableFileName: true,
|
|
|
|
retainURLParams: true,
|
|
|
|
},
|
|
|
|
csvDelimiter: ",", // "," as default,
|
|
|
|
pdfVerticalScrollByDefault: true, // false as default
|
|
|
|
}} />
|
|
|
|
</div>
|
|
|
|
</Content>
|
|
|
|
<Sider width="300px" style={siderStyle}>
|
|
|
|
<Space.Compact style={{ width: '100%', marginBottom: 16 }}>
|
|
|
|
<Input defaultValue="All" readOnly />
|
|
|
|
<Button type="primary" size="large"
|
|
|
|
onClick={() => {
|
|
|
|
setIsModalOpen(true);
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
Filters
|
|
|
|
</Button>
|
|
|
|
</Space.Compact>
|
|
|
|
<div style={{ display: "flex", justifyContent: "space-between", marginBottom: 8 }}>
|
|
|
|
<div>
|
|
|
|
<Button type="default">
|
|
|
|
<ArrowLeftOutlined />
|
|
|
|
Previous
|
|
|
|
</Button>
|
|
|
|
<Button type="default">
|
|
|
|
Next
|
|
|
|
<ArrowRightOutlined />
|
|
|
|
</Button>
|
|
|
|
<Button type="default">
|
|
|
|
Go to
|
|
|
|
</Button>
|
2024-02-16 11:09:15 +00:00
|
|
|
</div>
|
2024-02-20 08:01:06 +00:00
|
|
|
</div>
|
|
|
|
<h2 style={{ margin: "20px 0 10px 0" }}>Request Review</h2>
|
|
|
|
<Input size='small' addonBefore="Request ID" style={{ marginBottom: "4px" }} readOnly />
|
|
|
|
<Input size='small' addonBefore="Redemption" style={{ marginBottom: "4px" }} readOnly />
|
|
|
|
<Input size='small' addonBefore="Uploaded date" style={{ marginBottom: "4px" }} readOnly />
|
|
|
|
<Input size='small' addonBefore="Request time" style={{ marginBottom: "4px" }} readOnly />
|
|
|
|
<Input size='small' addonBefore="Processing time" style={{ marginBottom: "4px" }} readOnly />
|
|
|
|
<div style={{ marginBottom: "8px", marginTop: "8px", display: "flex" }}>
|
|
|
|
<Button type="primary">Mark Not-reviewed</Button>
|
|
|
|
{/* <Tag icon={<ClockCircleOutlined />} color="warning" style={{ padding: "4px 16px", marginLeft: 8 }}>
|
|
|
|
Not Reviewed
|
|
|
|
</Tag> */}
|
|
|
|
<Tag icon={<CheckCircleOutlined />} color="success" style={{ padding: "4px 16px", marginLeft: 8 }}>
|
|
|
|
Reviewed
|
|
|
|
</Tag>
|
|
|
|
</div>
|
|
|
|
</Sider>
|
|
|
|
</Layout>
|
|
|
|
<Modal
|
|
|
|
title={t`Report Filters`}
|
|
|
|
open={isModalOpen}
|
|
|
|
width={700}
|
|
|
|
onOk={
|
|
|
|
() => {
|
|
|
|
setIsModalOpen(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onCancel={
|
|
|
|
() => {
|
|
|
|
setIsModalOpen(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Form
|
|
|
|
style={{
|
|
|
|
marginTop: 30,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Form.Item
|
|
|
|
name='dateRange'
|
|
|
|
label={t`Date (GMT+8)`}
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: 'Please select a date range',
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
style={{
|
|
|
|
marginBottom: 10,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<DatePicker.RangePicker
|
|
|
|
value={filterDateRange}
|
|
|
|
onChange={(value) => {
|
|
|
|
console.log(value);
|
|
|
|
setFilterDateRange(value);
|
|
|
|
}}
|
|
|
|
style={{ width: 200 }}
|
|
|
|
/>
|
|
|
|
</Form.Item>
|
|
|
|
<div style={{ marginTop: 10, display: 'flex' }}>
|
|
|
|
<Form.Item
|
|
|
|
name='subsidiary'
|
|
|
|
label={t`Subsidiary`}
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: 'Please select a subsidiary',
|
|
|
|
},
|
|
|
|
]}
|
2024-02-16 11:09:15 +00:00
|
|
|
style={{
|
2024-02-20 08:01:06 +00:00
|
|
|
marginBottom: 10,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Select
|
|
|
|
placeholder='Select a subsidiary'
|
|
|
|
style={{ width: 200 }}
|
|
|
|
options={[
|
|
|
|
{ value: 'ALL', label: 'ALL' },
|
|
|
|
{ value: 'SEAU', label: 'SEAU' },
|
|
|
|
{ value: 'SESP', label: 'SESP' },
|
|
|
|
{ value: 'SME', label: 'SME' },
|
|
|
|
{ value: 'SEPCO', label: 'SEPCO' },
|
|
|
|
{ value: 'TSE', label: 'TSE' },
|
|
|
|
{ value: 'SEIN', label: 'SEIN' },
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item
|
|
|
|
name='reviewed'
|
|
|
|
label={t`Reviewed`}
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: 'Please select review status',
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
style={{ marginLeft: 16 }}
|
|
|
|
>
|
|
|
|
<Select
|
|
|
|
style={{ width: 200 }}
|
|
|
|
options={[
|
|
|
|
{ value: 'ALL', label: 'ALL' },
|
|
|
|
{ value: 'YES', label: 'YES' },
|
|
|
|
{ value: 'NO', label: 'NO' },
|
|
|
|
]}
|
|
|
|
defaultValue={'ALL'}
|
|
|
|
/>
|
|
|
|
</Form.Item>
|
|
|
|
</div>
|
|
|
|
</Form>
|
|
|
|
</Modal>
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
height: '40%',
|
|
|
|
overflowY: 'auto',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<StyledTable dataSource={dataSource} columns={columns}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-02-16 11:09:15 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2024-02-20 08:01:06 +00:00
|
|
|
export default ReviewPage;
|