|
@@ -2,7 +2,8 @@ |
|
|
import { |
|
|
import { |
|
|
Grid, Button, Typography, |
|
|
Grid, Button, Typography, |
|
|
Dialog, DialogTitle, DialogContent, DialogActions, |
|
|
Dialog, DialogTitle, DialogContent, DialogActions, |
|
|
FormHelperText, TextField |
|
|
|
|
|
|
|
|
FormHelperText, |
|
|
|
|
|
// TextField |
|
|
} from '@mui/material'; |
|
|
} from '@mui/material'; |
|
|
import MainCard from "components/MainCard"; |
|
|
import MainCard from "components/MainCard"; |
|
|
import * as React from "react"; |
|
|
import * as React from "react"; |
|
@@ -21,6 +22,11 @@ import { lazy } from 'react'; |
|
|
import { notifyCreateSuccess } from 'utils/CommonFunction'; |
|
|
import { notifyCreateSuccess } from 'utils/CommonFunction'; |
|
|
import { useIntl } from "react-intl"; |
|
|
import { useIntl } from "react-intl"; |
|
|
|
|
|
|
|
|
|
|
|
import {DatePicker} from "@mui/x-date-pickers/DatePicker"; |
|
|
|
|
|
import dayjs from "dayjs"; |
|
|
|
|
|
import {DemoItem} from "@mui/x-date-pickers/internals/demo"; |
|
|
|
|
|
import {LocalizationProvider} from "@mui/x-date-pickers/LocalizationProvider"; |
|
|
|
|
|
import {AdapterDayjs} from "@mui/x-date-pickers/AdapterDayjs"; |
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -32,15 +38,23 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { |
|
|
const [isFailPopUp, setIsFailPopUp] = useState(false); |
|
|
const [isFailPopUp, setIsFailPopUp] = useState(false); |
|
|
const [failText, setFailText] = useState(""); |
|
|
const [failText, setFailText] = useState(""); |
|
|
const [errorMsg, setErrorMsg] = useState(""); |
|
|
const [errorMsg, setErrorMsg] = useState(""); |
|
|
|
|
|
const [minDate] = React.useState(new Date()); |
|
|
|
|
|
const [fromDate, setFromDate] = React.useState("dd / mm / yyyy"); |
|
|
|
|
|
const [fromDateValue, setFromDateValue] = React.useState("dd / mm / yyyy"); |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
//if state data are ready and assign to different field |
|
|
//if state data are ready and assign to different field |
|
|
// console.log(currentApplicationDetailData) |
|
|
// console.log(currentApplicationDetailData) |
|
|
if (Object.keys(currentUserData).length > 0) { |
|
|
if (Object.keys(currentUserData).length > 0) { |
|
|
|
|
|
setFromDate(currentUserData.brExpiryDate) |
|
|
setOnReady(true); |
|
|
setOnReady(true); |
|
|
} |
|
|
} |
|
|
}, [currentUserData]); |
|
|
}, [currentUserData]); |
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
|
|
setFromDateValue(fromDate); |
|
|
|
|
|
}, [fromDate]); |
|
|
|
|
|
|
|
|
function displayErrorMsg(errorMsg) { |
|
|
function displayErrorMsg(errorMsg) { |
|
|
return <Typography variant="errorMessage1">{errorMsg}</Typography> |
|
|
return <Typography variant="errorMessage1">{errorMsg}</Typography> |
|
|
} |
|
|
} |
|
@@ -78,6 +92,11 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { |
|
|
if (values.country.type == "hongKong" && values.district == null) { |
|
|
if (values.country.type == "hongKong" && values.district == null) { |
|
|
setErrorMsg(intl.formatMessage({ id: 'pleaseFillInDistrict' })) |
|
|
setErrorMsg(intl.formatMessage({ id: 'pleaseFillInDistrict' })) |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
let sentDateFrom = ""; |
|
|
|
|
|
if (fromDateValue != "dd / mm / yyyy") { |
|
|
|
|
|
sentDateFrom = DateUtils.dateValue(fromDateValue) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
HttpUtils.post({ |
|
|
HttpUtils.post({ |
|
|
url: UrlUtils.POST_ORG_SAVE_PATH, |
|
|
url: UrlUtils.POST_ORG_SAVE_PATH, |
|
|
params: { |
|
|
params: { |
|
@@ -86,7 +105,7 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { |
|
|
enCompanyName: values.enCompanyName, |
|
|
enCompanyName: values.enCompanyName, |
|
|
chCompanyName: values.chCompanyName, |
|
|
chCompanyName: values.chCompanyName, |
|
|
brNo: values.brNo, |
|
|
brNo: values.brNo, |
|
|
brExpiryDate: values.brExpiryDate, |
|
|
|
|
|
|
|
|
brExpiryDate: sentDateFrom, |
|
|
enCompanyNameTemp: values.enCompanyNameTemp, |
|
|
enCompanyNameTemp: values.enCompanyNameTemp, |
|
|
chCompanyNameTemp: values.chCompanyNameTemp, |
|
|
chCompanyNameTemp: values.chCompanyNameTemp, |
|
|
brExpiryDateTemp: values.brExpiryDateTemp, |
|
|
brExpiryDateTemp: values.brExpiryDateTemp, |
|
@@ -207,7 +226,36 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { |
|
|
<Typography variant="pnspsFormParagraphBold">{FieldUtils.notNullFieldLabel("Expiry Date:")}</Typography> |
|
|
<Typography variant="pnspsFormParagraphBold">{FieldUtils.notNullFieldLabel("Expiry Date:")}</Typography> |
|
|
</Grid> |
|
|
</Grid> |
|
|
<Grid item xs={12} md={6} lg={6}> |
|
|
<Grid item xs={12} md={6} lg={6}> |
|
|
<TextField |
|
|
|
|
|
|
|
|
<LocalizationProvider dateAdapter={AdapterDayjs}> |
|
|
|
|
|
<DemoItem components={['DatePicker']}> |
|
|
|
|
|
<DatePicker |
|
|
|
|
|
id="brExpiryDate" |
|
|
|
|
|
name="brExpiryDate" |
|
|
|
|
|
onError={Boolean(formik.errors["brExpiryDate"])} |
|
|
|
|
|
slotProps={{ |
|
|
|
|
|
field: { readOnly: true, }, |
|
|
|
|
|
textField: { |
|
|
|
|
|
helperText:formik.errors["brExpiryDate"] ? formik.errors["brExpiryDate"] : '' |
|
|
|
|
|
}, |
|
|
|
|
|
}} |
|
|
|
|
|
format="DD/MM/YYYY" |
|
|
|
|
|
// label={"Submit Date (From)"} |
|
|
|
|
|
value={fromDate === null ? null : dayjs(fromDate)} |
|
|
|
|
|
minDate={minDate === null ? null : dayjs(minDate)} |
|
|
|
|
|
// disabled={(!editMode && !createMode)} |
|
|
|
|
|
onChange={(newValue) => { |
|
|
|
|
|
// console.log(DateUtils.dateValue(newValue)) |
|
|
|
|
|
// console.log(DateUtils.dateValue(minDate)) |
|
|
|
|
|
if(DateUtils.dateValue(newValue)>DateUtils.dateValue(minDate)){ |
|
|
|
|
|
setFromDate(newValue); |
|
|
|
|
|
}else{ |
|
|
|
|
|
alert("Please select a date after today.") |
|
|
|
|
|
} |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
|
|
|
</DemoItem > |
|
|
|
|
|
</LocalizationProvider> |
|
|
|
|
|
{/* <TextField |
|
|
fullWidth |
|
|
fullWidth |
|
|
id="brExpiryDate" |
|
|
id="brExpiryDate" |
|
|
name="brExpiryDate" |
|
|
name="brExpiryDate" |
|
@@ -220,7 +268,7 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { |
|
|
sx={{ |
|
|
sx={{ |
|
|
width: '100%' |
|
|
width: '100%' |
|
|
}} |
|
|
}} |
|
|
/> |
|
|
|
|
|
|
|
|
/> */} |
|
|
</Grid> |
|
|
</Grid> |
|
|
</Grid> |
|
|
</Grid> |
|
|
|
|
|
|
|
|