|
|
@@ -1,6 +1,7 @@ |
|
|
|
// material-ui |
|
|
|
import { |
|
|
|
Grid, Button, Typography |
|
|
|
Grid, Button, Typography, |
|
|
|
Dialog, DialogTitle, DialogContent, DialogActions, |
|
|
|
} from '@mui/material'; |
|
|
|
import MainCard from "../../components/MainCard"; |
|
|
|
import * as React from "react"; |
|
|
@@ -25,6 +26,8 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { |
|
|
|
const [currentUserData, setCurrentUserData] = useState(userData); |
|
|
|
const navigate = useNavigate(); |
|
|
|
const [onReady, setOnReady] = useState(false); |
|
|
|
const [isFailPopUp, setIsFailPopUp] = useState(false); |
|
|
|
const [failText, setFailText] = useState(""); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
//if state data are ready and assign to different field |
|
|
@@ -94,6 +97,11 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { |
|
|
|
} |
|
|
|
}, |
|
|
|
onSuccess: function (responseData) { |
|
|
|
if(responseData.msg){ |
|
|
|
setFailText(responseData.msg); |
|
|
|
setIsFailPopUp(true); |
|
|
|
return; |
|
|
|
} |
|
|
|
navigate('/org/' + responseData.id); |
|
|
|
notifyCreateSuccess() |
|
|
|
} |
|
|
@@ -242,6 +250,18 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { |
|
|
|
} |
|
|
|
</form> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div> |
|
|
|
<Dialog open={isFailPopUp} onClose={() => setIsFailPopUp(false)} > |
|
|
|
<DialogTitle><Typography variant="h3">Action Fail</Typography></DialogTitle> |
|
|
|
<DialogContent style={{ display: 'flex', }}> |
|
|
|
<Typography variant="h4" style={{ padding: '16px' }}>{failText}</Typography> |
|
|
|
</DialogContent> |
|
|
|
<DialogActions> |
|
|
|
<Button onClick={() => setIsFailPopUp(false)}><Typography variant="h5">OK</Typography></Button> |
|
|
|
</DialogActions> |
|
|
|
</Dialog> |
|
|
|
</div> |
|
|
|
</MainCard> |
|
|
|
); |
|
|
|
}; |
|
|
|