diff --git a/cope2n-fe/src/pages/reviews2/index.tsx b/cope2n-fe/src/pages/reviews2/index.tsx index 4d5c2e5..2f73edb 100644 --- a/cope2n-fe/src/pages/reviews2/index.tsx +++ b/cope2n-fe/src/pages/reviews2/index.tsx @@ -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'; @@ -225,7 +225,7 @@ const ReviewPage = () => { .then((data) => { setTotalPages(data?.page?.total_requests); setHasNextRequest(requestIndex < data?.page?.total_requests); - + fetchRequest(data?.subscription_requests[0].RequestID) .then(async (data) => { if (data) setCurrentRequest(data); @@ -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 (
+ There is still at least 1 photo need to be reviewed!{' '} +
+ )}Are you sure you want to confirm this request is reviewed?