From 2f62c097a6ef193b94ac938754bbe419fb09b622 Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 18 Mar 2024 15:59:39 +0800 Subject: [PATCH] combo update --- src/pages/Organization/DetailPage/OrganizationCard.js | 4 ++-- src/pages/Organization/DetailPage/OrganizationPubCard.js | 6 +++--- src/pages/Organization/DetailPage/index.js | 6 +++--- .../DetailPage_FromUser/OrganizationCard_loadFromUser.js | 6 +++--- src/pages/Organization/DetailPage_FromUser/index.js | 6 +++--- .../UserInformationCard_Individual.js | 4 ++-- .../UserInformationCard_Individual_Pub.js | 4 ++-- src/pages/User/DetailsPage_Individual/index.js | 6 +++--- src/pages/User/DetailsPage_Organization/index.js | 6 ++---- 9 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/pages/Organization/DetailPage/OrganizationCard.js b/src/pages/Organization/DetailPage/OrganizationCard.js index 0691106..759699c 100644 --- a/src/pages/Organization/DetailPage/OrganizationCard.js +++ b/src/pages/Organization/DetailPage/OrganizationCard.js @@ -87,7 +87,7 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { if (values.country == null) { setErrorMsg(intl.formatMessage({ id: 'pleaseFillInCountry' })) } else { - if (values.country.key == 1 && values.district == null) { + if (values.country.type == "hongKong" && values.district == null) { setErrorMsg(intl.formatMessage({ id: 'pleaseFillInDistrict' })) } else { HttpUtils.post({ @@ -111,7 +111,7 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { faxNumber: values.faxNumber }, addressTemp: { - country: values.country.id, + country: values.country.type, district: values.district?.type, addressLine1: values.addressLine1, addressLine2: values.addressLine2, diff --git a/src/pages/Organization/DetailPage/OrganizationPubCard.js b/src/pages/Organization/DetailPage/OrganizationPubCard.js index 5a73e42..a83819f 100644 --- a/src/pages/Organization/DetailPage/OrganizationPubCard.js +++ b/src/pages/Organization/DetailPage/OrganizationPubCard.js @@ -65,7 +65,7 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { if (values.country==null){ setErrorMsg(intl.formatMessage({id: 'pleaseFillInCountry'})) } else { - if (values.country.key ==1 && values.district == null){ + if (values.country.type =="hongKong" && values.district == null){ setErrorMsg(intl.formatMessage({id: 'pleaseFillInDistrict'})) } else { HttpUtils.post({ @@ -81,8 +81,8 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { faxNumber: values.faxNumber }, addressTemp: { - country: values.country.id, - district: values.district?.id, + country: values.country.type, + district: values.district?.type, addressLine1: values.addressLine1, addressLine2: values.addressLine2, addressLine3: values.addressLine3, diff --git a/src/pages/Organization/DetailPage/index.js b/src/pages/Organization/DetailPage/index.js index fda1f00..d849fd8 100644 --- a/src/pages/Organization/DetailPage/index.js +++ b/src/pages/Organization/DetailPage/index.js @@ -14,7 +14,7 @@ const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/Loa import ForwardIcon from '@mui/icons-material/Forward'; import { useNavigate, useParams } from 'react-router-dom'; import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' -import {getObjectByType, getObjectByValue} from "utils/CommonFunction"; +import {getObjectByType} from "utils/CommonFunction"; import * as ComboData from "utils/ComboData"; import { isGLDLoggedIn, @@ -72,7 +72,7 @@ const OrganizationDetailPage = () => { url: UrlUtils.GET_ORG_PATH + "/" + params.id, onSuccess: function (response) { // console.log(response) - response.data["country"] = getObjectByValue(ComboData.country, "key", response.data.addressTemp?.country); + response.data["country"] = getObjectByType(ComboData.country, "type", response.data.addressTemp?.country); response.data["district"] = getObjectByType(ComboData.district, "type", response.data.addressTemp?.district); response.data["addressLine1"] = response.data.addressTemp?.addressLine1; response.data["addressLine2"] = response.data.addressTemp?.addressLine2; @@ -97,7 +97,7 @@ const OrganizationDetailPage = () => { onSuccess: function (response) { // console.log(response) response.data["creditor"] = response.data.creditor!=null?response.data.creditor?isCreditor:notCreditor:notCreditor; - response.data["country"] = getObjectByValue(ComboData.country, "key", response.data.addressTemp?.country); + response.data["country"] = getObjectByType(ComboData.country, "type", response.data.addressTemp?.country); response.data["district"] = getObjectByType(ComboData.district, "type", response.data.addressTemp?.district); response.data["addressLine1"] = response.data.addressTemp?.addressLine1; response.data["addressLine2"] = response.data.addressTemp?.addressLine2; diff --git a/src/pages/Organization/DetailPage_FromUser/OrganizationCard_loadFromUser.js b/src/pages/Organization/DetailPage_FromUser/OrganizationCard_loadFromUser.js index 9f67e23..733b3f3 100644 --- a/src/pages/Organization/DetailPage_FromUser/OrganizationCard_loadFromUser.js +++ b/src/pages/Organization/DetailPage_FromUser/OrganizationCard_loadFromUser.js @@ -75,7 +75,7 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { if (values.country == null) { setErrorMsg(intl.formatMessage({ id: 'pleaseFillInCountry' })) } else { - if (values.country.key == 1 && values.district == null) { + if (values.country.type == "hongKong" && values.district == null) { setErrorMsg(intl.formatMessage({ id: 'pleaseFillInDistrict' })) } else { HttpUtils.post({ @@ -100,8 +100,8 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { faxNumber: values.faxNumber }, addressTemp: { - country: values.country.key, - district: values.district?.key, + country: values.country.type, + district: values.district?.type, addressLine1: values.addressLine1, addressLine2: values.addressLine2, addressLine3: values.addressLine3, diff --git a/src/pages/Organization/DetailPage_FromUser/index.js b/src/pages/Organization/DetailPage_FromUser/index.js index 17afd41..5f88e64 100644 --- a/src/pages/Organization/DetailPage_FromUser/index.js +++ b/src/pages/Organization/DetailPage_FromUser/index.js @@ -7,7 +7,7 @@ import {useParams} from "react-router-dom"; import {useNavigate} from "react-router-dom"; import * as UrlUtils from "utils/ApiPathConst"; import * as DateUtils from "utils/DateUtils"; -import {getObjectByValue} from "utils/CommonFunction"; +import {getObjectByType} from "utils/CommonFunction"; import * as ComboData from "utils/ComboData"; import Loadable from 'components/Loadable'; @@ -46,8 +46,8 @@ const OrganizationDetailPage_FromUser = () => { HttpUtils.get({ url: UrlUtils.GET_ORG_FROM_USER_PATH+"/"+params.id, onSuccess: function(response){ - response.data["country"] = getObjectByValue(ComboData.country, "key", response.data.addressTemp?.country); - response.data["district"] = getObjectByValue(ComboData.district, "key", response.data.addressTemp?.district); + response.data["country"] = getObjectByType(ComboData.country, "type", response.data.addressTemp?.country); + response.data["district"] = getObjectByType(ComboData.district, "type", response.data.addressTemp?.district); response.data["addressLine1"] = response.data.addressTemp?.addressLine1; response.data["addressLine2"] = response.data.addressTemp?.addressLine2; response.data["addressLine3"] = response.data.addressTemp?.addressLine3; diff --git a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js index 8e7acf3..b724fdf 100644 --- a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js +++ b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js @@ -67,7 +67,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { if (values.country==null){ setErrorMsg(intl.formatMessage({id: 'pleaseFillInCountry'})) } else { - if (values.country.key ==1 && values.district == null){ + if (values.country.type == "hongKong" && values.district == null){ setErrorMsg(intl.formatMessage({id: 'pleaseFillInDistrict'})) } else { HttpUtils.post({ @@ -89,7 +89,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { }, emailAddress: values.emailAddress, address: { - country: values.country.key, + country: values.country.type, district: values.district?.type, addressLine1: values.addressLine1, addressLine2: values.addressLine2, diff --git a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js index 5b1d456..56c9e1d 100644 --- a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js +++ b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js @@ -70,7 +70,7 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { if (values.country==null){ setErrorMsg(intl.formatMessage({id: 'pleaseFillInCountry'})) } else { - if (values.country.key ==1 && values.district == null){ + if (values.country.type == "hongKong" && values.district == null){ setErrorMsg(intl.formatMessage({id: 'pleaseFillInDistrict'})) } else { HttpUtils.post({ @@ -87,7 +87,7 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { faxNumber: values.faxNumber }, address: { - country: values.country.key, + country: values.country.type, district: values.district?.type, addressLine1: values.addressLine1, addressLine2: values.addressLine2, diff --git a/src/pages/User/DetailsPage_Individual/index.js b/src/pages/User/DetailsPage_Individual/index.js index 81c9f0e..1a58ad0 100644 --- a/src/pages/User/DetailsPage_Individual/index.js +++ b/src/pages/User/DetailsPage_Individual/index.js @@ -23,7 +23,7 @@ const BackgroundHead = { } import Loadable from 'components/Loadable'; import { useNavigate } from "react-router-dom"; -import {getObjectByValue,getObjectByType} from "utils/CommonFunction"; +import {getObjectByType} from "utils/CommonFunction"; import * as ComboData from "utils/ComboData"; const LoadingComponent = Loadable(React.lazy(() => import('../../extra-pages/LoadingComponent'))); const UserInformationCard = Loadable(React.lazy(() => import('./UserInformationCard_Individual'))); @@ -75,7 +75,7 @@ const UserMaintainPage_Individual = () => { response.data["modifieDate"] = modifiedBy; response.data["verifiedStatus"] = response.data.verifiedBy ? DateUtils.datetimeStr(response.data.verifiedDate) + ", " + response.data.verifiedByName : "Not Verified"; - response.data["country"] = getObjectByValue(ComboData.country, "key", response.data.address?.country); + response.data["country"] = getObjectByType(ComboData.country, "type", response.data.address?.country); response.data["district"] = getObjectByType(ComboData.district, "type", response.data.address?.district); response.data["addressLine1"] = response.data.address?.addressLine1; response.data["addressLine2"] = response.data.address?.addressLine2; @@ -103,7 +103,7 @@ const UserMaintainPage_Individual = () => { response.data["mobileNumber"] = JSON.parse(response.data["mobileNumber"]); response.data["faxNo"] = JSON.parse(response.data["faxNo"]); - response.data["country"] = getObjectByValue(ComboData.country, "key", response.data.address?.country); + response.data["country"] = getObjectByType(ComboData.country, "type", response.data.address?.country); response.data["district"] = getObjectByType(ComboData.district, "type", response.data.address?.district); response.data["addressLine1"] = response.data.address?.addressLine1; response.data["addressLine2"] = response.data.address?.addressLine2; diff --git a/src/pages/User/DetailsPage_Organization/index.js b/src/pages/User/DetailsPage_Organization/index.js index b2876d2..b3002dd 100644 --- a/src/pages/User/DetailsPage_Organization/index.js +++ b/src/pages/User/DetailsPage_Organization/index.js @@ -21,7 +21,7 @@ import ForwardIcon from '@mui/icons-material/Forward'; import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' import { useNavigate } from 'react-router-dom'; import * as ComboData from "utils/ComboData"; -import {getObjectByValue,getObjectByType} from "utils/CommonFunction"; +import {getObjectByType} from "utils/CommonFunction"; const LoginGrid = Loadable(React.lazy(() => import('./LoginGrid'))); const BackgroundHead = { @@ -135,9 +135,7 @@ const UserMaintainPage_Organization = () => { response.data["verifiedStatus"] = response.data.verifiedBy ? DateUtils.datetimeStr(response.data.verifiedDate) + ", " + response.data.verifiedByName : "Not Verified"; response.data["lastLoginDate"] = response.data.lastLogin ? DateUtils.datetimeStr(response.data.lastLoginDate) : ""; - // console.log(getObjectByValue(ComboData.country, "key", response.data.addressBus?.country)) - // console.log(getObjectByValue(ComboData.country, "key", response.data.addressBus?.district)) - response.data["country"] = getObjectByValue(ComboData.country, "key", response.data.addressBus?.country); + response.data["country"] = getObjectByType(ComboData.country, "type", response.data.addressBus?.country); response.data["district"] = getObjectByType(ComboData.district, "type", response.data.addressBus?.district); response.data["addressLine1"] = response.data.addressBus?.addressLine1; response.data["addressLine2"] = response.data.addressBus?.addressLine2;