add warning msg
This commit is contained in:
parent
e7e61bfce3
commit
7501863cfd
@ -26,7 +26,7 @@ import {
|
||||
Tag,
|
||||
} from 'antd';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import Lightbox from 'react-awesome-lightbox';
|
||||
import 'react-awesome-lightbox/build/style.css';
|
||||
import { useHotkeys } from 'react-hotkeys-hook';
|
||||
@ -303,7 +303,6 @@ const ReviewPage = () => {
|
||||
throw new Error(await res.text());
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ handleConfirmRequest ~ error:', error);
|
||||
addRecentRequest(currentRequest?.RequestID, error, false);
|
||||
notification.error({
|
||||
message: getErrorMessage(error),
|
||||
@ -385,6 +384,16 @@ const ReviewPage = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const isSafeToConfirm = useMemo(() => {
|
||||
let isSafe = true;
|
||||
isSafe = !currentRequest?.Files.some((file) => {
|
||||
const isRequired = file['Is Required'];
|
||||
const isReviewed = file['Is Reviewed'];
|
||||
return isRequired && !isReviewed;
|
||||
});
|
||||
return isSafe;
|
||||
}, [currentRequest]);
|
||||
|
||||
return (
|
||||
<div
|
||||
style={
|
||||
@ -1030,6 +1039,11 @@ const ReviewPage = () => {
|
||||
setIsOpenConfirmRequest(false);
|
||||
}}
|
||||
>
|
||||
{!isSafeToConfirm && (
|
||||
<p style={{ fontWeight: 'bold', color: 'red' }}>
|
||||
There is still at least 1 photo need to be reviewed!{' '}
|
||||
</p>
|
||||
)}
|
||||
<p>Are you sure you want to confirm this request is reviewed?</p>
|
||||
</Modal>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user