updated address section
This commit is contained in:
parent
3a3bd79d2f
commit
3eb24add8b
@ -13,7 +13,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
|
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "react-scripts start",
|
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"build:n17": "react-scripts --openssl-legacy-provider build",
|
"build:n17": "react-scripts --openssl-legacy-provider build",
|
||||||
"changelog": "auto-changelog --starting-version 4.1.0 --commit-limit false --hide-credit",
|
"changelog": "auto-changelog --starting-version 4.1.0 --commit-limit false --hide-credit",
|
||||||
|
@ -18,6 +18,8 @@ function Address() {
|
|||||||
const [website, setWebsite] = useState("");
|
const [website, setWebsite] = useState("");
|
||||||
const [contact, setContact] = useState("");
|
const [contact, setContact] = useState("");
|
||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
|
const [latitude, setLatitude] = useState("");
|
||||||
|
const [longitude, setLongitude] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getConfiguration() {
|
async function getConfiguration() {
|
||||||
@ -37,6 +39,8 @@ function Address() {
|
|||||||
setWebsite(el.website);
|
setWebsite(el.website);
|
||||||
setContact(el.contact);
|
setContact(el.contact);
|
||||||
setEmail(el.email);
|
setEmail(el.email);
|
||||||
|
setLatitude(el.latitude);
|
||||||
|
setLongitude(el.longitude);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -61,10 +65,30 @@ function Address() {
|
|||||||
setContact(e.target.value);
|
setContact(e.target.value);
|
||||||
} else if (e.target.name.toLowerCase() === "email") {
|
} else if (e.target.name.toLowerCase() === "email") {
|
||||||
setEmail(e.target.value);
|
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() {
|
async function handelSubmit() {
|
||||||
setLoading(true);
|
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 = {
|
let data = {
|
||||||
company,
|
company,
|
||||||
address,
|
address,
|
||||||
@ -75,6 +99,8 @@ function Address() {
|
|||||||
website,
|
website,
|
||||||
contact,
|
contact,
|
||||||
email,
|
email,
|
||||||
|
longitude,
|
||||||
|
latitude,
|
||||||
};
|
};
|
||||||
|
|
||||||
let res = await axios.post(`/api/config/address`, data, {
|
let res = await axios.post(`/api/config/address`, data, {
|
||||||
@ -82,10 +108,10 @@ function Address() {
|
|||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
swal("Success!", res.data.message);
|
swal("Success!", res.data.message);
|
||||||
} else {
|
} else {
|
||||||
@ -238,6 +264,34 @@ function Address() {
|
|||||||
className="form-control input-field "
|
className="form-control input-field "
|
||||||
id="basicpill-phoneno-input"
|
id="basicpill-phoneno-input"
|
||||||
/>
|
/>
|
||||||
|
<label
|
||||||
|
htmlFor="basicpill-phoneno-input"
|
||||||
|
className="label-100 mt-3"
|
||||||
|
>
|
||||||
|
Latitude
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
value={latitude}
|
||||||
|
type="text"
|
||||||
|
name="latitude"
|
||||||
|
onChange={(e) => handelChange(e)}
|
||||||
|
className="form-control input-field "
|
||||||
|
id="basicpill-phoneno-input"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
htmlFor="basicpill-phoneno-input"
|
||||||
|
className="label-100 mt-3"
|
||||||
|
>
|
||||||
|
Longitude
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
value={longitude}
|
||||||
|
type="text"
|
||||||
|
name="longitude"
|
||||||
|
onChange={(e) => handelChange(e)}
|
||||||
|
className="form-control input-field "
|
||||||
|
id="basicpill-phoneno-input"
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user