commit
1e915c7ac3
@ -2,6 +2,7 @@
|
|||||||
"Are you sure you want to leave without saving?": "Are you sure you want to leave without saving?",
|
"Are you sure you want to leave without saving?": "Are you sure you want to leave without saving?",
|
||||||
"Back": "Back",
|
"Back": "Back",
|
||||||
"Back to Dashboard": "Back to Dashboard",
|
"Back to Dashboard": "Back to Dashboard",
|
||||||
|
"Bad image reason:": "Bad image reason:",
|
||||||
"Create New Report": "Create New Report",
|
"Create New Report": "Create New Report",
|
||||||
"Dashboard": "Dashboard",
|
"Dashboard": "Dashboard",
|
||||||
"Date (GMT+8)": "Date (GMT+8)",
|
"Date (GMT+8)": "Date (GMT+8)",
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
"Are you sure you want to leave without saving?": "Bạn có chắc chắn muốn rời đi mà không lưu lại không?",
|
"Are you sure you want to leave without saving?": "Bạn có chắc chắn muốn rời đi mà không lưu lại không?",
|
||||||
"Back": "",
|
"Back": "",
|
||||||
"Back to Dashboard": "",
|
"Back to Dashboard": "",
|
||||||
|
"Bad image reason:": "",
|
||||||
"Create New Report": "",
|
"Create New Report": "",
|
||||||
"Dashboard": "",
|
"Dashboard": "",
|
||||||
"Date (GMT+8)": "",
|
"Date (GMT+8)": "",
|
||||||
|
@ -7,6 +7,7 @@ import { Button, Tag } from 'antd';
|
|||||||
|
|
||||||
const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
|
const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
|
||||||
const fileName = file['File Name'];
|
const fileName = file['File Name'];
|
||||||
|
const extensionType = fileName.split('.').pop();
|
||||||
let status = true;
|
let status = true;
|
||||||
if (file['Is Required'] && !file['Is Reviewed']) {
|
if (file['Is Required'] && !file['Is Reviewed']) {
|
||||||
status = false;
|
status = false;
|
||||||
@ -52,6 +53,7 @@ const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
|
|||||||
{fileName
|
{fileName
|
||||||
? fileName.substring(0, 25).replace('temp_', '')
|
? fileName.substring(0, 25).replace('temp_', '')
|
||||||
: fileName}
|
: fileName}
|
||||||
|
{' '}({extensionType})
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<Tag
|
<Tag
|
||||||
|
@ -9,6 +9,9 @@ import {
|
|||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { Viewer } from '@react-pdf-viewer/core';
|
import { Viewer } from '@react-pdf-viewer/core';
|
||||||
|
import '@react-pdf-viewer/core/lib/styles/index.css';
|
||||||
|
import { defaultLayoutPlugin } from '@react-pdf-viewer/default-layout';
|
||||||
|
import '@react-pdf-viewer/default-layout/lib/styles/index.css';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
DatePicker,
|
DatePicker,
|
||||||
@ -26,9 +29,6 @@ import { useEffect, useState } from 'react';
|
|||||||
import Lightbox from 'react-awesome-lightbox';
|
import Lightbox from 'react-awesome-lightbox';
|
||||||
import 'react-awesome-lightbox/build/style.css';
|
import 'react-awesome-lightbox/build/style.css';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
// Import the styles
|
|
||||||
import '@react-pdf-viewer/core/lib/styles/index.css';
|
|
||||||
|
|
||||||
import { badQualityReasonSubmit } from 'request';
|
import { badQualityReasonSubmit } from 'request';
|
||||||
import { getErrorMessage } from 'utils/error-handler';
|
import { getErrorMessage } from 'utils/error-handler';
|
||||||
import {
|
import {
|
||||||
@ -81,7 +81,7 @@ const ReviewPage = () => {
|
|||||||
const [solution, setSolution] = useState('');
|
const [solution, setSolution] = useState('');
|
||||||
const [otherSolution, setOtherSolution] = useState('');
|
const [otherSolution, setOtherSolution] = useState('');
|
||||||
const [imageLoading, setImageLoading] = useState(false);
|
const [imageLoading, setImageLoading] = useState(false);
|
||||||
|
const defaultLayoutPluginInstance = defaultLayoutPlugin();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (reason) {
|
if (reason) {
|
||||||
setSolution(counter_measure_map[reason]);
|
setSolution(counter_measure_map[reason]);
|
||||||
@ -137,8 +137,8 @@ const ReviewPage = () => {
|
|||||||
setSelectedFileData(fileURL);
|
setSelectedFileData(fileURL);
|
||||||
} else {
|
} else {
|
||||||
setSelectedFileData('FAILED_TO_LOAD_FILE');
|
setSelectedFileData('FAILED_TO_LOAD_FILE');
|
||||||
setImageLoading(false);
|
|
||||||
}
|
}
|
||||||
|
setImageLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadCurrentRequest = (requestIndex) => {
|
const loadCurrentRequest = (requestIndex) => {
|
||||||
@ -283,10 +283,8 @@ const ReviewPage = () => {
|
|||||||
});
|
});
|
||||||
notification.success({ message: 'Update file success' });
|
notification.success({ message: 'Update file success' });
|
||||||
|
|
||||||
const requestData = await fetchRequest(
|
const requestData = await fetchRequest(currentRequest?.RequestID);
|
||||||
currentRequest?.RequestID,
|
setCurrentRequest(requestData);
|
||||||
);
|
|
||||||
setCurrentRequest(requestData)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notification.error({
|
notification.error({
|
||||||
message: getErrorMessage(error),
|
message: getErrorMessage(error),
|
||||||
@ -472,6 +470,22 @@ const ReviewPage = () => {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{selectedFileData === 'FAILED_TO_LOAD_FILE' ? (
|
||||||
|
<p style={{ color: '#333' }}>Failed to load file.</p>
|
||||||
|
) : fileExtension === 'pdf' ? (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
flexGrow: 1,
|
||||||
|
overflow: 'auto',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Viewer
|
||||||
|
plugins={[defaultLayoutPluginInstance]}
|
||||||
|
fileUrl={selectedFileData}
|
||||||
|
onDocumentLoad={() => setImageLoading(false)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
@ -479,15 +493,9 @@ const ReviewPage = () => {
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
overflowX: 'visible',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Spin spinning={imageLoading}>
|
|
||||||
{selectedFileData === 'FAILED_TO_LOAD_FILE' ? (
|
|
||||||
<p style={{ color: '#333' }}>Failed to load file.</p>
|
|
||||||
) : fileExtension === 'pdf' ? (
|
|
||||||
<Viewer fileUrl={selectedFileData} />
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<img
|
<img
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
@ -510,10 +518,9 @@ const ReviewPage = () => {
|
|||||||
onClose={() => setLightBox(false)}
|
onClose={() => setLightBox(false)}
|
||||||
></Lightbox>
|
></Lightbox>
|
||||||
)}
|
)}
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Spin>
|
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
<Spin spinning={imageLoading}></Spin>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@ -717,7 +724,9 @@ const ReviewPage = () => {
|
|||||||
style={{ background: shouldRevised ? 'yellow' : '' }}
|
style={{ background: shouldRevised ? 'yellow' : '' }}
|
||||||
size='small'
|
size='small'
|
||||||
value={selectedFileDataSource[data]?.[REVIEWED_RESULT]}
|
value={selectedFileDataSource[data]?.[REVIEWED_RESULT]}
|
||||||
onChange={(e) =>handleUpdateFileInField(data, e.target.value)}
|
onChange={(e) =>
|
||||||
|
handleUpdateFileInField(data, e.target.value)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user