|
|
@@ -1,6 +1,6 @@ |
|
|
|
// material-ui |
|
|
|
import { |
|
|
|
Grid, Button, |
|
|
|
Grid, Button, |
|
|
|
// Checkbox, FormControlLabel, |
|
|
|
Typography, |
|
|
|
Dialog, DialogTitle, DialogContent, DialogActions, |
|
|
@@ -20,9 +20,9 @@ const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingCo |
|
|
|
import Loadable from 'components/Loadable'; |
|
|
|
import { lazy } from 'react'; |
|
|
|
import { notifySaveSuccess } from 'utils/CommonFunction'; |
|
|
|
import {FormattedMessage, useIntl} from "react-intl"; |
|
|
|
import {PNSPS_BUTTON_THEME} from "themes/buttonConst"; |
|
|
|
import {ThemeProvider} from "@emotion/react"; |
|
|
|
import { FormattedMessage, useIntl } from "react-intl"; |
|
|
|
import { PNSPS_BUTTON_THEME } from "themes/buttonConst"; |
|
|
|
import { ThemeProvider } from "@emotion/react"; |
|
|
|
|
|
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
|
|
|
|
@@ -54,19 +54,19 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
enableReinitialize: true, |
|
|
|
initialValues: currentUserData, |
|
|
|
validationSchema: yup.object().shape({ |
|
|
|
addressLine1: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({id: 'validateAddressLine1'}))), |
|
|
|
addressLine2: yup.string().max(40, displayErrorMsg(intl.formatMessage({id: 'noMoreThen40Words'}))), |
|
|
|
addressLine3: yup.string().max(40, displayErrorMsg(intl.formatMessage({id: 'noMoreThen40Words'}))), |
|
|
|
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'}))), |
|
|
|
addressLine1: yup.string().max(40).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine1' }))), |
|
|
|
addressLine2: yup.string().max(40, displayErrorMsg(intl.formatMessage({ id: 'noMoreThen40Words' }))), |
|
|
|
addressLine3: yup.string().max(40, displayErrorMsg(intl.formatMessage({ id: 'noMoreThen40Words' }))), |
|
|
|
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' }))), |
|
|
|
faxNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'require8Number' }))).nullable(), |
|
|
|
}), |
|
|
|
onSubmit: values => { |
|
|
|
if (values.country==null){ |
|
|
|
setErrorMsg(intl.formatMessage({id: 'pleaseFillInCountry'})) |
|
|
|
if (values.country == null) { |
|
|
|
setErrorMsg(intl.formatMessage({ id: 'pleaseFillInCountry' })) |
|
|
|
} else { |
|
|
|
if (values.country.type =="hongKong" && values.district == null){ |
|
|
|
setErrorMsg(intl.formatMessage({id: 'pleaseFillInDistrict'})) |
|
|
|
if (values.country.type == "hongKong" && values.district == null) { |
|
|
|
setErrorMsg(intl.formatMessage({ id: 'pleaseFillInDistrict' })) |
|
|
|
} else { |
|
|
|
HttpUtils.post({ |
|
|
|
url: UrlUtils.POST_PUB_ORG_SAVE_PATH, |
|
|
@@ -100,9 +100,9 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
|
useEffect(() => { |
|
|
|
setEditModeFun(editMode); |
|
|
|
},[editMode]); |
|
|
|
}, [editMode]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (Object.keys(userData).length > 0) { |
|
|
@@ -188,7 +188,7 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
onClick={onEditClick} |
|
|
|
color="success" |
|
|
|
> |
|
|
|
< FormattedMessage id="edit" /> |
|
|
|
< FormattedMessage id="edit" /> |
|
|
|
</Button> |
|
|
|
</ThemeProvider> |
|
|
|
</Grid> |
|
|
@@ -202,11 +202,11 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
<LoadingComponent /> |
|
|
|
: |
|
|
|
<Grid container spacing={1}> |
|
|
|
<Grid item xs={12}> |
|
|
|
{/* <Grid item xs={12}> |
|
|
|
<Typography variant="h4" sx={{ mb: 2, mr: 3, borderBottom: "1px solid black" }}> |
|
|
|
<FormattedMessage id="organizationDetails" /> |
|
|
|
</Typography> |
|
|
|
</Grid> |
|
|
|
</Grid> */} |
|
|
|
<Grid item xs={12}> |
|
|
|
<FormHelperText error id="helper-text-address1-signup"> |
|
|
|
<Typography variant="errorMessage1"> |
|
|
@@ -216,27 +216,27 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12} lg={4} > |
|
|
|
{FieldUtils.getTextField({ |
|
|
|
label: intl.formatMessage({id: 'brNo'}) + ":", |
|
|
|
label: intl.formatMessage({ id: 'brNo' }) + ":", |
|
|
|
valueName: "brNo", |
|
|
|
disabled: true, |
|
|
|
form: formik |
|
|
|
})} |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12} lg={4} > |
|
|
|
{/* {FieldUtils.getTextField({ |
|
|
|
label: intl.formatMessage({id: 'creditorAccount'}) + ":", |
|
|
|
valueName: "creditor", |
|
|
|
disabled: true, |
|
|
|
form: formik |
|
|
|
})} */} |
|
|
|
|
|
|
|
{FieldUtils.getTextField({ |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({ id: 'expiryDate' }) + ":"), |
|
|
|
valueName: "brExpiryDate", |
|
|
|
disabled: true, |
|
|
|
form: formik |
|
|
|
})} |
|
|
|
|
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} lg={4} ></Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} lg={4} > |
|
|
|
{FieldUtils.getTextField({ |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({id: 'nameEng'}) + ":"), |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({ id: 'nameEng' }) + ":"), |
|
|
|
valueName: "enCompanyName", |
|
|
|
disabled: true, |
|
|
|
form: formik |
|
|
@@ -245,7 +245,7 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
|
|
|
|
<Grid item xs={12} lg={4} > |
|
|
|
{FieldUtils.getTextField({ |
|
|
|
label: intl.formatMessage({id: 'nameChi'}) + ":", |
|
|
|
label: intl.formatMessage({ id: 'nameChi' }) + ":", |
|
|
|
valueName: "chCompanyName", |
|
|
|
disabled: true, |
|
|
|
form: formik |
|
|
@@ -253,17 +253,12 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} lg={4} > |
|
|
|
{FieldUtils.getTextField({ |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({id: 'expiryDate'}) + ":"), |
|
|
|
valueName: "brExpiryDate", |
|
|
|
disabled: true, |
|
|
|
form: formik |
|
|
|
})} |
|
|
|
|
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} lg={4} > |
|
|
|
{FieldUtils.getTextField({ |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({id: 'contactPerson'}) + ":"), |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({ id: 'contactPerson' }) + ":"), |
|
|
|
valueName: "contactPerson", |
|
|
|
disabled: (!editMode && !createMode), |
|
|
|
form: formik |
|
|
@@ -272,7 +267,7 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
|
|
|
|
<Grid item xs={12} lg={4} > |
|
|
|
{FieldUtils.getPhoneField({ |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({id: 'userContactNumber'}) + ":"), |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({ id: 'userContactNumber' }) + ":"), |
|
|
|
valueName: { |
|
|
|
code: "tel_countryCode", |
|
|
|
num: "phoneNumber" |
|
|
@@ -284,7 +279,7 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
|
|
|
|
<Grid item xs={12} lg={4} > |
|
|
|
{FieldUtils.getPhoneField({ |
|
|
|
label: intl.formatMessage({id: 'contactFaxNumber'}) + ":", |
|
|
|
label: intl.formatMessage({ id: 'contactFaxNumber' }) + ":", |
|
|
|
valueName: { |
|
|
|
code: "fax_countryCode", |
|
|
|
num: "faxNumber" |
|
|
@@ -296,22 +291,22 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
|
|
|
|
<Grid item xs={12} lg={4} > |
|
|
|
{FieldUtils.getComboField({ |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({id: 'country'}) + ":"), |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({ id: 'country' }) + ":"), |
|
|
|
valueName: "country", |
|
|
|
disabled: (!editMode && !createMode), |
|
|
|
dataList: ComboData.country, |
|
|
|
getOptionLabel: (option) => option.type? intl.formatMessage({ id: option.type }) : "", |
|
|
|
getOptionLabel: (option) => option.type ? intl.formatMessage({ id: option.type }) : "", |
|
|
|
form: formik |
|
|
|
})} |
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} lg={4} > |
|
|
|
{FieldUtils.getComboField({ |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({id: 'district'}) + ":"), |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({ id: 'district' }) + ":"), |
|
|
|
valueName: "district", |
|
|
|
disabled: (!editMode && !createMode), |
|
|
|
dataList: ComboData.district, |
|
|
|
getOptionLabel: (option) => option.type? intl.formatMessage({ id: option.type }) : "", |
|
|
|
getOptionLabel: (option) => option.type ? intl.formatMessage({ id: option.type }) : "", |
|
|
|
form: formik |
|
|
|
})} |
|
|
|
</Grid> |
|
|
@@ -319,7 +314,7 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
|
|
|
|
<Grid item xs={12} lg={12} > |
|
|
|
{FieldUtils.getAddressField({ |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({id: 'formAddress'}) + ":"), |
|
|
|
label: FieldUtils.notNullFieldLabel(intl.formatMessage({ id: 'formAddress' }) + ":"), |
|
|
|
valueName: ["addressLine1", "addressLine2", "addressLine3"], |
|
|
|
disabled: (!editMode && !createMode), |
|
|
|
form: formik |
|
|
@@ -348,7 +343,7 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
<Typography variant="h4" style={{ padding: '16px' }}>Are you sure mark as Credit Client?</Typography> |
|
|
|
</DialogContent> |
|
|
|
<DialogActions> |
|
|
|
<Button onClick={() => setCreditorConfirmPopUp(false)}><Typography variant="h5">Cancel</Typography></Button> |
|
|
|
<Button onClick={() => setCreditorConfirmPopUp(false)}><Typography variant="h5">Cancel</Typography></Button> |
|
|
|
<Button onClick={() => markAsCreditor()}><Typography variant="h5">Confirm</Typography></Button> |
|
|
|
</DialogActions> |
|
|
|
</Dialog> |
|
|
@@ -370,7 +365,7 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { |
|
|
|
<Typography variant="h4" style={{ padding: '16px' }}>Are you sure mark as Non-Credit Client?</Typography> |
|
|
|
</DialogContent> |
|
|
|
<DialogActions> |
|
|
|
<Button onClick={() => setNonCreditorConfirmPopUp(false)}><Typography variant="h5">Cancel</Typography></Button> |
|
|
|
<Button onClick={() => setNonCreditorConfirmPopUp(false)}><Typography variant="h5">Cancel</Typography></Button> |
|
|
|
<Button onClick={() => markAsNonCreditor()}><Typography variant="h5">Confirm</Typography></Button> |
|
|
|
</DialogActions> |
|
|
|
</Dialog> |
|
|
|