-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
following feedback -- removing reentry data modal from use. Component…
… has been retained for application to other places in future.
- Loading branch information
1 parent
e11b782
commit 2decf65
Showing
2 changed files
with
80 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
'use client'; | ||
import React, { useState } from 'react'; | ||
import { GridRowModel } from '@mui/x-data-grid'; | ||
import { Box, Button, DialogActions, DialogContent, DialogTitle, Modal, ModalDialog, Typography } from '@mui/joy'; | ||
|
||
interface ReEnterDataModalProps { | ||
gridType: string; | ||
row: GridRowModel; | ||
handleClose: () => void; | ||
handleSave: (confirmedRow: GridRowModel) => void; | ||
} | ||
|
||
const SkipReEnterDataModal: React.FC<ReEnterDataModalProps> = ({ gridType, row, handleClose, handleSave }) => { | ||
const [isConfirmStep, setIsConfirmStep] = useState(false); | ||
|
||
const handleConfirm = () => { | ||
setIsConfirmStep(true); | ||
}; | ||
|
||
const handleFinalConfirm = () => { | ||
handleSave(row); // Proceed to save the row directly without reentry | ||
}; | ||
|
||
return ( | ||
<Modal open onClose={handleClose}> | ||
<ModalDialog variant="outlined" sx={{ maxWidth: '90vw', overflow: 'auto' }}> | ||
<DialogTitle>Confirm Changes</DialogTitle> | ||
<DialogContent> | ||
{!isConfirmStep ? ( | ||
<Typography level="body-md">You are about to save the following changes to the row. Please confirm to proceed.</Typography> | ||
) : ( | ||
<Box className="mt-4" sx={{ display: 'flex', flexDirection: 'column' }}> | ||
<Typography level="title-lg">Please confirm your changes:</Typography> | ||
<Typography level="body-md">Are you sure you want to save these changes to the selected row?</Typography> | ||
</Box> | ||
)} | ||
</DialogContent> | ||
<DialogActions> | ||
{!isConfirmStep ? ( | ||
<> | ||
<Button onClick={handleConfirm} color="primary"> | ||
Confirm | ||
</Button> | ||
<Button onClick={handleClose} color="primary"> | ||
Cancel | ||
</Button> | ||
</> | ||
) : ( | ||
<> | ||
<Button onClick={handleFinalConfirm} color="primary"> | ||
Save Changes | ||
</Button> | ||
<Button onClick={handleClose} color="primary"> | ||
Cancel | ||
</Button> | ||
</> | ||
)} | ||
</DialogActions> | ||
</ModalDialog> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default SkipReEnterDataModal; |