| @@ -2,6 +2,7 @@ | |||||
| import { | import { | ||||
| Grid, Button, Checkbox, FormControlLabel, Typography, | Grid, Button, Checkbox, FormControlLabel, Typography, | ||||
| Dialog, DialogTitle, DialogContent, DialogActions, | Dialog, DialogTitle, DialogContent, DialogActions, | ||||
| FormHelperText | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| // import { FormControlLabel } from '@material-ui/core'; | // import { FormControlLabel } from '@material-ui/core'; | ||||
| import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
| @@ -33,6 +34,7 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| const [editMode, setEditMode] = useState(false); | const [editMode, setEditMode] = useState(false); | ||||
| const [createMode, setCreateMode] = useState(false); | const [createMode, setCreateMode] = useState(false); | ||||
| const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
| const [errorMsg, setErrorMsg] = useState(""); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| //if state data are ready and assign to different field | //if state data are ready and assign to different field | ||||
| @@ -71,43 +73,50 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| } | } | ||||
| }), | }), | ||||
| }), | }), | ||||
| onSubmit: vaule => { | |||||
| console.log(vaule) | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_ORG_SAVE_PATH, | |||||
| params: { | |||||
| id: id > 0 ? id : null, | |||||
| enCompanyName: vaule.enCompanyName, | |||||
| chCompanyName: vaule.chCompanyName, | |||||
| brNo: vaule.brNo, | |||||
| brExpiryDate: vaule.brExpiryDate, | |||||
| enCompanyNameTemp: vaule.enCompanyNameTemp, | |||||
| chCompanyNameTemp: vaule.chCompanyNameTemp, | |||||
| brExpiryDateTemp: vaule.brExpiryDateTemp, | |||||
| contactPerson: vaule.contactPerson, | |||||
| contactTel: { | |||||
| countryCode: vaule.tel_countryCode, | |||||
| phoneNumber: vaule.phoneNumber | |||||
| }, | |||||
| faxNo: { | |||||
| countryCode: vaule.fax_countryCode, | |||||
| faxNumber: vaule.faxNumber | |||||
| }, | |||||
| addressTemp: { | |||||
| country: vaule.country.id, | |||||
| district: vaule.district.id, | |||||
| addressLine1: vaule.addressLine1, | |||||
| addressLine2: vaule.addressLine2, | |||||
| addressLine3: vaule.addressLine3, | |||||
| }, | |||||
| //creditor: vaule.creditor, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess() | |||||
| loadDataFun(); | |||||
| setEditMode(false); | |||||
| } | |||||
| }); | |||||
| onSubmit: values => { | |||||
| if (values.country==null){ | |||||
| setErrorMsg(intl.formatMessage({id: 'pleaseFillInCountry'})) | |||||
| } else { | |||||
| if (values.country.key ==1 && values.district == null){ | |||||
| setErrorMsg(intl.formatMessage({id: 'pleaseFillInDistrict'})) | |||||
| } else { | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_ORG_SAVE_PATH, | |||||
| params: { | |||||
| id: id > 0 ? id : null, | |||||
| enCompanyName: values.enCompanyName, | |||||
| chCompanyName: values.chCompanyName, | |||||
| brNo: values.brNo, | |||||
| brExpiryDate: values.brExpiryDate, | |||||
| enCompanyNameTemp: values.enCompanyNameTemp, | |||||
| chCompanyNameTemp: values.chCompanyNameTemp, | |||||
| brExpiryDateTemp: values.brExpiryDateTemp, | |||||
| contactPerson: values.contactPerson, | |||||
| contactTel: { | |||||
| countryCode: values.tel_countryCode, | |||||
| phoneNumber: values.phoneNumber | |||||
| }, | |||||
| faxNo: { | |||||
| countryCode: values.fax_countryCode, | |||||
| faxNumber: values.faxNumber | |||||
| }, | |||||
| addressTemp: { | |||||
| country: values.country.id, | |||||
| district: values.district?.id, | |||||
| addressLine1: values.addressLine1, | |||||
| addressLine2: values.addressLine2, | |||||
| addressLine3: values.addressLine3, | |||||
| }, | |||||
| //creditor: values.creditor, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess() | |||||
| loadDataFun(); | |||||
| setEditMode(false); | |||||
| } | |||||
| }); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -263,6 +272,13 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| Organization Details | Organization Details | ||||
| </Typography> | </Typography> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12}> | |||||
| <FormHelperText error id="helper-text-address1-signup"> | |||||
| <Typography variant="errorMessage1"> | |||||
| {errorMsg} | |||||
| </Typography> | |||||
| </FormHelperText> | |||||
| </Grid> | |||||
| <Grid item lg={4} > | <Grid item lg={4} > | ||||
| {FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
| label: FieldUtils.notNullFieldLabel("BR No.:"), | label: FieldUtils.notNullFieldLabel("BR No.:"), | ||||
| @@ -4,6 +4,7 @@ import { | |||||
| // Checkbox, FormControlLabel, | // Checkbox, FormControlLabel, | ||||
| Typography, | Typography, | ||||
| Dialog, DialogTitle, DialogContent, DialogActions, | Dialog, DialogTitle, DialogContent, DialogActions, | ||||
| FormHelperText | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| // import { FormControlLabel } from '@material-ui/core'; | // import { FormControlLabel } from '@material-ui/core'; | ||||
| import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
| @@ -35,6 +36,7 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| const [editMode, setEditMode] = useState(false); | const [editMode, setEditMode] = useState(false); | ||||
| const [createMode, setCreateMode] = useState(false); | const [createMode, setCreateMode] = useState(false); | ||||
| const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
| const [errorMsg, setErrorMsg] = useState(""); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| //if state data are ready and assign to different field | //if state data are ready and assign to different field | ||||
| @@ -58,31 +60,38 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| tel_countryCode: yup.string().min(3, displayErrorMsg(intl.formatMessage({id: 'requireDialingCode'}))), | tel_countryCode: yup.string().min(3, displayErrorMsg(intl.formatMessage({id: 'requireDialingCode'}))), | ||||
| phoneNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'requiredValidNumber'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireContactNumber'}))), | phoneNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'requiredValidNumber'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireContactNumber'}))), | ||||
| }), | }), | ||||
| onSubmit: vaule => { | |||||
| console.log(vaule) | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_PUB_ORG_SAVE_PATH, | |||||
| params: { | |||||
| contactPerson: vaule.contactPerson, | |||||
| contactTel: { | |||||
| countryCode: vaule.tel_countryCode, | |||||
| phoneNumber: vaule.phoneNumber | |||||
| }, | |||||
| addressTemp: { | |||||
| country: vaule.country.id, | |||||
| district: vaule.district.id, | |||||
| addressLine1: vaule.addressLine1, | |||||
| addressLine2: vaule.addressLine2, | |||||
| addressLine3: vaule.addressLine3, | |||||
| }, | |||||
| //creditor: vaule.creditor, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess() | |||||
| loadDataFun(); | |||||
| setEditMode(false); | |||||
| onSubmit: values => { | |||||
| if (values.country==null){ | |||||
| setErrorMsg(intl.formatMessage({id: 'pleaseFillInCountry'})) | |||||
| } else { | |||||
| if (values.country.key ==1 && values.district == null){ | |||||
| setErrorMsg(intl.formatMessage({id: 'pleaseFillInDistrict'})) | |||||
| } else { | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_PUB_ORG_SAVE_PATH, | |||||
| params: { | |||||
| contactPerson: values.contactPerson, | |||||
| contactTel: { | |||||
| countryCode: values.tel_countryCode, | |||||
| phoneNumber: values.phoneNumber | |||||
| }, | |||||
| addressTemp: { | |||||
| country: values.country.id, | |||||
| district: values.district?.id, | |||||
| addressLine1: values.addressLine1, | |||||
| addressLine2: values.addressLine2, | |||||
| addressLine3: values.addressLine3, | |||||
| }, | |||||
| //creditor: values.creditor, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess() | |||||
| loadDataFun(); | |||||
| setEditMode(false); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| }); | |||||
| } | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -193,6 +202,13 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| <FormattedMessage id="organizationDetails" /> | <FormattedMessage id="organizationDetails" /> | ||||
| </Typography> | </Typography> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12}> | |||||
| <FormHelperText error id="helper-text-address1-signup"> | |||||
| <Typography variant="errorMessage1"> | |||||
| {errorMsg} | |||||
| </Typography> | |||||
| </FormHelperText> | |||||
| </Grid> | |||||
| <Grid item lg={4} > | <Grid item lg={4} > | ||||
| {FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
| label: intl.formatMessage({id: 'brNo'}) + ":", | label: intl.formatMessage({id: 'brNo'}) + ":", | ||||
| @@ -1,23 +1,24 @@ | |||||
| // material-ui | // material-ui | ||||
| import { | import { | ||||
| Grid, Button, Typography | |||||
| Grid, Button, Typography, | |||||
| FormHelperText | |||||
| } 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"; | ||||
| import { useEffect, useState } from "react"; | import { useEffect, useState } from "react"; | ||||
| import * as yup from 'yup'; | import * as yup from 'yup'; | ||||
| import { useFormik } from 'formik'; | import { useFormik } from 'formik'; | ||||
| import * as FieldUtils from "../../../utils/FieldUtils"; | |||||
| import * as HttpUtils from '../../../utils/HttpUtils'; | |||||
| import * as UrlUtils from "../../../utils/ApiPathConst"; | |||||
| import * as ComboData from "../../../utils/ComboData"; | |||||
| import * as FieldUtils from "utils/FieldUtils"; | |||||
| import * as HttpUtils from 'utils/HttpUtils'; | |||||
| import * as UrlUtils from "utils/ApiPathConst"; | |||||
| import * as ComboData from "utils/ComboData"; | |||||
| const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | ||||
| import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
| import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
| import { notifyActiveSuccess, notifyLockSuccess, notifySaveSuccess, notifyVerifySuccess } from 'utils/CommonFunction'; | import { notifyActiveSuccess, notifyLockSuccess, notifySaveSuccess, notifyVerifySuccess } from 'utils/CommonFunction'; | ||||
| import {useIntl} from "react-intl"; | import {useIntl} from "react-intl"; | ||||
| import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; | |||||
| import {PNSPS_BUTTON_THEME} from "themes/buttonConst"; | |||||
| import {ThemeProvider} from "@emotion/react"; | import {ThemeProvider} from "@emotion/react"; | ||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
| @@ -29,6 +30,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||||
| const [editMode, setEditMode] = useState(false); | const [editMode, setEditMode] = useState(false); | ||||
| const [locked, setLocked] = useState(false); | const [locked, setLocked] = useState(false); | ||||
| const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
| const [errorMsg, setErrorMsg] = useState(""); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| //if state data are ready and assign to different field | //if state data are ready and assign to different field | ||||
| @@ -57,38 +59,45 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||||
| faxNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).nullable(), | faxNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).nullable(), | ||||
| }), | }), | ||||
| onSubmit: values => { | onSubmit: values => { | ||||
| console.log(values); | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_IND_USER + "/" + formData.id, | |||||
| params: { | |||||
| prefix: values.prefix, | |||||
| enName: values.enName, | |||||
| chName: values.chName, | |||||
| idDocType: values.idDocType, | |||||
| mobileNumber: { | |||||
| countryCode: values.tel_countryCode, | |||||
| phoneNumber: values.phoneNumber | |||||
| }, | |||||
| identification: values.identification, | |||||
| checkDigit: values.checkDigit, | |||||
| faxNo: { | |||||
| countryCode: values.fax_countryCode, | |||||
| faxNumber: values.faxNumber | |||||
| }, | |||||
| emailAddress: values.emailAddress, | |||||
| address: { | |||||
| country: values.country.key, | |||||
| district: values.district.key, | |||||
| addressLine1: values.addressLine1, | |||||
| addressLine2: values.addressLine2, | |||||
| addressLine3: values.addressLine3, | |||||
| }, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess(); | |||||
| loadDataFun(); | |||||
| if (values.country==null){ | |||||
| setErrorMsg(intl.formatMessage({id: 'pleaseFillInCountry'})) | |||||
| } else { | |||||
| if (values.country.key ==1 && values.district == null){ | |||||
| setErrorMsg(intl.formatMessage({id: 'pleaseFillInDistrict'})) | |||||
| } else { | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_IND_USER + "/" + formData.id, | |||||
| params: { | |||||
| prefix: values.prefix, | |||||
| enName: values.enName, | |||||
| chName: values.chName, | |||||
| idDocType: values.idDocType, | |||||
| mobileNumber: { | |||||
| countryCode: values.tel_countryCode, | |||||
| phoneNumber: values.phoneNumber | |||||
| }, | |||||
| identification: values.identification, | |||||
| checkDigit: values.checkDigit, | |||||
| faxNo: { | |||||
| countryCode: values.fax_countryCode, | |||||
| faxNumber: values.faxNumber | |||||
| }, | |||||
| emailAddress: values.emailAddress, | |||||
| address: { | |||||
| country: values.country.key, | |||||
| district: values.district?.key, | |||||
| addressLine1: values.addressLine1, | |||||
| addressLine2: values.addressLine2, | |||||
| addressLine3: values.addressLine3, | |||||
| }, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess(); | |||||
| loadDataFun(); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| }); | |||||
| } | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -196,6 +205,13 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||||
| </Typography> | </Typography> | ||||
| <Grid item xs={12} sm={12} md={12} lg={12}> | <Grid item xs={12} sm={12} md={12} lg={12}> | ||||
| <Grid container> | <Grid container> | ||||
| <Grid item xs={12}> | |||||
| <FormHelperText error id="helper-text-address1-signup"> | |||||
| <Typography variant="errorMessage1"> | |||||
| {errorMsg} | |||||
| </Typography> | |||||
| </FormHelperText> | |||||
| </Grid> | |||||
| <Grid item xs={12} sm={12} md={12} lg={4} > | <Grid item xs={12} sm={12} md={12} lg={4} > | ||||
| {FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
| label: "Username:", | label: "Username:", | ||||
| @@ -1,6 +1,7 @@ | |||||
| // material-ui | // material-ui | ||||
| import { | import { | ||||
| Grid, Button, Typography | |||||
| Grid, Button, Typography, | |||||
| FormHelperText | |||||
| } 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"; | ||||
| @@ -28,6 +29,7 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { | |||||
| const [currentUserData, setCurrentUserData] = useState(formData); | const [currentUserData, setCurrentUserData] = useState(formData); | ||||
| const [editMode, setEditMode] = useState(false); | const [editMode, setEditMode] = useState(false); | ||||
| const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
| const [errorMsg, setErrorMsg] = useState(""); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| //if state data are ready and assign to different field | //if state data are ready and assign to different field | ||||
| @@ -53,33 +55,40 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { | |||||
| faxNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).nullable(), | faxNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).nullable(), | ||||
| }), | }), | ||||
| onSubmit: values => { | onSubmit: values => { | ||||
| console.log(values); | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_PUB_IND_USER, | |||||
| params: { | |||||
| enName: values.enName, | |||||
| chName: values.chName, | |||||
| mobileNumber: { | |||||
| countryCode: values.tel_countryCode, | |||||
| phoneNumber: values.phoneNumber | |||||
| }, | |||||
| faxNo: { | |||||
| countryCode: values.fax_countryCode, | |||||
| faxNumber: values.faxNumber | |||||
| }, | |||||
| address: { | |||||
| country: values.country.key, | |||||
| district: values.district.key, | |||||
| addressLine1: values.addressLine1, | |||||
| addressLine2: values.addressLine2, | |||||
| addressLine3: values.addressLine3, | |||||
| }, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess(); | |||||
| loadDataFun(); | |||||
| if (values.country==null){ | |||||
| setErrorMsg(intl.formatMessage({id: 'pleaseFillInCountry'})) | |||||
| } else { | |||||
| if (values.country.key ==1 && values.district == null){ | |||||
| setErrorMsg(intl.formatMessage({id: 'pleaseFillInDistrict'})) | |||||
| } else { | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_PUB_IND_USER, | |||||
| params: { | |||||
| enName: values.enName, | |||||
| chName: values.chName, | |||||
| mobileNumber: { | |||||
| countryCode: values.tel_countryCode, | |||||
| phoneNumber: values.phoneNumber | |||||
| }, | |||||
| faxNo: { | |||||
| countryCode: values.fax_countryCode, | |||||
| faxNumber: values.faxNumber | |||||
| }, | |||||
| address: { | |||||
| country: values.country.key, | |||||
| district: values.district?.key, | |||||
| addressLine1: values.addressLine1, | |||||
| addressLine2: values.addressLine2, | |||||
| addressLine3: values.addressLine3, | |||||
| }, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess(); | |||||
| loadDataFun(); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| }); | |||||
| } | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -160,6 +169,13 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { | |||||
| </Typography> | </Typography> | ||||
| <Grid item xs={12} sm={12} md={12} lg={12}> | <Grid item xs={12} sm={12} md={12} lg={12}> | ||||
| <Grid container> | <Grid container> | ||||
| <Grid item xs={12}> | |||||
| <FormHelperText error id="helper-text-address1-signup"> | |||||
| <Typography variant="errorMessage1"> | |||||
| {errorMsg} | |||||
| </Typography> | |||||
| </FormHelperText> | |||||
| </Grid> | |||||
| <Grid item xs={12} sm={12} md={12} lg={4} > | <Grid item xs={12} sm={12} md={12} lg={4} > | ||||
| {FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
| label: intl.formatMessage({id: 'userLoginName'}) + ":", | label: intl.formatMessage({id: 'userLoginName'}) + ":", | ||||