2024-06-07 01:24:58 +00:00
|
|
|
import { DownloadOutlined } from '@ant-design/icons';
|
2024-05-24 05:59:34 +00:00
|
|
|
import { Button, Tag } from 'antd';
|
2024-05-02 12:14:47 +00:00
|
|
|
|
2024-06-03 06:59:26 +00:00
|
|
|
const FileCard = ({ file, isSelected, onClick }) => {
|
2024-05-02 12:14:47 +00:00
|
|
|
const fileName = file['File Name'];
|
2024-05-31 09:55:02 +00:00
|
|
|
const extensionType = fileName.split('.').pop();
|
2024-06-06 04:05:05 +00:00
|
|
|
const isRequired = file['Is Required'];
|
|
|
|
const isReviewd = file['Is Reviewed'];
|
|
|
|
|
2024-05-02 12:14:47 +00:00
|
|
|
return (
|
|
|
|
<div
|
|
|
|
style={{
|
2024-05-24 05:59:34 +00:00
|
|
|
border: `1px solid #ccc`,
|
|
|
|
backgroundColor: isSelected ? '#f4f4f4' : '#fff',
|
2024-05-02 12:14:47 +00:00
|
|
|
padding: '4px 8px',
|
2024-05-23 11:48:21 +00:00
|
|
|
margin: '0 8px 4px',
|
|
|
|
display: 'flex',
|
2024-05-24 05:59:34 +00:00
|
|
|
alignItems: 'center',
|
|
|
|
cursor: 'pointer',
|
2024-05-02 12:14:47 +00:00
|
|
|
}}
|
|
|
|
onClick={onClick}
|
|
|
|
>
|
|
|
|
<div>
|
2024-05-24 05:59:34 +00:00
|
|
|
<div>
|
|
|
|
<p
|
|
|
|
style={{
|
|
|
|
fontSize: '12px',
|
|
|
|
color: '#333',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
cursor: 'default',
|
|
|
|
margin: '4px 8px 4px 0',
|
|
|
|
display: 'inline-block',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{file['Doc Type'].toUpperCase()}
|
|
|
|
</p>
|
|
|
|
<span
|
|
|
|
style={{
|
|
|
|
fontSize: '12px',
|
|
|
|
color: '#aaa',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
cursor: 'default',
|
|
|
|
maxWidth: '40px',
|
|
|
|
overflow: 'hidden',
|
|
|
|
textOverflow: 'ellipsis',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{fileName
|
|
|
|
? fileName.substring(0, 25).replace('temp_', '')
|
2024-06-06 04:05:05 +00:00
|
|
|
: fileName}{' '}
|
|
|
|
({extensionType})
|
2024-05-24 05:59:34 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
2024-06-07 01:24:58 +00:00
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
alignItems: 'center',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{isRequired ? (
|
|
|
|
<>
|
|
|
|
{isReviewd ? (
|
|
|
|
<Tag
|
|
|
|
color={'success'}
|
|
|
|
style={{
|
|
|
|
display: 'inline-block',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
textTransform: 'capitalize',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
Reviewd
|
|
|
|
</Tag>
|
|
|
|
) : (
|
|
|
|
<Tag
|
|
|
|
color={'warning'}
|
|
|
|
style={{
|
|
|
|
display: 'inline-block',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
textTransform: 'capitalize',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
Not reviewed
|
|
|
|
</Tag>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
) : (
|
|
|
|
<Tag
|
|
|
|
style={{
|
|
|
|
display: 'inline-block',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
textTransform: 'capitalize',
|
|
|
|
}}
|
|
|
|
// bordered={false}
|
|
|
|
>
|
|
|
|
Not required
|
|
|
|
</Tag>
|
|
|
|
)}
|
2024-06-06 04:05:05 +00:00
|
|
|
</div>
|
2024-05-02 12:14:47 +00:00
|
|
|
</div>
|
2024-05-23 11:48:21 +00:00
|
|
|
<Button
|
2024-05-02 12:14:47 +00:00
|
|
|
style={{
|
2024-05-24 05:59:34 +00:00
|
|
|
width: '24px',
|
|
|
|
height: '24px',
|
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
marginLeft: '8px',
|
2024-05-23 11:48:21 +00:00
|
|
|
}}
|
|
|
|
onClick={() => {
|
|
|
|
const downloadUrl = file['File URL'];
|
|
|
|
window.open(downloadUrl, '_blank');
|
2024-05-02 12:14:47 +00:00
|
|
|
}}
|
|
|
|
>
|
2024-05-23 11:48:21 +00:00
|
|
|
<DownloadOutlined />
|
|
|
|
</Button>
|
2024-05-02 12:14:47 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default FileCard;
|