update modal confir

This commit is contained in:
phanphan 2024-06-20 13:27:41 +07:00
parent 6279fdc30c
commit e797c40eb4
2 changed files with 31 additions and 22 deletions

View File

@ -5,7 +5,7 @@ const FileCard = ({ file, isSelected, onClick }) => {
const fileName = file['File Name']; const fileName = file['File Name'];
const extensionType = fileName.split('.').pop(); const extensionType = fileName.split('.').pop();
const isRequired = file['Is Required']; const isRequired = file['Is Required'];
const isReviewd = file['Is Reviewed']; const isReviewed = file['Is Reviewed'];
return ( return (
<div <div
@ -60,7 +60,7 @@ const FileCard = ({ file, isSelected, onClick }) => {
> >
{isRequired ? ( {isRequired ? (
<> <>
{isReviewd ? ( {isReviewed ? (
<Tag <Tag
color={'success'} color={'success'}
style={{ style={{
@ -69,7 +69,7 @@ const FileCard = ({ file, isSelected, onClick }) => {
textTransform: 'capitalize', textTransform: 'capitalize',
}} }}
> >
Reviewd Reviewed
</Tag> </Tag>
) : ( ) : (
<Tag <Tag

View File

@ -63,7 +63,7 @@ const ReviewPage = () => {
const [selectedFileData, setSelectedFileData] = useState(null); const [selectedFileData, setSelectedFileData] = useState(null);
const [selectedFileDataSource, setSelectedFileDataSource] = useState({}); const [selectedFileDataSource, setSelectedFileDataSource] = useState({});
const [selectedFileName, setSelectedFileName] = useState(null); const [selectedFileName, setSelectedFileName] = useState(null);
const [isOpenConfirmRequest, setIsOpenConfirmRequest] = useState(false);
// Default date range: 1 month ago to today // Default date range: 1 month ago to today
const [filterDateRange, setFilterDateRange] = useState(['', '']); const [filterDateRange, setFilterDateRange] = useState(['', '']);
@ -290,10 +290,6 @@ const ReviewPage = () => {
}; };
const handleConfirmReview = async () => { const handleConfirmReview = async () => {
const isConfirmed = window.confirm(
'Are you sure you want to confirm this request is reviewed?',
);
if (isConfirmed) {
try { try {
await updateRevisedData(currentRequest?.RequestID); await updateRevisedData(currentRequest?.RequestID);
addRecentRequest(currentRequest?.RequestID); addRecentRequest(currentRequest?.RequestID);
@ -307,7 +303,6 @@ const ReviewPage = () => {
message: getErrorMessage(error), message: getErrorMessage(error),
}); });
} }
}
}; };
const submitRevisedData = async () => { const submitRevisedData = async () => {
@ -699,7 +694,7 @@ const ReviewPage = () => {
size='middle' size='middle'
disabled={currentRequest && currentRequest['Is Reviewed']} disabled={currentRequest && currentRequest['Is Reviewed']}
style={{ minWidth: '120px' }} style={{ minWidth: '120px' }}
onClick={handleConfirmReview} onClick={() => setIsOpenConfirmRequest(true)}
> >
Confirm request Confirm request
</Button> </Button>
@ -1012,6 +1007,20 @@ const ReviewPage = () => {
</div> </div>
</Form> </Form>
</Modal> </Modal>
<Modal
title='Confirm this request?'
centered
open={isOpenConfirmRequest}
onOk={() => {
setIsOpenConfirmRequest(false);
handleConfirmReview();
}}
onCancel={() => {
setIsOpenConfirmRequest(false);
}}
>
<p>Are you sure you want to confirm this request is reviewed?</p>
</Modal>
</div> </div>
); );
}; };