From 3c3538a3efdd35b79461d8cf028ba33a880f25e8 Mon Sep 17 00:00:00 2001 From: emmanuelnegash Date: Wed, 15 Feb 2023 13:13:12 +0300 Subject: [PATCH 1/3] organization details fix --- src/Components/signup/OrgRightside.js | 45 ++++++++++++++++----------- src/Views/Login/Login.js | 7 ++--- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/Components/signup/OrgRightside.js b/src/Components/signup/OrgRightside.js index 1c4277c00..b247ec20d 100644 --- a/src/Components/signup/OrgRightside.js +++ b/src/Components/signup/OrgRightside.js @@ -48,7 +48,10 @@ export default function OrgRightside(props) { // // const [orgdeserror, serorgdeserror] = useState(false); const [orgdesc, setorgdesc] = useState(""); const [isLoader, setIsLoader] = useState(false); - console.log( props.validOrgNumber, "KAKAKSANDKJDHBUDSBJVDSIUVBFSUYCBDSIUVDWBVDSBCVISDJFVYUDBDSIU") + console.log( + props.validOrgNumber, + "KAKAKSANDKJDHBUDSBJVDSIUVBFSUYCBDSIUVDWBVDSBCVISDJFVYUDBDSIU" + ); const [editorValue, setEditorValue] = React.useState( RichTextEditor.createValueFromString(orgdesc, "html") @@ -83,13 +86,18 @@ export default function OrgRightside(props) { // let addressdata=JSON.parse(response.data.organization.address) if (response.data.organization) { props.setOrgName(response.data.organization.name); + props.setOrgMail(response.data.organization.org_email); + props.setOrgWebsite(response.data.organization.website); + props.setOrgAddress(response.data.organization.address.address); + props.setCountryValue(response.data.organization.address.country); + props.setValidOrgnumber(response.data.organization.phone_number); + props.setOrgPincode(response.data.organization.address.pincode); if ( response.data.organization.name && response.data.organization.name.trim().length > 0 ) { props.setisOrgnameerror(false); } - props.setOrgMail(response.data.organization.org_email); if ( response.data.organization.org_email && response.data.organization.org_email.trim().length > 0 @@ -97,20 +105,16 @@ export default function OrgRightside(props) { props.setisOrgmailerror(false); props.setOrgemailbtn(true); } - props.setOrgWebsite(response.data.organization.website); + if ( response.data.organization.website && response.data.organization.website.trim().length > 0 ) { props.isOrgWebsiteerror(false); } - props.setValidOrgnumber(response.data.organization.phone_number ? response.data.organization.phone_number : ""); + if (response.data.organization.address) { - props.setOrgAddress(response.data.organization.address.address); props.setOrgCity(response.data.organization.address.city); - props.setCountryValue(response.data.organization.address.country); - props.setOrgPincode(response.data.organization.address.pincode); - if ( response.data.organization.address.address && response.data.organization.address.address.trim().length > 0 @@ -606,7 +610,8 @@ export default function OrgRightside(props) { value={props.countryvalue} onChange={props.countrychangeHandler} isSearchable={true} - label="Country"> + label="Country" + > {options.map((rowData, index) => ( {rowData.label} ))} @@ -635,16 +640,16 @@ export default function OrgRightside(props) { style={{ width: "420px", zIndex: 0 }} value={props.orgPincode} onKeyUp={() => - props.orgPincode == "" + props.orgPincode === "" ? props.setispincodeerror(true) : props.setispincodeerror(false) } onKeyDown={(e) => { if ( - e.key == "-" || - e.key == "e" || - e.key == "E" || - e.key == "+" + e.key === "-" || + e.key === "e" || + e.key === "E" || + e.key === "+" ) { e.preventDefault(); } @@ -726,7 +731,8 @@ export default function OrgRightside(props) { fontWeight: "400", fontSize: "12px", lineHeight: "16px", - }}> + }} + > {props.orgDescriptionErrorMessage ? props.orgDescriptionErrorMessage : ""} @@ -813,7 +819,8 @@ export default function OrgRightside(props) { onClick={props.handleOrgSubmit} variant="contained" className="orgbtn" - type="submit"> + type="submit" + > Next ) : ( @@ -828,7 +835,8 @@ export default function OrgRightside(props) { variant="outlined" className="finishlaterorgbtn" type="button" - onClick={props.finishLaterOrgScreen}> + onClick={props.finishLaterOrgScreen} + > Finish later @@ -840,7 +848,8 @@ export default function OrgRightside(props) { width={150} height={127} fill="none" - xmlns="http://www.w3.org/2000/svg"> + xmlns="http://www.w3.org/2000/svg" + > diff --git a/src/Views/Login/Login.js b/src/Views/Login/Login.js index 0712471bd..f0e07f513 100644 --- a/src/Views/Login/Login.js +++ b/src/Views/Login/Login.js @@ -44,6 +44,7 @@ import RegexConstants from "../../Constants/RegexConstants"; import LeftintroParticipant from "../../Components/intros/LeftIntroParticipant"; import LocalStorageConstants from "../../Constants/LocalStorageConstants"; import AddingCategory from "../../Components/Catergories/AddingCategory"; +import { ConsoleSqlOutlined } from "@ant-design/icons"; export default function Login(props) { const [button, setButton] = useState(false); const email = useRef(); @@ -593,10 +594,9 @@ export default function Login(props) { // ); const [textEditorValue, settextEditorValue] = useState(""); - const [validOrgNumber, setValidOrgnumber] = useState(""); + const [validOrgNumber, setValidOrgnumber] = useState(''); const [orgfile, setorgfile] = useState(null); const [orgmail, setOrgMail] = useState(""); - const [Orgnamebtn, setOrgnamebtn] = useState(false); const [Orgemailbtn, setOrgemailbtn] = useState(false); const [Orgaddressbtn, setOrgaddressbtn] = useState(false); @@ -650,7 +650,6 @@ export default function Login(props) { // const pinCode = pincode.current.value; const finalpinCode = orgPincode; - var id = getUserLocal(); console.log("user id", id); @@ -795,8 +794,6 @@ export default function Login(props) { }; const handleOrgnumber = (value) => { - console.log(value); - setValidOrgnumber(value ? value : ""); }; From 2d1a8050c6675a342a1d12ac5ad424ee34ef4dd8 Mon Sep 17 00:00:00 2001 From: emmanuelnegash Date: Wed, 15 Feb 2023 19:47:26 +0300 Subject: [PATCH 2/3] address conditional check before state setting --- src/Components/signup/OrgRightside.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Components/signup/OrgRightside.js b/src/Components/signup/OrgRightside.js index b247ec20d..5738ca9c4 100644 --- a/src/Components/signup/OrgRightside.js +++ b/src/Components/signup/OrgRightside.js @@ -88,7 +88,8 @@ export default function OrgRightside(props) { props.setOrgName(response.data.organization.name); props.setOrgMail(response.data.organization.org_email); props.setOrgWebsite(response.data.organization.website); - props.setOrgAddress(response.data.organization.address.address); + if (response.data.organization.address.address) + props.setOrgAddress(response.data.organization.address.address); props.setCountryValue(response.data.organization.address.country); props.setValidOrgnumber(response.data.organization.phone_number); props.setOrgPincode(response.data.organization.address.pincode); From 50f676b21e6ea41eec1e07cfaec86b911df8d060 Mon Sep 17 00:00:00 2001 From: emmanuelnegash Date: Thu, 16 Feb 2023 10:46:52 +0300 Subject: [PATCH 3/3] organizational details based on conditions fix --- src/Components/signup/OrgRightside.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Components/signup/OrgRightside.js b/src/Components/signup/OrgRightside.js index 5738ca9c4..24d963bf7 100644 --- a/src/Components/signup/OrgRightside.js +++ b/src/Components/signup/OrgRightside.js @@ -82,17 +82,15 @@ export default function OrgRightside(props) { ) .then((response) => { setIsLoader(false); - console.log("org data: ", response.data); // let addressdata=JSON.parse(response.data.organization.address) if (response.data.organization) { - props.setOrgName(response.data.organization.name); - props.setOrgMail(response.data.organization.org_email); - props.setOrgWebsite(response.data.organization.website); - if (response.data.organization.address.address) - props.setOrgAddress(response.data.organization.address.address); - props.setCountryValue(response.data.organization.address.country); - props.setValidOrgnumber(response.data.organization.phone_number); - props.setOrgPincode(response.data.organization.address.pincode); + props.setOrgName(response?.data?.organization?.name); + props.setOrgMail(response?.data?.organization?.org_email); + props.setOrgWebsite(response?.data?.organization?.website); + props.setOrgAddress(response?.data?.organization?.address?.address || JSON.parse(response?.data?.organization?.address)?.address); + props.setCountryValue(response?.data?.organization?.address?.country || JSON.parse(response?.data?.organization?.address)?.country) + props.setValidOrgnumber(response?.data?.user?.phone_number); + props.setOrgPincode(response?.data?.organization?.address?.pincode || JSON.parse(response?.data?.organization?.address)?.pincode) if ( response.data.organization.name && response.data.organization.name.trim().length > 0