From 3eb24add8b0f28d446c6bd51a2b1958d8f113760 Mon Sep 17 00:00:00 2001 From: print-signs Date: Tue, 5 Dec 2023 13:37:44 +0530 Subject: [PATCH] updated address section --- package.json | 2 +- src/views/configuration/Address.js | 56 +++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 434b89e..7491c06 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "license": "MIT", "author": "The CoreUI Team (https://github.com/orgs/coreui/people)", "scripts": { - "dev": "react-scripts start", + "dev": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start", "build": "react-scripts build", "build:n17": "react-scripts --openssl-legacy-provider build", "changelog": "auto-changelog --starting-version 4.1.0 --commit-limit false --hide-credit", diff --git a/src/views/configuration/Address.js b/src/views/configuration/Address.js index e639604..d82590c 100644 --- a/src/views/configuration/Address.js +++ b/src/views/configuration/Address.js @@ -18,6 +18,8 @@ function Address() { const [website, setWebsite] = useState(""); const [contact, setContact] = useState(""); const [email, setEmail] = useState(""); + const [latitude, setLatitude] = useState(""); + const [longitude, setLongitude] = useState(""); useEffect(() => { async function getConfiguration() { @@ -37,6 +39,8 @@ function Address() { setWebsite(el.website); setContact(el.contact); setEmail(el.email); + setLatitude(el.latitude); + setLongitude(el.longitude); }); }); } @@ -61,10 +65,30 @@ function Address() { setContact(e.target.value); } else if (e.target.name.toLowerCase() === "email") { setEmail(e.target.value); + } else if (e.target.name.toLowerCase() === "latitude") { + setLatitude(e.target.value); + } else if (e.target.name.toLowerCase() === "longitude") { + setLongitude(e.target.value); } } async function handelSubmit() { setLoading(true); + if ( + !company || + !address || + !city || + !state || + !country || + !pincode || + !website || + !contact || + !email || + !longitude || + !latitude + ) { + setLoading(false); + return swal("Fill all the required filed!"); + } let data = { company, address, @@ -75,6 +99,8 @@ function Address() { website, contact, email, + longitude, + latitude, }; let res = await axios.post(`/api/config/address`, data, { @@ -82,10 +108,10 @@ function Address() { Authorization: `Bearer ${token}`, }, }); - console.log(res); if (res) { setLoading(false); + console.log(res); swal("Success!", res.data.message); } else { @@ -238,6 +264,34 @@ function Address() { className="form-control input-field " id="basicpill-phoneno-input" /> + + handelChange(e)} + className="form-control input-field " + id="basicpill-phoneno-input" + /> + + handelChange(e)} + className="form-control input-field " + id="basicpill-phoneno-input" + />