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", to: "/copyright/message",
group: "Settings", group: "Settings",
}, },
// { {
// component: CNavItem, component: CNavItem,
// name: "Home", name: "Home",
// icon: <CIcon icon={cilFeaturedPlaylist} customClassName="nav-icon" />, icon: <CIcon icon={cilFeaturedPlaylist} customClassName="nav-icon" />,
// to: "/home", to: "/home",
// group: "Website Settings", group: "Settings",
// }, },
], ],
}, },
// { // {

View File

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

View File

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

View File

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

View File

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

View File

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