// material-ui import { Grid, Typography, Button, // RadioGroup, Dialog, DialogTitle, DialogContent, DialogActions, Stack, InputLabel, // OutlinedInput, FormHelperText, TextField, // Box } from '@mui/material'; import { useFormik } from 'formik'; import * as yup from 'yup'; import * as React from "react"; import * as HttpUtils from "utils/HttpUtils"; import * as UrlUtils from "utils/ApiPathConst"; // import * as FieldUtils from "utils/FieldUtils"; import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' import ForwardIcon from '@mui/icons-material/Forward'; import MainCard from 'components/MainCard'; import { useNavigate } from "react-router-dom"; // import { notifyActionSuccess } from 'utils/CommonFunction'; import {PNSPS_LONG_BUTTON_THEME} from "themes/buttonConst"; import {ThemeProvider} from "@emotion/react"; import {FormattedMessage, useIntl} from "react-intl"; // ==============================|| DASHBOARD - DEFAULT ||============================== // const ForgotUsernameApplyForm = () => { const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); // const [warningText, setWarningText] = React.useState("");s // const [attachment, setAttachment] = React.useState({}); const intl = useIntl(); // const [issueId, setIssueId] = React.useState(loadedData.issueId); const navigate = useNavigate(); const BackgroundHead = { backgroundImage: `url(${titleBackgroundImg})`, width: 'auto', height: 'auto', backgroundSize: 'contain', backgroundRepeat: 'no-repeat', backgroundColor: '#0C489E', backgroundPosition: 'right' } const formik = useFormik({ enableReinitialize: true, initialValues: { // username: '', emailAddress: '', }, validationSchema: yup.object().shape({ // username: yup.string().required(intl.formatMessage({id: 'requireUsername'})), emailAddress: yup.string().email(intl.formatMessage({id: 'validEmailFormat'})).max(255).required(intl.formatMessage({id: 'requireEmail'})), }), onSubmit: values => { console.log(values) HttpUtils.post({ url: UrlUtils.POST_FORGOT_USERNAME_EMAIL, params: { emailAddress: values.emailAddress, }, // files: [attachment], onSuccess: function () { // notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') navigate('/forgot/password/sent'); // location.reload(); }, onError:function () { navigate('/forgot/password/sent'); } }); } }); return (
{/* 申請公共啟事 */} *': { flexGrow: 1, flexBasis: '50%' } }} content={false} border={false} boxShadow >
{ if (e.key === 'Enter') { e.preventDefault(); } }, }} InputLabelProps={{ shrink: true }} /> {formik.touched.emailAddress && formik.errors.emailAddress && ( {formik.errors.emailAddress} )}
setIsWarningPopUp(false)} PaperProps={{ sx: { minWidth: '40vw', maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } } }} > {/* {warningText} */}
); }; export default ForgotUsernameApplyForm;