logo and home

This commit is contained in:
pawan-dot 2024-06-15 08:53:41 +05:30
parent c686393166
commit 8a1d5dc9dc
6 changed files with 727 additions and 743 deletions

View File

@ -307,13 +307,13 @@ const _nav = [
to: "/copyright/message",
group: "Settings",
},
// {
// component: CNavItem,
// name: "Home",
// icon: <CIcon icon={cilFeaturedPlaylist} customClassName="nav-icon" />,
// to: "/home",
// group: "Website Settings",
// },
{
component: CNavItem,
name: "Home",
icon: <CIcon icon={cilFeaturedPlaylist} customClassName="nav-icon" />,
to: "/home",
group: "Settings",
},
],
},
// {

View File

@ -45,7 +45,7 @@ export default function editRefundPolicy() {
};
const addTermsandConditions = async () => {
const response = await axios.patch(
const response = await axios.post(
"/api/content/refund-policy",
{ content },
{

View File

@ -17,12 +17,7 @@ const TOOLBAR_OPTIONS = [
];
import CloudUploadIcon from "@mui/icons-material/CloudUpload";
import DeleteSharpIcon from "@mui/icons-material/DeleteSharp";
import {
Box,
TextField,
Checkbox,
FormControlLabel
} from "@mui/material";
import { Box, TextField, Checkbox, FormControlLabel } from "@mui/material";
const EditPanel1 = () => {
const token = isAutheticated();
@ -89,14 +84,14 @@ const EditPanel1 = () => {
if (allowedTypes.includes(file.type)) {
setNewUpdatedImages(file);
setimage(file);
} else {
setError("Please upload only PNG, JPEG, or JPG files.");
}
};
const handelDelete = async (public_id) => {
const ary = public_id.split("/");
console.log(public_id);
const ary = public_id?.split("/");
setNewUpdatedImages(null);
const res = await axios.delete(
@ -114,25 +109,18 @@ const EditPanel1 = () => {
}
};
const addContent = async () => {
const formData = new FormData();
formData.append("title", title);
formData.append("content", content);
formData.append("displayPanel", displayPanel);
formData.append("image", image);
const response = await axios.post(
"/api/panel/panel1/add",
formData,
{
const response = await axios.post("/api/panel/panel1/add", formData, {
headers: {
Authorization: `Bearer ${token}`,
},
}
);
});
if (response.status == 201) {
swal({
title: "Congratulations!!",
@ -156,7 +144,6 @@ const EditPanel1 = () => {
}
setLoading(true);
const formData = new FormData();
formData.append("title", title);
formData.append("content", content);
@ -237,7 +224,7 @@ const EditPanel1 = () => {
<Checkbox
checked={displayPanel}
onChange={handleChange}
inputProps={{ 'aria-label': 'controlled' }}
inputProps={{ "aria-label": "controlled" }}
/>
}
label="Display Panel"
@ -269,8 +256,6 @@ const EditPanel1 = () => {
Back
</Button>
</Link>
</div>
</div>
</div>
@ -350,10 +335,15 @@ const EditPanel1 = () => {
</div>
<Box style={{ display: "flex" }}>
{ image !== null ? (
{image !== null ? (
<Box marginRight={"2rem"}>
<img
src={image?.url || URL.createObjectURL(newUpdatedImages) || null}
src={
image?.url ||
(newUpdatedImages &&
URL.createObjectURL(newUpdatedImages)) ||
null
}
alt="Panel Image"
style={{
width: 350,
@ -362,7 +352,9 @@ const EditPanel1 = () => {
marginBottom: "1rem",
}}
/>
<DeleteSharpIcon
{console.log("image", image)}
{ image?.public_id&&<DeleteSharpIcon
onClick={() => handelDelete(image?.public_id)}
fontSize="small"
sx={{
@ -373,10 +365,9 @@ const EditPanel1 = () => {
background: "black",
borderRadius: "50%",
}}
/>
/>}
</Box>
) : null}
</Box>
</div>
</div>

View File

@ -101,7 +101,7 @@ const EditPanel2 = () => {
};
const handelDelete = async (public_id) => {
const ary = public_id.split("/");
const ary = public_id?.split("/");
setNewUpdatedImages(null);
const res = await axios.delete(
@ -368,7 +368,7 @@ const EditPanel2 = () => {
marginBottom: "1rem",
}}
/>
<DeleteSharpIcon
{ image?.public_id&& <DeleteSharpIcon
onClick={() => handelDelete(image?.public_id)}
fontSize="small"
sx={{
@ -379,7 +379,7 @@ const EditPanel2 = () => {
background: "black",
borderRadius: "50%",
}}
/>
/>}
</Box>
)}

View File

@ -101,7 +101,7 @@ const EditPanel3 = () => {
};
const handelDelete = async (public_id) => {
const ary = public_id.split("/");
const ary = public_id?.split("/");
setNewUpdatedImages(null);
const res = await axios.delete(
@ -366,7 +366,7 @@ const EditPanel3 = () => {
marginBottom: "1rem",
}}
/>
<DeleteSharpIcon
{ image?.public_id&&<DeleteSharpIcon
onClick={() => handelDelete(image?.public_id)}
fontSize="small"
sx={{
@ -377,7 +377,7 @@ const EditPanel3 = () => {
background: "black",
borderRadius: "50%",
}}
/>
/>}
</Box>
)}

View File

@ -17,12 +17,7 @@ const TOOLBAR_OPTIONS = [
];
import CloudUploadIcon from "@mui/icons-material/CloudUpload";
import DeleteSharpIcon from "@mui/icons-material/DeleteSharp";
import {
Box,
TextField,
Checkbox,
FormControlLabel
} from "@mui/material";
import { Box, TextField, Checkbox, FormControlLabel } from "@mui/material";
const Editpanel4 = () => {
const token = isAutheticated();
@ -51,7 +46,10 @@ const Editpanel4 = () => {
});
if (res?.status === 200) {
setTitle(res?.data?.panel4[0]?.title);
if(res?.data?.panel4[0]?.image!==undefined && res?.data?.panel4[0]?.image!==null){
if (
res?.data?.panel4[0]?.image !== undefined &&
res?.data?.panel4[0]?.image !== null
) {
setimage(res?.data?.panel4[0]?.image);
}
setContent(res?.data?.panel4[0]?.content);
@ -59,11 +57,9 @@ const Editpanel4 = () => {
setDisplayPanel(res?.data?.panel4[0]?.displayPanel);
setId(res?.data?.panel4[0]?._id);
setImg(false);
}
} catch (err) {
console.error(err)
console.error(err);
swal({
title: "Error",
text: "Unable to fetch the panel content",
@ -96,14 +92,13 @@ const Editpanel4 = () => {
if (allowedTypes.includes(file.type)) {
setNewUpdatedImages(file);
setimage(file);
} else {
setError("Please upload only PNG, JPEG, or JPG files.");
}
};
const handelDelete = async (public_id) => {
const ary = public_id.split("/");
const ary = public_id?.split("/");
setNewUpdatedImages(null);
const res = await axios.delete(
@ -121,24 +116,18 @@ const Editpanel4 = () => {
}
};
const addContent = async () => {
const formData = new FormData();
formData.append("title", title);
formData.append("content", content);
formData.append("displayPanel", displayPanel);
formData.append("image", image);
const response = await axios.post(
"/api/panel/panel4/add",
formData,
{
const response = await axios.post("/api/panel/panel4/add", formData, {
headers: {
Authorization: `Bearer ${token}`,
},
}
);
});
if (response.status == 201) {
swal({
title: "Congratulations!!",
@ -162,7 +151,6 @@ const Editpanel4 = () => {
}
setLoading(true);
const formData = new FormData();
formData.append("title", title);
formData.append("content", content);
@ -243,7 +231,7 @@ const Editpanel4 = () => {
<Checkbox
checked={displayPanel}
onChange={handleChange}
inputProps={{ 'aria-label': 'controlled' }}
inputProps={{ "aria-label": "controlled" }}
/>
}
label="Display Panel"
@ -275,8 +263,6 @@ const Editpanel4 = () => {
Back
</Button>
</Link>
</div>
</div>
</div>
@ -359,7 +345,13 @@ const Editpanel4 = () => {
{image && (
<Box marginRight={"2rem"}>
<img
src={newUpdatedImages ? URL.createObjectURL(newUpdatedImages) : image ? image?.url : ""}
src={
newUpdatedImages
? URL.createObjectURL(newUpdatedImages)
: image
? image?.url
: ""
}
alt="Panel Image"
style={{
width: 350,
@ -368,6 +360,7 @@ const Editpanel4 = () => {
marginBottom: "1rem",
}}
/>
{image?.public_id && (
<DeleteSharpIcon
onClick={() => handelDelete(image?.public_id)}
fontSize="small"
@ -380,9 +373,9 @@ const Editpanel4 = () => {
borderRadius: "50%",
}}
/>
)}
</Box>
)}
</Box>
</div>
</div>