| @@ -36,7 +36,6 @@ const ClientDetailCard = ( | |||||
| ) => { | ) => { | ||||
| // const params = useParams(); | // const params = useParams(); | ||||
| const [currentApplicationDetailData, setCurrentApplicationDetailData] = useState({}); | const [currentApplicationDetailData, setCurrentApplicationDetailData] = useState({}); | ||||
| const [orgDetailData, setOrgDetailData] = useState({}); | |||||
| const [brExpiryDate,setBrExpiryDate] = useState(""); | const [brExpiryDate,setBrExpiryDate] = useState(""); | ||||
| const [brNo,setBrNo] = useState(""); | const [brNo,setBrNo] = useState(""); | ||||
| const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
| @@ -50,40 +49,48 @@ const ClientDetailCard = ( | |||||
| //if user data from parent are not null | //if user data from parent are not null | ||||
| if (Object.keys(applicationDetailData).length > 0 && applicationDetailData !== undefined) { | if (Object.keys(applicationDetailData).length > 0 && applicationDetailData !== undefined) { | ||||
| setCurrentApplicationDetailData(applicationDetailData.userData); | setCurrentApplicationDetailData(applicationDetailData.userData); | ||||
| if (!applicationDetailData.orgDetail == null){ | |||||
| setOrgDetailData(applicationDetailData.orgDetail.data); | |||||
| } | |||||
| if (!applicationDetailData.companyName1 == null) { | |||||
| setCompanyName(applicationDetailData.companyName); | |||||
| } else { | |||||
| if (applicationDetailData.orgDetail != null){ | |||||
| var orgDetail = applicationDetailData.orgDetail?.data; | |||||
| setBrExpiryDate(DateUtils.dateValue(orgDetail?.brExpiryDate)); | |||||
| setBrNo(orgDetail?.brNo); | |||||
| const companyNameData = { | const companyNameData = { | ||||
| enCompanyName: applicationDetailData.userData.enCompanyName, | |||||
| chCompanyName: applicationDetailData.userData.chCompanyName | |||||
| enCompanyName: orgDetail?.enCompanyName, | |||||
| chCompanyName: orgDetail?.chCompanyName | |||||
| } | |||||
| setCompanyName(companyNameData) | |||||
| }else{ | |||||
| var userData = applicationDetailData.userData; | |||||
| setBrExpiryDate(DateUtils.dateValue(userData?.brExpiryDate)); | |||||
| setBrNo(userData?.brNo); | |||||
| const companyNameData = { | |||||
| enCompanyName: userData?.enCompanyName, | |||||
| chCompanyName: userData?.chCompanyName | |||||
| } | } | ||||
| setCompanyName(companyNameData) | setCompanyName(companyNameData) | ||||
| } | } | ||||
| setOnReady(true); | |||||
| } | } | ||||
| }, [applicationDetailData]); | }, [applicationDetailData]); | ||||
| useEffect(() => { | |||||
| //if state data are ready and assign to different field | |||||
| // console.log(currentApplicationDetailData) | |||||
| if (Object.keys(currentApplicationDetailData).length > 0) { | |||||
| if( currentApplicationDetailData.orgId!=null){ | |||||
| if (Object.keys(orgDetailData).length > 0) { | |||||
| setBrExpiryDate(DateUtils.dateValue(orgDetailData.brExpiryDate)); | |||||
| setBrNo(orgDetailData.brNo); | |||||
| setOnReady(true); | |||||
| }else{ | |||||
| setBrExpiryDate(DateUtils.dateValue(currentApplicationDetailData.brExpiryDate)); | |||||
| setBrNo(currentApplicationDetailData.brNo); | |||||
| setOnReady(true); | |||||
| } | |||||
| }else{ | |||||
| setOnReady(true); | |||||
| } | |||||
| } | |||||
| }, [currentApplicationDetailData]); | |||||
| // useEffect(() => { | |||||
| // //if state data are ready and assign to different field | |||||
| // // console.log(currentApplicationDetailData) | |||||
| // if (Object.keys(currentApplicationDetailData).length > 0) { | |||||
| // if( currentApplicationDetailData.orgId!=null){ | |||||
| // if (Object.keys(orgDetailData).length > 0) { | |||||
| // setBrExpiryDate(DateUtils.dateValue(orgDetailData.brExpiryDate)); | |||||
| // setBrNo(orgDetailData.brNo); | |||||
| // setOnReady(true); | |||||
| // }else{ | |||||
| // setBrExpiryDate(DateUtils.dateValue(currentApplicationDetailData.brExpiryDate)); | |||||
| // setBrNo(currentApplicationDetailData.brNo); | |||||
| // setOnReady(true); | |||||
| // } | |||||
| // }else{ | |||||
| // setOnReady(true); | |||||
| // } | |||||
| // } | |||||
| // }, [currentApplicationDetailData, orgDetailData]); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| if (brNo != undefined && brNo.length > 0) { | if (brNo != undefined && brNo.length > 0) { | ||||