first terms and condition etc
This commit is contained in:
parent
88b6914d29
commit
90e913f695
26
src/_nav.js
26
src/_nav.js
@ -192,7 +192,7 @@ const _nav = [
|
|||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
component: CNavGroup,
|
component: CNavGroup,
|
||||||
name: "Website Related",
|
name: "Website Settings",
|
||||||
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
||||||
group: "",
|
group: "",
|
||||||
|
|
||||||
@ -202,28 +202,28 @@ const _nav = [
|
|||||||
name: "Banner",
|
name: "Banner",
|
||||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||||
to: "/banner",
|
to: "/banner",
|
||||||
group: "Website Related",
|
group: "Website Settings",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Register Image",
|
name: "Register Image",
|
||||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||||
to: "/registerImage",
|
to: "/registerImage",
|
||||||
group: "Website Related",
|
group: "Website Settings",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Login Image",
|
name: "Login Image",
|
||||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||||
to: "/loginImage",
|
to: "/loginImage",
|
||||||
group: "Website Related",
|
group: "Website Settings",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Shop Page Image",
|
name: "Shop Page Image",
|
||||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||||
to: "/shopImage",
|
to: "/shopImage",
|
||||||
group: "Website Related",
|
group: "Website Settings",
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// component: CNavItem,
|
// component: CNavItem,
|
||||||
@ -253,15 +253,15 @@ const _nav = [
|
|||||||
name: "Content ",
|
name: "Content ",
|
||||||
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
||||||
to: "/content",
|
to: "/content",
|
||||||
group: "Website Related",
|
group: "Website Settings",
|
||||||
},
|
|
||||||
{
|
|
||||||
component: CNavItem,
|
|
||||||
name: "Home",
|
|
||||||
icon: <CIcon icon={cilFeaturedPlaylist} customClassName="nav-icon" />,
|
|
||||||
to: "/home",
|
|
||||||
group: "Website Related",
|
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// component: CNavItem,
|
||||||
|
// name: "Home",
|
||||||
|
// icon: <CIcon icon={cilFeaturedPlaylist} customClassName="nav-icon" />,
|
||||||
|
// to: "/home",
|
||||||
|
// group: "Website Settings",
|
||||||
|
// },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -5,158 +5,157 @@ import ReactQuill from "react-quill";
|
|||||||
import "react-quill/dist/quill.snow.css";
|
import "react-quill/dist/quill.snow.css";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { isAutheticated } from "src/auth";
|
import { isAutheticated } from "src/auth";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
const TOOLBAR_OPTIONS = [
|
const TOOLBAR_OPTIONS = [
|
||||||
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
||||||
[{ font: [] }],
|
[{ font: [] }],
|
||||||
[{ list: "ordered" }, { list: "bullet" }],
|
[{ list: "ordered" }, { list: "bullet" }],
|
||||||
["bold", "italic", "underline", "strike"],
|
["bold", "italic", "underline", "strike"],
|
||||||
[{ color: [] }, { background: [] }],
|
[{ color: [] }, { background: [] }],
|
||||||
[{ align: [] }],
|
[{ align: [] }],
|
||||||
[{ script: "super" }, { script: "sub" }],
|
[{ script: "super" }, { script: "sub" }],
|
||||||
["undo", "redo"],
|
["undo", "redo"],
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function EditAboutUs() {
|
export default function EditAboutUs() {
|
||||||
const [title, setTitle] = useState("About Us");
|
const [title, setTitle] = useState("About Us");
|
||||||
const [content, setContent] = useState("");
|
const [content, setContent] = useState("");
|
||||||
const [added, setAdded] = useState(false);
|
const [added, setAdded] = useState(false);
|
||||||
const [olderContent, setOlderContent] = useState("");
|
const [olderContent, setOlderContent] = useState("");
|
||||||
const [id, setId] = useState(null);
|
const [id, setId] = useState(null);
|
||||||
|
|
||||||
const token = isAutheticated();
|
const token = isAutheticated();
|
||||||
const handleContentChange = (content, delta, source, editor) => {
|
const handleContentChange = (content, delta, source, editor) => {
|
||||||
setContent(editor.getHTML());
|
setContent(editor.getHTML());
|
||||||
};
|
};
|
||||||
const getAboutUs = async () => {
|
const getAboutUs = async () => {
|
||||||
const response = await axios.get("/api/content/about-us", {
|
const response = await axios.get("/api/content/about-us", {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (response.status === 200) {
|
||||||
|
setContent(response?.data?.aboutUs[0]?.aboutUsContent);
|
||||||
|
setId(response?.data?.aboutUs[0]?._id);
|
||||||
|
setOlderContent(response?.data?.aboutUs[0]?.aboutUsContent);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const addAboutUs = async () => {
|
||||||
|
const response = await axios.post(
|
||||||
|
"/api/content/about-us",
|
||||||
|
{ content },
|
||||||
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
});
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setContent(response?.data?.aboutUs[0]?.aboutUsContent);
|
|
||||||
setId(response?.data?.aboutUs[0]?._id);
|
|
||||||
setOlderContent(
|
|
||||||
response?.data?.aboutUs[0]?.aboutUsContent
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
const addAboutUs = async () => {
|
|
||||||
const response = await axios.post(
|
|
||||||
"/api/content/about-us",
|
|
||||||
{ content },
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${token}`,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status == 201) {
|
|
||||||
swal({
|
|
||||||
title: "Congratulations!!",
|
|
||||||
text: "About us added successfully!",
|
|
||||||
icon: "success",
|
|
||||||
button: "OK",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const handleCancelClick = () => {
|
|
||||||
setContent(olderContent);
|
|
||||||
};
|
|
||||||
const updateContent = async () => {
|
|
||||||
const response = await axios.patch(
|
|
||||||
"/api/content/about-us-update",
|
|
||||||
{ content },
|
|
||||||
{
|
|
||||||
params: { id: id },
|
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${token}`,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
swal({
|
|
||||||
title: "Congratulations!",
|
|
||||||
text: "About Us updated successfully!",
|
|
||||||
icon: "success",
|
|
||||||
button: "OK",
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
swal({
|
|
||||||
title: "Sorry, please try again",
|
|
||||||
text: "Something went wrong!",
|
|
||||||
icon: "error",
|
|
||||||
button: "Retry",
|
|
||||||
dangerMode: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const handleSaveClick = async () => {
|
|
||||||
if (olderContent === undefined && olderContent.length===0) {
|
|
||||||
await addAboutUs();
|
|
||||||
setAdded(true);
|
|
||||||
} else {
|
|
||||||
setAdded(false);
|
|
||||||
await updateContent();
|
|
||||||
}
|
|
||||||
// // Reload terms and conditions
|
|
||||||
// await getAboutUs();
|
|
||||||
};
|
|
||||||
useEffect(() => {
|
|
||||||
// addTermsandConditions();
|
|
||||||
getAboutUs();
|
|
||||||
}, [added]);
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div style={{ display: "flex" }}>
|
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
color="primary"
|
|
||||||
onClick={handleSaveClick}
|
|
||||||
style={{
|
|
||||||
fontWeight: "bold",
|
|
||||||
marginBottom: "1rem",
|
|
||||||
textTransform: "capitalize",
|
|
||||||
marginRight: "5px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Save
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
color="primary"
|
|
||||||
onClick={handleCancelClick}
|
|
||||||
style={{
|
|
||||||
fontWeight: "bold",
|
|
||||||
marginBottom: "1rem",
|
|
||||||
textTransform: "capitalize",
|
|
||||||
marginRight: "5px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
|
||||||
<Typography
|
|
||||||
style={{ margin: "0.5rem 0rem", fontWeight: "bold" }}
|
|
||||||
variant="h6"
|
|
||||||
>
|
|
||||||
{" "}
|
|
||||||
{title} :{" "}
|
|
||||||
</Typography>
|
|
||||||
<Typography style={{ margin: "0.5rem 0rem" }}>Body</Typography>
|
|
||||||
<ReactQuill
|
|
||||||
theme="snow"
|
|
||||||
value={content}
|
|
||||||
onChange={handleContentChange}
|
|
||||||
modules={{ toolbar: TOOLBAR_OPTIONS }}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
if (response.status == 201) {
|
||||||
|
swal({
|
||||||
|
title: "Congratulations!!",
|
||||||
|
text: "About us added successfully!",
|
||||||
|
icon: "success",
|
||||||
|
button: "OK",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleCancelClick = () => {
|
||||||
|
setContent(olderContent);
|
||||||
|
};
|
||||||
|
const updateContent = async () => {
|
||||||
|
const response = await axios.patch(
|
||||||
|
"/api/content/about-us-update",
|
||||||
|
{ content },
|
||||||
|
{
|
||||||
|
params: { id: id },
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (response.status === 200) {
|
||||||
|
swal({
|
||||||
|
title: "Congratulations!",
|
||||||
|
text: "About Us updated successfully!",
|
||||||
|
icon: "success",
|
||||||
|
button: "OK",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
swal({
|
||||||
|
title: "Sorry, please try again",
|
||||||
|
text: "Something went wrong!",
|
||||||
|
icon: "error",
|
||||||
|
button: "Retry",
|
||||||
|
dangerMode: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleSaveClick = async () => {
|
||||||
|
if (olderContent === undefined || olderContent === "") {
|
||||||
|
await addAboutUs();
|
||||||
|
setAdded(true);
|
||||||
|
} else {
|
||||||
|
setAdded(false);
|
||||||
|
await updateContent();
|
||||||
|
}
|
||||||
|
// // Reload terms and conditions
|
||||||
|
// await getAboutUs();
|
||||||
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
// addTermsandConditions();
|
||||||
|
getAboutUs();
|
||||||
|
}, [added]);
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div style={{ display: "flex" }}>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
onClick={handleSaveClick}
|
||||||
|
style={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
marginBottom: "1rem",
|
||||||
|
textTransform: "capitalize",
|
||||||
|
marginRight: "5px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</Button>
|
||||||
|
<Link to="/content">
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
// onClick={handleCancelClick}
|
||||||
|
style={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
marginBottom: "1rem",
|
||||||
|
textTransform: "capitalize",
|
||||||
|
marginRight: "5px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Back
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
||||||
|
<Typography
|
||||||
|
style={{ margin: "0.5rem 0rem", fontWeight: "bold" }}
|
||||||
|
variant="h6"
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
{title} :{" "}
|
||||||
|
</Typography>
|
||||||
|
<Typography style={{ margin: "0.5rem 0rem" }}>Body</Typography>
|
||||||
|
<ReactQuill
|
||||||
|
theme="snow"
|
||||||
|
value={content}
|
||||||
|
onChange={handleContentChange}
|
||||||
|
modules={{ toolbar: TOOLBAR_OPTIONS }}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -5,16 +5,17 @@ import ReactQuill from "react-quill";
|
|||||||
import "react-quill/dist/quill.snow.css";
|
import "react-quill/dist/quill.snow.css";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { isAutheticated } from "src/auth";
|
import { isAutheticated } from "src/auth";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
const TOOLBAR_OPTIONS = [
|
const TOOLBAR_OPTIONS = [
|
||||||
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
||||||
[{ font: [] }],
|
[{ font: [] }],
|
||||||
[{ list: "ordered" }, { list: "bullet" }],
|
[{ list: "ordered" }, { list: "bullet" }],
|
||||||
["bold", "italic", "underline", "strike"],
|
["bold", "italic", "underline", "strike"],
|
||||||
[{ color: [] }, { background: [] }],
|
[{ color: [] }, { background: [] }],
|
||||||
[{ align: [] }],
|
[{ align: [] }],
|
||||||
[{ script: "super" }, { script: "sub" }],
|
[{ script: "super" }, { script: "sub" }],
|
||||||
["undo", "redo"],
|
["undo", "redo"],
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function EditPrivacyPolicy() {
|
export default function EditPrivacyPolicy() {
|
||||||
@ -71,12 +72,11 @@ export default function EditPrivacyPolicy() {
|
|||||||
"/api/content/privacy-and-policy-update",
|
"/api/content/privacy-and-policy-update",
|
||||||
{ content },
|
{ content },
|
||||||
{
|
{
|
||||||
params: { id: id },
|
params: { id: id },
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
swal({
|
swal({
|
||||||
@ -96,7 +96,7 @@ export default function EditPrivacyPolicy() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleSaveClick = async () => {
|
const handleSaveClick = async () => {
|
||||||
if (olderContent.length===0) {
|
if (olderContent === undefined || olderContent === "") {
|
||||||
await addPrivacyPolicy();
|
await addPrivacyPolicy();
|
||||||
setAdded(true);
|
setAdded(true);
|
||||||
} else {
|
} else {
|
||||||
@ -126,19 +126,21 @@ export default function EditPrivacyPolicy() {
|
|||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Link to="/content">
|
||||||
variant="contained"
|
<Button
|
||||||
color="primary"
|
variant="contained"
|
||||||
onClick={handleCancelClick}
|
color="primary"
|
||||||
style={{
|
// onClick={handleCancelClick}
|
||||||
fontWeight: "bold",
|
style={{
|
||||||
marginBottom: "1rem",
|
fontWeight: "bold",
|
||||||
textTransform: "capitalize",
|
marginBottom: "1rem",
|
||||||
marginRight: "5px",
|
textTransform: "capitalize",
|
||||||
}}
|
marginRight: "5px",
|
||||||
>
|
}}
|
||||||
Cancel
|
>
|
||||||
</Button>
|
Back
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
||||||
|
@ -6,17 +6,17 @@ import ReactQuill from "react-quill";
|
|||||||
import "react-quill/dist/quill.snow.css";
|
import "react-quill/dist/quill.snow.css";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { isAutheticated } from "src/auth";
|
import { isAutheticated } from "src/auth";
|
||||||
import { useNavigate, useNavigation } from "react-router-dom";
|
import { Link, useNavigate, useNavigation } from "react-router-dom";
|
||||||
|
|
||||||
const TOOLBAR_OPTIONS = [
|
const TOOLBAR_OPTIONS = [
|
||||||
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
||||||
[{ font: [] }],
|
[{ font: [] }],
|
||||||
[{ list: "ordered" }, { list: "bullet" }],
|
[{ list: "ordered" }, { list: "bullet" }],
|
||||||
["bold", "italic", "underline", "strike"],
|
["bold", "italic", "underline", "strike"],
|
||||||
[{ color: [] }, { background: [] }],
|
[{ color: [] }, { background: [] }],
|
||||||
[{ align: [] }],
|
[{ align: [] }],
|
||||||
[{ script: "super" }, { script: "sub" }],
|
[{ script: "super" }, { script: "sub" }],
|
||||||
["undo", "redo"],
|
["undo", "redo"],
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function editRefundPolicy() {
|
export default function editRefundPolicy() {
|
||||||
@ -24,8 +24,7 @@ export default function editRefundPolicy() {
|
|||||||
const [content, setContent] = useState("");
|
const [content, setContent] = useState("");
|
||||||
const [added, setAdded] = useState(false);
|
const [added, setAdded] = useState(false);
|
||||||
const [olderContent, setOlderContent] = useState("");
|
const [olderContent, setOlderContent] = useState("");
|
||||||
const [id, setId] = useState(null)
|
const [id, setId] = useState(null);
|
||||||
|
|
||||||
|
|
||||||
const token = isAutheticated();
|
const token = isAutheticated();
|
||||||
const handleContentChange = (content, delta, source, editor) => {
|
const handleContentChange = (content, delta, source, editor) => {
|
||||||
@ -72,12 +71,11 @@ export default function editRefundPolicy() {
|
|||||||
"/api/content/refund-policy-update",
|
"/api/content/refund-policy-update",
|
||||||
{ content },
|
{ content },
|
||||||
{
|
{
|
||||||
params: { id: id },
|
params: { id: id },
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
swal({
|
swal({
|
||||||
@ -97,7 +95,7 @@ export default function editRefundPolicy() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleSaveClick = async () => {
|
const handleSaveClick = async () => {
|
||||||
if (olderContent.length===0) {
|
if (olderContent === undefined || olderContent === "") {
|
||||||
await addTermsandConditions();
|
await addTermsandConditions();
|
||||||
setAdded(true);
|
setAdded(true);
|
||||||
} else {
|
} else {
|
||||||
@ -128,19 +126,21 @@ export default function editRefundPolicy() {
|
|||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Link to="/content">
|
||||||
variant="contained"
|
<Button
|
||||||
color="primary"
|
variant="contained"
|
||||||
onClick={handleCancelClick}
|
color="primary"
|
||||||
style={{
|
// onClick={handleCancelClick}
|
||||||
fontWeight: "bold",
|
style={{
|
||||||
marginBottom: "1rem",
|
fontWeight: "bold",
|
||||||
textTransform: "capitalize",
|
marginBottom: "1rem",
|
||||||
marginRight: "5px",
|
textTransform: "capitalize",
|
||||||
}}
|
marginRight: "5px",
|
||||||
>
|
}}
|
||||||
Cancel
|
>
|
||||||
</Button>
|
Back
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
||||||
|
@ -6,17 +6,17 @@ import ReactQuill from "react-quill";
|
|||||||
import "react-quill/dist/quill.snow.css";
|
import "react-quill/dist/quill.snow.css";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { isAutheticated } from "src/auth";
|
import { isAutheticated } from "src/auth";
|
||||||
import { useNavigate, useNavigation } from "react-router-dom";
|
import { Link, useNavigate, useNavigation } from "react-router-dom";
|
||||||
|
|
||||||
const TOOLBAR_OPTIONS = [
|
const TOOLBAR_OPTIONS = [
|
||||||
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
||||||
[{ font: [] }],
|
[{ font: [] }],
|
||||||
[{ list: "ordered" }, { list: "bullet" }],
|
[{ list: "ordered" }, { list: "bullet" }],
|
||||||
["bold", "italic", "underline", "strike"],
|
["bold", "italic", "underline", "strike"],
|
||||||
[{ color: [] }, { background: [] }],
|
[{ color: [] }, { background: [] }],
|
||||||
[{ align: [] }],
|
[{ align: [] }],
|
||||||
[{ script: "super" }, { script: "sub" }],
|
[{ script: "super" }, { script: "sub" }],
|
||||||
["undo", "redo"],
|
["undo", "redo"],
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function EditShippingPolicy() {
|
export default function EditShippingPolicy() {
|
||||||
@ -24,8 +24,7 @@ export default function EditShippingPolicy() {
|
|||||||
const [content, setContent] = useState("");
|
const [content, setContent] = useState("");
|
||||||
const [added, setAdded] = useState(false);
|
const [added, setAdded] = useState(false);
|
||||||
const [olderContent, setOlderContent] = useState("");
|
const [olderContent, setOlderContent] = useState("");
|
||||||
const [id, setId] = useState(null)
|
const [id, setId] = useState(null);
|
||||||
|
|
||||||
|
|
||||||
const token = isAutheticated();
|
const token = isAutheticated();
|
||||||
const handleContentChange = (content, delta, source, editor) => {
|
const handleContentChange = (content, delta, source, editor) => {
|
||||||
@ -73,7 +72,7 @@ export default function EditShippingPolicy() {
|
|||||||
"/api/content/shipping-and-policy-update",
|
"/api/content/shipping-and-policy-update",
|
||||||
{ content },
|
{ content },
|
||||||
{
|
{
|
||||||
params: { id: id },
|
params: { id: id },
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
@ -97,7 +96,7 @@ export default function EditShippingPolicy() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleSaveClick = async () => {
|
const handleSaveClick = async () => {
|
||||||
if (olderContent.length===0) {
|
if (olderContent === undefined || olderContent === "") {
|
||||||
await addShipping();
|
await addShipping();
|
||||||
setAdded(true);
|
setAdded(true);
|
||||||
} else {
|
} else {
|
||||||
@ -128,19 +127,21 @@ export default function EditShippingPolicy() {
|
|||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Link to="/content">
|
||||||
variant="contained"
|
<Button
|
||||||
color="primary"
|
variant="contained"
|
||||||
onClick={handleCancelClick}
|
color="primary"
|
||||||
style={{
|
// onClick={handleCancelClick}
|
||||||
fontWeight: "bold",
|
style={{
|
||||||
marginBottom: "1rem",
|
fontWeight: "bold",
|
||||||
textTransform: "capitalize",
|
marginBottom: "1rem",
|
||||||
marginRight: "5px",
|
textTransform: "capitalize",
|
||||||
}}
|
marginRight: "5px",
|
||||||
>
|
}}
|
||||||
Cancel
|
>
|
||||||
</Button>
|
Back
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
||||||
|
@ -6,17 +6,17 @@ import ReactQuill from "react-quill";
|
|||||||
import "react-quill/dist/quill.snow.css";
|
import "react-quill/dist/quill.snow.css";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { isAutheticated } from "src/auth";
|
import { isAutheticated } from "src/auth";
|
||||||
import { useNavigate, useNavigation } from "react-router-dom";
|
import { Link, useNavigate, useNavigation } from "react-router-dom";
|
||||||
|
|
||||||
const TOOLBAR_OPTIONS = [
|
const TOOLBAR_OPTIONS = [
|
||||||
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
||||||
[{ font: [] }],
|
[{ font: [] }],
|
||||||
[{ list: "ordered" }, { list: "bullet" }],
|
[{ list: "ordered" }, { list: "bullet" }],
|
||||||
["bold", "italic", "underline", "strike"],
|
["bold", "italic", "underline", "strike"],
|
||||||
[{ color: [] }, { background: [] }],
|
[{ color: [] }, { background: [] }],
|
||||||
[{ align: [] }],
|
[{ align: [] }],
|
||||||
[{ script: "super" }, { script: "sub" }],
|
[{ script: "super" }, { script: "sub" }],
|
||||||
["undo", "redo"],
|
["undo", "redo"],
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function EditTermsConditions() {
|
export default function EditTermsConditions() {
|
||||||
@ -24,8 +24,7 @@ export default function EditTermsConditions() {
|
|||||||
const [content, setContent] = useState("");
|
const [content, setContent] = useState("");
|
||||||
const [added, setAdded] = useState(false);
|
const [added, setAdded] = useState(false);
|
||||||
const [olderContent, setOlderContent] = useState("");
|
const [olderContent, setOlderContent] = useState("");
|
||||||
const [id, setId] = useState(null)
|
const [id, setId] = useState(null);
|
||||||
|
|
||||||
|
|
||||||
const token = isAutheticated();
|
const token = isAutheticated();
|
||||||
const handleContentChange = (content, delta, source, editor) => {
|
const handleContentChange = (content, delta, source, editor) => {
|
||||||
@ -38,14 +37,11 @@ export default function EditTermsConditions() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log(response);
|
|
||||||
setContent(response?.data?.termsAndCondition[0]?.termsAndContionContent);
|
setContent(response?.data?.termsAndCondition[0]?.termsAndContionContent);
|
||||||
setOlderContent(
|
setOlderContent(
|
||||||
response?.data?.termsAndCondition[0]?.termsAndContionContent
|
response?.data?.termsAndCondition[0]?.termsAndContionContent
|
||||||
);
|
);
|
||||||
setId(
|
setId(response?.data?.termsAndCondition[0]?._id);
|
||||||
response?.data?.termsAndCondition[0]?._id
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -76,7 +72,7 @@ export default function EditTermsConditions() {
|
|||||||
"/api/content/terms-and-condition-update",
|
"/api/content/terms-and-condition-update",
|
||||||
{ content },
|
{ content },
|
||||||
{
|
{
|
||||||
params: { id: id },
|
params: { id: id },
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
@ -100,7 +96,7 @@ export default function EditTermsConditions() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleSaveClick = async () => {
|
const handleSaveClick = async () => {
|
||||||
if (olderContent.length===0) {
|
if (olderContent === undefined || olderContent === "") {
|
||||||
await addTermsandConditions();
|
await addTermsandConditions();
|
||||||
setAdded(true);
|
setAdded(true);
|
||||||
} else {
|
} else {
|
||||||
@ -131,19 +127,21 @@ export default function EditTermsConditions() {
|
|||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Link to="/content">
|
||||||
variant="contained"
|
<Button
|
||||||
color="primary"
|
variant="contained"
|
||||||
onClick={handleCancelClick}
|
color="primary"
|
||||||
style={{
|
// onClick={handleCancelClick}
|
||||||
fontWeight: "bold",
|
style={{
|
||||||
marginBottom: "1rem",
|
fontWeight: "bold",
|
||||||
textTransform: "capitalize",
|
marginBottom: "1rem",
|
||||||
marginRight: "5px",
|
textTransform: "capitalize",
|
||||||
}}
|
marginRight: "5px",
|
||||||
>
|
}}
|
||||||
Cancel
|
>
|
||||||
</Button>
|
Back
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
||||||
|
Loading…
Reference in New Issue
Block a user