mirror of
https://github.com/WDI-Ideas/rubix-admin-panel.git
synced 2026-04-28 23:05:50 +00:00
New updates to admin panel
This commit is contained in:
95
package-lock.json
generated
95
package-lock.json
generated
@@ -28,6 +28,7 @@
|
||||
"redux-persist": "^6.0.0",
|
||||
"redux-persist-transform-encrypt": "^5.1.1",
|
||||
"uuid": "^9.0.1",
|
||||
"xlsx": "^0.18.5",
|
||||
"yup": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -2576,6 +2577,14 @@
|
||||
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/adler-32": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
|
||||
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/ajv": {
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||
@@ -2861,6 +2870,18 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/cfb": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
|
||||
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
|
||||
"dependencies": {
|
||||
"adler-32": "~1.3.0",
|
||||
"crc-32": "~1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
@@ -2885,6 +2906,14 @@
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/codepage": {
|
||||
"version": "1.15.0",
|
||||
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
|
||||
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
@@ -2947,6 +2976,17 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/crc-32": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
|
||||
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
|
||||
"bin": {
|
||||
"crc32": "bin/crc32.njs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
@@ -3684,6 +3724,14 @@
|
||||
"is-callable": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/frac": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
|
||||
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/framer-motion": {
|
||||
"version": "11.1.5",
|
||||
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.1.5.tgz",
|
||||
@@ -5547,6 +5595,17 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ssf": {
|
||||
"version": "0.11.2",
|
||||
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
|
||||
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
|
||||
"dependencies": {
|
||||
"frac": "~1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/string.prototype.matchall": {
|
||||
"version": "4.0.11",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz",
|
||||
@@ -6044,12 +6103,48 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/wmf": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
|
||||
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/word": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
|
||||
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/xlsx": {
|
||||
"version": "0.18.5",
|
||||
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
|
||||
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
||||
"dependencies": {
|
||||
"adler-32": "~1.3.0",
|
||||
"cfb": "~1.2.1",
|
||||
"codepage": "~1.15.0",
|
||||
"crc-32": "~1.2.1",
|
||||
"ssf": "~0.11.2",
|
||||
"wmf": "~1.0.1",
|
||||
"word": "~0.3.0"
|
||||
},
|
||||
"bin": {
|
||||
"xlsx": "bin/xlsx.njs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/yaml": {
|
||||
"version": "1.10.2",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
"redux-persist": "^6.0.0",
|
||||
"redux-persist-transform-encrypt": "^5.1.1",
|
||||
"uuid": "^9.0.1",
|
||||
"xlsx": "^0.18.5",
|
||||
"yup": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
128
src/App.css
128
src/App.css
@@ -1,5 +1,5 @@
|
||||
@import url("https://fonts.googleapis.com/css2?family=League+Spartan:wght@100..900&display=swap");
|
||||
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap');
|
||||
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap");
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
@@ -13,22 +13,26 @@
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.activee{
|
||||
.activee {
|
||||
text-decoration: none; /* Remove underline */
|
||||
font-weight: bold; /* Optionally change font weight for active link */
|
||||
background: linear-gradient(to right, #7A45FB, #DE41B5); /* Gradient background */
|
||||
background: linear-gradient(
|
||||
to right,
|
||||
#7a45fb,
|
||||
#de41b5
|
||||
); /* Gradient background */
|
||||
-webkit-background-clip: text; /* Clip text to the background area */
|
||||
-webkit-text-fill-color: transparent; /* Fill text with the background color */
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.active{
|
||||
.active {
|
||||
/* background-color: #e2e8f086; */
|
||||
background-color: #e2e8f01c;
|
||||
}
|
||||
|
||||
.link {
|
||||
text-decoration: none ;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s ease-in-out;
|
||||
font-weight: 400;
|
||||
}
|
||||
@@ -43,58 +47,59 @@
|
||||
background-color: #e2e8f01c !important;
|
||||
}
|
||||
|
||||
.web-text-small{
|
||||
.web-text-small {
|
||||
font-size: 12px !important;
|
||||
}
|
||||
.web-text-xxsmall{
|
||||
.web-text-xxsmall {
|
||||
font-size: 9px !important;
|
||||
}
|
||||
.web-text-xsmall{
|
||||
.web-text-xsmall {
|
||||
font-size: 11px !important;
|
||||
}
|
||||
|
||||
.web-text-medium{
|
||||
.web-text-medium {
|
||||
font-size: 13px !important;
|
||||
}
|
||||
|
||||
.web-text-large{
|
||||
.web-text-large {
|
||||
font-size: 15px !important;
|
||||
}
|
||||
|
||||
.rubix-text-dark{
|
||||
color:#3b3e3f
|
||||
.rubix-text-dark {
|
||||
color: #3b3e3f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.arrow-button{
|
||||
.arrow-button {
|
||||
transition: all 0.5s;
|
||||
}
|
||||
|
||||
|
||||
.arrow-button:active{
|
||||
.arrow-button:active {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.arrow-button:focus{
|
||||
.arrow-button:focus {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.arrow-button:hover{
|
||||
background: linear-gradient(90deg, #DE41B5 0%, #7A45FB 100%);
|
||||
.arrow-button:hover {
|
||||
background: linear-gradient(90deg, #de41b5 0%, #7a45fb 100%);
|
||||
}
|
||||
|
||||
.greeting{
|
||||
.greeting {
|
||||
text-decoration: none; /* Remove underline */
|
||||
font-weight: bold; /* Optionally change font weight for active link */
|
||||
background: linear-gradient(to right, #7A45FB, #DE41B5); /* Gradient background */
|
||||
background: linear-gradient(
|
||||
to right,
|
||||
#7a45fb,
|
||||
#de41b5
|
||||
); /* Gradient background */
|
||||
-webkit-background-clip: text; /* Clip text to the background area */
|
||||
-webkit-text-fill-color: transparent; /* Fill text with the background color */
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.primary-btn{
|
||||
background-color: #38187C !important;
|
||||
.primary-btn {
|
||||
background-color: #38187c !important;
|
||||
}
|
||||
|
||||
.team-slider .swiper-button-next:after {
|
||||
@@ -142,16 +147,39 @@
|
||||
);
|
||||
}
|
||||
|
||||
.text-animate{
|
||||
|
||||
.text-animate {
|
||||
animation-name: text;
|
||||
animation-duration: 5s;
|
||||
animation-iteration-count: 1;
|
||||
}
|
||||
|
||||
/* Total scrollbar width */
|
||||
::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
/* The track (background) of the scrollbar */
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
/* The draggable scrollbar handle */
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #de858e;
|
||||
border-radius: 10px;
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* On hover */
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #e97d88;
|
||||
}
|
||||
|
||||
@keyframes text {
|
||||
0% {
|
||||
color: #0B0B27;
|
||||
color: #0b0b27;
|
||||
/* margin-bottom: -40px; */
|
||||
}
|
||||
30% {
|
||||
@@ -167,23 +195,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.rotate{
|
||||
|
||||
.rotate {
|
||||
animation: animName 10s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes animName {
|
||||
0%{
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100%{
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.lds-ellipsis {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
@@ -239,37 +263,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Extra small devices (phones, 600px and down) */
|
||||
@media only screen and (max-width: 600px) {
|
||||
body {
|
||||
font-size: 14px !important;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Small devices (portrait tablets and large phones, 600px and up) */
|
||||
|
||||
@@ -2,11 +2,30 @@ import { AddIcon } from "@chakra-ui/icons";
|
||||
import { Box, Button, Text } from "@chakra-ui/react";
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { IoMdDownload } from "react-icons/io";
|
||||
import * as XLSX from "xlsx";
|
||||
import { useGetNewsLetterEmailQuery } from "../Services/api.service";
|
||||
|
||||
const Header = ({ link, btnTitle, title }) => {
|
||||
const { data, error, isLoading } = useGetNewsLetterEmailQuery();
|
||||
console.log(data);
|
||||
|
||||
const handleDownload = () => {
|
||||
if (Array.isArray(data?.data?.rows)) {
|
||||
const worksheet = XLSX.utils.json_to_sheet(data?.data?.rows);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1");
|
||||
XLSX.writeFile(workbook, "newsletter_emails.xlsx");
|
||||
} else {
|
||||
console.error(
|
||||
"Expected data to be an array but received:",
|
||||
data?.data?.rows
|
||||
);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Box
|
||||
backgroundColor={'#fff'}
|
||||
backgroundColor={"#fff"}
|
||||
// bg="white.900"
|
||||
// backdropFilter="blur(10px) hue-rotate(90deg)"
|
||||
position={"sticky"}
|
||||
@@ -18,20 +37,39 @@ const Header = ({ link, btnTitle, title }) => {
|
||||
>
|
||||
{/* <span className="fs-5">Community</span> */}
|
||||
|
||||
<Text as={"span"} fontWeight={'bold'} color={"purple.900"} className="fs-6 ">
|
||||
<Text
|
||||
as={"span"}
|
||||
fontWeight={"bold"}
|
||||
color={"purple.900"}
|
||||
className="fs-6 "
|
||||
>
|
||||
{title}
|
||||
</Text>
|
||||
|
||||
|
||||
|
||||
{/* <Text fontWeight='bold' bgGradient='linear(to-l, #A5626D, #331E8C)' bgClip='text' as={"span"} className="fs-6 ">
|
||||
{title}
|
||||
</Text> */}
|
||||
|
||||
{btnTitle && link && (
|
||||
<Link to={link}>
|
||||
{btnTitle &&
|
||||
link &&
|
||||
(link === "" ? (
|
||||
<Link to={link}>
|
||||
<Button
|
||||
leftIcon={<AddIcon />}
|
||||
backgroundColor={"purple.900"}
|
||||
_hover={{
|
||||
backgroundColor: "purple.800",
|
||||
}}
|
||||
color={"whitesmoke"}
|
||||
size="sm"
|
||||
rounded={"sm"}
|
||||
>
|
||||
{btnTitle}
|
||||
</Button>
|
||||
</Link>
|
||||
) : (
|
||||
<Button
|
||||
leftIcon={<AddIcon />}
|
||||
leftIcon={<IoMdDownload />}
|
||||
backgroundColor={"purple.900"}
|
||||
_hover={{
|
||||
backgroundColor: "purple.800",
|
||||
@@ -39,11 +77,11 @@ const Header = ({ link, btnTitle, title }) => {
|
||||
color={"whitesmoke"}
|
||||
size="sm"
|
||||
rounded={"sm"}
|
||||
onClick={handleDownload}
|
||||
>
|
||||
{btnTitle}
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
))}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -23,12 +23,12 @@ const TabularView = ({
|
||||
pageSize,
|
||||
setPageSize,
|
||||
totalPages,
|
||||
noDataTitle
|
||||
noDataTitle,
|
||||
}) => {
|
||||
const [displayRange, setDisplayRange] = useState({
|
||||
start: TABLE_PAGINATION?.page,
|
||||
end: pageSize,
|
||||
});
|
||||
const [displayRange, setDisplayRange] = useState({
|
||||
start: TABLE_PAGINATION?.page,
|
||||
end: pageSize,
|
||||
});
|
||||
// ====================================================[Pagination Setup]================================================================
|
||||
const paginationPrev = () => {
|
||||
if (currentPage > 1) {
|
||||
@@ -37,7 +37,6 @@ const TabularView = ({
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const paginationNext = () => {
|
||||
const totalPage = Math.ceil(totalPages / pageSize);
|
||||
if (currentPage < totalPage) {
|
||||
@@ -51,8 +50,6 @@ const TabularView = ({
|
||||
setDisplayRange({ start, end });
|
||||
};
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<Box
|
||||
overflowY={"scroll"}
|
||||
@@ -112,8 +109,7 @@ const TabularView = ({
|
||||
className=" link rounded-3 pointer"
|
||||
/>
|
||||
<Text className="web-text-medium" as={"span"}>
|
||||
{displayRange.start} - {displayRange.end} of{" "}
|
||||
{totalPages}
|
||||
{displayRange.start} - {displayRange.end} of {totalPages}
|
||||
</Text>
|
||||
<ChevronRightIcon
|
||||
onClick={paginationNext}
|
||||
|
||||
@@ -47,7 +47,6 @@ const DashboardLayout = () => {
|
||||
const [openDrawerClick, setOpenDrawerClick] = useState(true);
|
||||
const { setIsAuthenticate } = useContext(GlobalStateContext);
|
||||
|
||||
|
||||
const openDrawerOnClick = () => {
|
||||
setOpenDrawerClick(!openDrawerClick);
|
||||
};
|
||||
@@ -81,12 +80,14 @@ const DashboardLayout = () => {
|
||||
case "/community/view/":
|
||||
return "Community";
|
||||
case "/community/add-comunity":
|
||||
return <Text color={'teal.800'} className="d-flex align-items-center">
|
||||
<Link to={"/community/"}>
|
||||
<ArrowBackIcon className="me-2 fs-3 link p-1 rounded-1" />
|
||||
</Link>
|
||||
Community
|
||||
</Text>;
|
||||
return (
|
||||
<Text color={"teal.800"} className="d-flex align-items-center">
|
||||
<Link to={"/community/"}>
|
||||
<ArrowBackIcon className="me-2 fs-3 link p-1 rounded-1" />
|
||||
</Link>
|
||||
Community
|
||||
</Text>
|
||||
);
|
||||
default:
|
||||
if (path.startsWith("/community/view/")) {
|
||||
return (
|
||||
@@ -124,7 +125,7 @@ const DashboardLayout = () => {
|
||||
className="d-flex"
|
||||
>
|
||||
<aside
|
||||
className="h-100 position-relative sideBar"
|
||||
className="h-100 position-relative sideBar pe-1"
|
||||
// onMouseOver={() => setIsDrawerOpen(true)}
|
||||
// onMouseLeave={() => setIsDrawerOpen(false)}
|
||||
style={{
|
||||
@@ -132,10 +133,13 @@ const DashboardLayout = () => {
|
||||
transition: "width 0.3s ease-in-out", // Smooth transition for width change
|
||||
overflow: "hidden", // Hide overflow to prevent content overflow during transition
|
||||
// backgroundColor:"#FAFBFC"
|
||||
backgroundColor:"#0B0B27"
|
||||
backgroundColor: "#0B0B27",
|
||||
}}
|
||||
>
|
||||
<div className="d-flex justify-content-start p-3 pt-3 pb-4 position-relative">
|
||||
<div
|
||||
className="d-flex justify-content-start p-3 pt-3 pb-4 position-relative"
|
||||
height={"10%"}
|
||||
>
|
||||
{isDrawerOpen || openDrawerClick ? (
|
||||
<img
|
||||
style={{
|
||||
@@ -155,17 +159,26 @@ const DashboardLayout = () => {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="p-2 ">
|
||||
<div
|
||||
className="p-2 scroll-bar"
|
||||
style={{ height: "80%", overflowY: "scroll" }}
|
||||
>
|
||||
{nav.map(({ title, path, Icon }, index) => (
|
||||
<Box
|
||||
color={'whitesmoke'}
|
||||
key={index} className=" mb-1 w-100 d-flex ">
|
||||
<Box
|
||||
color={"whitesmoke"}
|
||||
key={index}
|
||||
className=" mb-1 w-100 d-flex "
|
||||
>
|
||||
{path ? (
|
||||
<NavLink
|
||||
style={{
|
||||
height: "auto",
|
||||
}}
|
||||
className={`${isDrawerOpen || openDrawerClick ? "p-1 web-text-medium ps-3" : "p-2 ps-1 web-text-xlarge justify-content-center"} rounded-1 link d-flex align-items-center gap-2 w-100 `}
|
||||
className={`${
|
||||
isDrawerOpen || openDrawerClick
|
||||
? "p-1 web-text-medium ps-3"
|
||||
: "p-2 ps-1 web-text-xlarge justify-content-center"
|
||||
} rounded-1 link d-flex align-items-center gap-2 w-100 `}
|
||||
to={path}
|
||||
>
|
||||
<span
|
||||
@@ -184,15 +197,14 @@ const DashboardLayout = () => {
|
||||
isDrawerOpen || openDrawerClick ? "flex" : "none",
|
||||
alignItems: "center",
|
||||
padding: 3,
|
||||
overflow:"hidden"
|
||||
overflow: "hidden",
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</span>
|
||||
</NavLink>
|
||||
) : (
|
||||
<span
|
||||
className="web-text-xxsmall fw-600 mt-1 text-secondary fw-bold">
|
||||
<span className="web-text-xxsmall fw-600 mt-1 text-secondary fw-bold">
|
||||
{title}
|
||||
</span>
|
||||
)}
|
||||
@@ -216,10 +228,10 @@ const DashboardLayout = () => {
|
||||
<PopoverBody className="web-text-medium pointer link">
|
||||
Profile
|
||||
</PopoverBody>
|
||||
<Link to={'/help-and-support'}>
|
||||
<PopoverBody className="web-text-medium pointer link">
|
||||
Help & Support
|
||||
</PopoverBody>
|
||||
<Link to={"/help-and-support"}>
|
||||
<PopoverBody className="web-text-medium pointer link">
|
||||
Help & Support
|
||||
</PopoverBody>
|
||||
</Link>
|
||||
<PopoverFooter
|
||||
onClick={logOutHandler}
|
||||
@@ -239,14 +251,16 @@ const DashboardLayout = () => {
|
||||
name="Dan Abrahmov"
|
||||
src="https://bit.ly/dan-abramov"
|
||||
/>
|
||||
<Box
|
||||
color={'whitesmoke'}
|
||||
style={{
|
||||
opacity:isDrawerOpen || openDrawerClick ? 1 : 0,
|
||||
display:isDrawerOpen || openDrawerClick ? "flex" : "none",
|
||||
transition: "opacity 0.3s ease-in-out",
|
||||
}} className=" overflow-hidden ms-3 flex-column ">
|
||||
<Text as={"span"} className="web-text-small">
|
||||
<Box
|
||||
color={"whitesmoke"}
|
||||
style={{
|
||||
opacity: isDrawerOpen || openDrawerClick ? 1 : 0,
|
||||
display: isDrawerOpen || openDrawerClick ? "flex" : "none",
|
||||
transition: "opacity 0.3s ease-in-out",
|
||||
}}
|
||||
className=" overflow-hidden ms-3 flex-column "
|
||||
>
|
||||
<Text as={"span"} className="web-text-small">
|
||||
Hello, developer admin
|
||||
</Text>
|
||||
<Text as={"span"} className="web-text-xsmall">
|
||||
@@ -270,8 +284,8 @@ const DashboardLayout = () => {
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
colorScheme={'peach'}
|
||||
rounded={'sm'}
|
||||
colorScheme={"peach"}
|
||||
rounded={"sm"}
|
||||
// onMouseOver={() => setIsDrawerOpen(true)}
|
||||
// onMouseLeave={() => setIsDrawerOpen(false)}
|
||||
onClick={openDrawerOnClick}
|
||||
|
||||
331
src/Pages/Faq/AddFaq.jsx
Normal file
331
src/Pages/Faq/AddFaq.jsx
Normal file
@@ -0,0 +1,331 @@
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Divider,
|
||||
FormControl,
|
||||
FormHelperText,
|
||||
FormLabel,
|
||||
Heading,
|
||||
Image,
|
||||
Input,
|
||||
Stack,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import React, { useState } from "react";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import Header from "../../Components/Header";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import fallbackImage from "../../assets/ultp-fallback-img.webp";
|
||||
import { addFaq } from "../../Validations/Validations";
|
||||
import { TiWarning } from "react-icons/ti";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { motion } from "framer-motion";
|
||||
import Loader01 from "../../Components/Loaders/Loader01";
|
||||
import { useCreateFaqMutation } from "../../Services/api.service";
|
||||
import ToastBox from "../../Components/ToastBox";
|
||||
import ReactQuill from "react-quill";
|
||||
|
||||
const AddFaq = () => {
|
||||
const toast = useToast();
|
||||
const navigate = useNavigate();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [selectedImage, setSelectedImage] = useState(fallbackImage);
|
||||
const [imageData, setImageData] = useState(null);
|
||||
const [value, setValue] = useState(null);
|
||||
|
||||
const [createFaq] = useCreateFaqMutation();
|
||||
|
||||
// const termContent = data?.data;
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
reset,
|
||||
setValue: setYupFormValue,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
resolver: yupResolver(addFaq),
|
||||
defaultValues: {
|
||||
question: "",
|
||||
answer: "",
|
||||
},
|
||||
});
|
||||
|
||||
console.log(errors);
|
||||
// const handleImageChange = (e) => {
|
||||
// const file = e.target.files[0];
|
||||
// setImageData(file);
|
||||
// // setYupFormValue("banner_image", file);
|
||||
// if (file) {
|
||||
// const reader = new FileReader();
|
||||
// reader.onloadend = () => {
|
||||
// setSelectedImage(reader.result);
|
||||
// };
|
||||
// reader.readAsDataURL(file);
|
||||
// }
|
||||
// };
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
if (value === null) {
|
||||
return toast({
|
||||
render: () => (
|
||||
<ToastBox status={"warn"} message={"Answer can not be empty."} />
|
||||
),
|
||||
});
|
||||
}
|
||||
setYupFormValue("answer", value);
|
||||
try {
|
||||
setIsLoading(true);
|
||||
// Trigger the mutation
|
||||
createFaq(data)
|
||||
.then((response) => {
|
||||
// Handle the response here
|
||||
|
||||
if (response?.data?.statusCode === 201) {
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"success"}
|
||||
message={response?.data?.message}
|
||||
/>
|
||||
),
|
||||
});
|
||||
reset();
|
||||
navigate("/faq");
|
||||
} else if (response?.data?.statusCode === 500) {
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"success"}
|
||||
message={response?.data?.message}
|
||||
/>
|
||||
),
|
||||
});
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"Some thing went wrong"}
|
||||
message={response?.data?.message}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// Handle errors
|
||||
console.error("Error creating community:", error);
|
||||
setIsLoading(false);
|
||||
// Handle error notification if needed
|
||||
});
|
||||
} catch (error) {
|
||||
// Handle errors
|
||||
console.error("Error creating community:", error);
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box
|
||||
{...OPACITY_ON_LOAD}
|
||||
w={"100%"}
|
||||
h={"100vh"}
|
||||
className="overflow-auto "
|
||||
display={"flex"}
|
||||
flexDirection={"column"}
|
||||
>
|
||||
<Header title={"Add FAQ"} />
|
||||
|
||||
<Box className="d-flex">
|
||||
{/* <Box className="col-5 d-flex flex-column gap-2 pt-4">
|
||||
<Box
|
||||
boxSize="sm"
|
||||
className="d-flex w-100 justify-content-center flex-column align-items-center gap-3"
|
||||
>
|
||||
<Image
|
||||
shadow={"md"}
|
||||
rounded={8}
|
||||
w={500}
|
||||
h={240}
|
||||
src={selectedImage}
|
||||
alt="Selected Image"
|
||||
/>
|
||||
{selectedImage === fallbackImage || imageData === null ? (
|
||||
""
|
||||
) : (
|
||||
<Box display={"flex"} flexDirection={"column"} w={"100%"}>
|
||||
<span className="web-text-small">{imageData?.name}</span>
|
||||
<span className="web-text-small text-secondary fst-italic">
|
||||
{(imageData?.size / (1024 * 1024)).toFixed(2)} mb
|
||||
</span>
|
||||
</Box>
|
||||
)}
|
||||
<Button
|
||||
onClick={() => setSelectedImage(fallbackImage)}
|
||||
backgroundColor="red.400"
|
||||
color={"whitesmoke"}
|
||||
transition={"0.5s"}
|
||||
_hover={{
|
||||
backgroundColor: "red.500",
|
||||
}}
|
||||
size="xs"
|
||||
>
|
||||
Remove
|
||||
</Button>
|
||||
</Box>
|
||||
</Box> */}
|
||||
|
||||
<form
|
||||
onSubmit={handleSubmit(onSubmit)}
|
||||
className="col-7 pt-4 mb-3 overflow-auto p-4"
|
||||
>
|
||||
<FormControl isRequired className="mb-3">
|
||||
<FormLabel className="web-text-large fw-bold rubix-text-dark">
|
||||
Question
|
||||
</FormLabel>
|
||||
<Input
|
||||
{...register("question")}
|
||||
placeholder="Question"
|
||||
className="web-text-medium"
|
||||
size="sm"
|
||||
/>
|
||||
{errors.question && (
|
||||
<span className="text-danger web-text-small fw-bold ps-2 d-flex align-items-center gap-1 mt-1">
|
||||
<TiWarning className="fw-bold fs-5 " />{" "}
|
||||
{errors.question.message}
|
||||
</span>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<FormControl isRequired className="mb-3">
|
||||
<FormLabel className="web-text-large fw-bold rubix-text-dark">
|
||||
Answer
|
||||
</FormLabel>
|
||||
<ReactQuill
|
||||
className="rounded-3"
|
||||
theme="snow"
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
/>
|
||||
{errors.answer && (
|
||||
<span className="text-danger web-text-small fw-bold ps-2 d-flex align-items-center gap-1 mt-1">
|
||||
<TiWarning className="fw-bold fs-5 " /> {errors.answer.message}
|
||||
</span>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
{/* <FormControl isRequired className="mb-3">
|
||||
<FormLabel className="web-text-large fw-bold rubix-text-dark">
|
||||
Banner image
|
||||
</FormLabel>
|
||||
|
||||
<Box
|
||||
borderColor="gray.300"
|
||||
borderStyle="dashed"
|
||||
borderWidth="2px"
|
||||
rounded="md"
|
||||
shadow="sm"
|
||||
role="group"
|
||||
transition="all 150ms ease-in-out"
|
||||
_hover={{
|
||||
shadow: "md",
|
||||
}}
|
||||
as={motion.div}
|
||||
initial="rest"
|
||||
animate="rest"
|
||||
whileHover="hover"
|
||||
height={"105px"}
|
||||
className="pointer"
|
||||
>
|
||||
<Box position="relative" height="100%" width="100%">
|
||||
<Box
|
||||
position="absolute"
|
||||
top="0"
|
||||
left="0"
|
||||
height="100%"
|
||||
width="100%"
|
||||
display="flex"
|
||||
flexDirection="column"
|
||||
>
|
||||
<Stack
|
||||
height="100%"
|
||||
width="100%"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justify="center"
|
||||
>
|
||||
<span
|
||||
className="d-flex flex-column align-items-center pointer"
|
||||
spacing="1"
|
||||
>
|
||||
<Heading
|
||||
fontSize="lg"
|
||||
color="gray.700"
|
||||
fontWeight="bold"
|
||||
cursor={"pointer"}
|
||||
>
|
||||
Drop images here
|
||||
</Heading>
|
||||
<span
|
||||
fontWeight="light"
|
||||
className="web-text-large text-secondary text-center pointer"
|
||||
>
|
||||
or click to upload
|
||||
</span>
|
||||
</span>
|
||||
</Stack>
|
||||
</Box>
|
||||
<Input
|
||||
{...register("image")}
|
||||
type="file"
|
||||
height="100%"
|
||||
width="100%"
|
||||
position="absolute"
|
||||
top="0"
|
||||
left="0"
|
||||
opacity="0"
|
||||
aria-hidden="true"
|
||||
accept="image/*"
|
||||
onChange={handleImageChange}
|
||||
onDrop={handleImageChange}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
{errors.image && (
|
||||
<span className="text-danger web-text-small fw-bold ps-2 d-flex align-items-center gap-1 mt-1">
|
||||
<TiWarning className="fw-bold fs-5 " /> {errors.image.message}
|
||||
</span>
|
||||
)}
|
||||
<FormHelperText className="web-text-small">
|
||||
Maximum limit of image is 5mb.
|
||||
</FormHelperText>
|
||||
</FormControl> */}
|
||||
|
||||
<Box className=" d-flex justify-content-end mb-5">
|
||||
<Button
|
||||
isLoading={isLoading}
|
||||
spinner={<Loader01 />}
|
||||
color={"whitesmoke"}
|
||||
backgroundColor={"purple.900"}
|
||||
_hover={{
|
||||
backgroundColor: "purple.800",
|
||||
}}
|
||||
type="submit"
|
||||
rounded={"sm"}
|
||||
size="sm"
|
||||
>
|
||||
Create
|
||||
</Button>
|
||||
</Box>
|
||||
</form>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default AddFaq;
|
||||
168
src/Pages/Faq/EditFaq.jsx
Normal file
168
src/Pages/Faq/EditFaq.jsx
Normal file
@@ -0,0 +1,168 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import Header from "../../Components/Header";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Divider,
|
||||
FormControl,
|
||||
FormLabel,
|
||||
Input,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import {
|
||||
useGetFaqByIdQuery,
|
||||
useUpdateFaqMutation,
|
||||
} from "../../Services/api.service";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { TiWarning } from "react-icons/ti";
|
||||
import { addFaq } from "../../Validations/Validations";
|
||||
import FullscreenLoaders from "../../Components/Loaders/FullscreenLoaders";
|
||||
import ToastBox from "../../Components/ToastBox";
|
||||
import ReactQuill from "react-quill";
|
||||
|
||||
const EditFaq = () => {
|
||||
const { id } = useParams();
|
||||
const toast = useToast();
|
||||
const navigate = useNavigate();
|
||||
const { data, error, isLoading } = useGetFaqByIdQuery(id);
|
||||
const [isLoadingEdit, setIsLoadingEdit] = useState(false);
|
||||
const [updateFaq] = useUpdateFaqMutation();
|
||||
const [valueQuill, setValueQuill] = useState(data?.data?.answer);
|
||||
|
||||
console.log(data);
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
reset,
|
||||
formState: { errors },
|
||||
setValue,
|
||||
} = useForm({
|
||||
resolver: yupResolver(addFaq),
|
||||
defaultValues: {
|
||||
question: "",
|
||||
answer: "",
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (data?.data) {
|
||||
setValue("question", data?.data?.question);
|
||||
setValueQuill(data?.data?.answer || ""); // Set initial value for Quill
|
||||
}
|
||||
}, [data, setValue]);
|
||||
|
||||
const onSubmit = async (formData) => {
|
||||
if (!valueQuill || valueQuill.trim() === "") {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox status={"error"} message={"Answer cannot be empty"} />
|
||||
),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
setIsLoadingEdit(true);
|
||||
const updatedData = {
|
||||
...formData,
|
||||
answer: valueQuill, // Include the value from ReactQuill
|
||||
};
|
||||
|
||||
await updateFaq({ id, data: updatedData })
|
||||
.then((response) => {
|
||||
if (response?.data?.statusCode === 200) {
|
||||
setIsLoadingEdit(false);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox status={"success"} message={response?.data?.message} />
|
||||
),
|
||||
});
|
||||
|
||||
reset();
|
||||
navigate("/faq");
|
||||
} else {
|
||||
setIsLoadingEdit(false);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox status={"error"} message={"Something went wrong"} />
|
||||
),
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error updating FAQ:", error);
|
||||
setIsLoadingEdit(false);
|
||||
});
|
||||
};
|
||||
|
||||
if (isLoading) {
|
||||
return <FullscreenLoaders />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Box
|
||||
{...OPACITY_ON_LOAD}
|
||||
overflowY={"scroll"}
|
||||
paddingBottom={50}
|
||||
height={"100vh"}
|
||||
>
|
||||
<Header title={"FAQ"} />
|
||||
|
||||
<Box display={"flex"}>
|
||||
<form
|
||||
onSubmit={handleSubmit(onSubmit)}
|
||||
className="col-7 pt-4 mb-3 overflow-auto p-4"
|
||||
>
|
||||
<FormControl isRequired className="mb-3">
|
||||
<FormLabel className="web-text-large fw-bold rubix-text-dark">
|
||||
Title
|
||||
</FormLabel>
|
||||
<Input
|
||||
{...register("question")}
|
||||
placeholder="Question"
|
||||
className="web-text-medium"
|
||||
size="sm"
|
||||
/>
|
||||
{errors.question && (
|
||||
<span className="text-danger web-text-small fw-bold ps-2 d-flex align-items-center gap-1 mt-1">
|
||||
<TiWarning className="fw-bold fs-5 " />{" "}
|
||||
{errors.question.message}
|
||||
</span>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<FormControl isRequired className="mb-3">
|
||||
<ReactQuill
|
||||
className="rounded-3"
|
||||
theme="snow"
|
||||
value={valueQuill}
|
||||
onChange={setValueQuill}
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
<Box className="d-flex justify-content-end">
|
||||
<Button
|
||||
isLoading={isLoadingEdit}
|
||||
color={"whitesmoke"}
|
||||
backgroundColor={"purple.900"}
|
||||
_hover={{
|
||||
backgroundColor: "purple.800",
|
||||
}}
|
||||
type="submit"
|
||||
size="sm"
|
||||
rounded={"sm"}
|
||||
>
|
||||
Save edit
|
||||
</Button>
|
||||
</Box>
|
||||
<Divider />
|
||||
</form>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default EditFaq;
|
||||
257
src/Pages/Faq/Faq.jsx
Normal file
257
src/Pages/Faq/Faq.jsx
Normal file
@@ -0,0 +1,257 @@
|
||||
import {
|
||||
Box,
|
||||
Image,
|
||||
Menu,
|
||||
MenuButton,
|
||||
MenuItem,
|
||||
MenuList,
|
||||
Portal,
|
||||
Switch,
|
||||
Text,
|
||||
Tooltip,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import { TABLE_PAGINATION } from "../../Constants/Paginations";
|
||||
import {
|
||||
useCreateFaqMutation,
|
||||
useDeleteFaqMutation,
|
||||
useGetFaqQuery,
|
||||
useUpdateFaqStatusMutation,
|
||||
} from "../../Services/api.service";
|
||||
import { useState } from "react";
|
||||
import TabularView from "../../Components/TabularView/TabularView";
|
||||
import CustomAlertDialog from "../../Components/CustomAlertDialog";
|
||||
import { HiDotsVertical } from "react-icons/hi";
|
||||
import { Link } from "react-router-dom";
|
||||
import { formatDate } from "../../Components/Functions/UTCConvertor";
|
||||
import ToastBox from "../../Components/ToastBox";
|
||||
import extractFilename from "../../Components/Functions/FileNameAlter";
|
||||
|
||||
const Faq = () => {
|
||||
const toast = useToast();
|
||||
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [statusFilter, setStatusFilter] = useState("all");
|
||||
|
||||
const [deleteAlert, setDeleteAlert] = useState(false);
|
||||
const [actionId, setActionId] = useState(null);
|
||||
const [actionStatus, setActionStatus] = useState(null);
|
||||
const [deleteIsLoading, setDeleteIsLoading] = useState(false);
|
||||
|
||||
const faqPage = useCreateFaqMutation({
|
||||
page: currentPage,
|
||||
size: pageSize,
|
||||
});
|
||||
|
||||
const { data } = useGetFaqQuery();
|
||||
const faq = data?.data?.rows;
|
||||
console.log(faq);
|
||||
|
||||
const [deleteFaq] = useDeleteFaqMutation();
|
||||
const [updateFaqStatus] = useUpdateFaqStatusMutation();
|
||||
|
||||
const filteredData = faq?.filter((item) => {
|
||||
// Filter by name (case insensitive)
|
||||
const name = item.question;
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
const nameMatches = name.toLowerCase().includes(searchLower);
|
||||
|
||||
// Filter by status
|
||||
const status = item.status;
|
||||
|
||||
const statusMatches =
|
||||
statusFilter === "all" ||
|
||||
(statusFilter === "active" && status === true) ||
|
||||
(statusFilter === "inactive" && status === false);
|
||||
|
||||
return nameMatches && statusMatches;
|
||||
});
|
||||
|
||||
// ====================================================[Table Setup]================================================================
|
||||
const tableHeadRow = [
|
||||
"Title",
|
||||
// "Content",
|
||||
"Active",
|
||||
"Created At",
|
||||
];
|
||||
|
||||
const extractedArray = filteredData?.map((item, index) => {
|
||||
return {
|
||||
Title: (
|
||||
<Link to={`/faq/view/${item.id}`}>
|
||||
<Tooltip
|
||||
className="rounded-2 web-text-xsmall"
|
||||
width={"fit-content"}
|
||||
placement="top"
|
||||
hasArrow
|
||||
label={item?.question}
|
||||
bg="blue.200"
|
||||
>
|
||||
<Box display={"flex"} alignItems={"center"} w={200}>
|
||||
<Text as={"span"} isTruncated={true}>
|
||||
{item?.question}
|
||||
</Text>
|
||||
</Box>
|
||||
</Tooltip>
|
||||
</Link>
|
||||
),
|
||||
Active: (
|
||||
<Switch
|
||||
size={"sm"}
|
||||
colorScheme="teal"
|
||||
onChange={() => handleUpdateStatus(item.id, item?.status)}
|
||||
isChecked={item.status}
|
||||
// disabled={item.status}
|
||||
/>
|
||||
),
|
||||
"Created At": (
|
||||
<span className="d-flex justify-content-between align-items-center">
|
||||
<Text as={"span"} color={"gray.600"} className=" fw-bold">
|
||||
{formatDate(item?.createdAt)}
|
||||
</Text>
|
||||
<Menu>
|
||||
<MenuButton className="link p-1 rounded-1">
|
||||
<HiDotsVertical className="rubix-text-dark fs-6" />
|
||||
</MenuButton>
|
||||
<Portal>
|
||||
<MenuList minWidth="80px">
|
||||
<Link to={`/faq/edit/${item.id}`}>
|
||||
<MenuItem className="web-text-medium">Edit</MenuItem>
|
||||
</Link>
|
||||
<Link to={`/faq/view/${item.id}`}>
|
||||
<MenuItem className="web-text-medium">View</MenuItem>
|
||||
</Link>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setActionId(item.id);
|
||||
setDeleteAlert(true);
|
||||
setActionStatus(item.status);
|
||||
}}
|
||||
className="web-text-medium"
|
||||
>
|
||||
Delete
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Portal>
|
||||
</Menu>
|
||||
</span>
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
// ====================================================[Functions]===================================================================
|
||||
const handleDelete = async (communityId, status) => {
|
||||
if (status) {
|
||||
return toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"warn"}
|
||||
message={"Can't delete Partner. Status is true."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
// Trigger the mutation
|
||||
setDeleteIsLoading(true);
|
||||
const response = await deleteFaq(communityId);
|
||||
|
||||
// Handle the response here
|
||||
console.log("Mutation response:", response?.data?.statusCode);
|
||||
console.log("Mutation response:", response?.data?.message);
|
||||
|
||||
if (response?.data?.statusCode === 200) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox status={"success"} message={response?.data?.message} />
|
||||
),
|
||||
});
|
||||
} else {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"error"}
|
||||
message={"Failed to delete partner. Please try again."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error deleting community:", error);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"error"}
|
||||
message={"Error deleting partner. Please try again."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
} finally {
|
||||
// Ensure the loading state is reset and alert is closed
|
||||
setDeleteIsLoading(false);
|
||||
setDeleteAlert(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleUpdateStatus = async (id) => {
|
||||
try {
|
||||
await updateFaqStatus({ id })
|
||||
.then((response) => {
|
||||
console.log(response?.data);
|
||||
if (response?.data?.statusCode === 201) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"success"}
|
||||
message={"Please toggle another banner."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
|
||||
// whitePaper?.refetch()
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
} catch (error) {
|
||||
// Handle errors
|
||||
console.error("Error updating community status:", error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<TabularView
|
||||
title={"FAQ"}
|
||||
btnTitle={"Create Faq"}
|
||||
link={"/faq/add-faq"}
|
||||
apiData={faq}
|
||||
tableHeadRow={tableHeadRow}
|
||||
extractedArray={extractedArray}
|
||||
searchTerm={searchTerm}
|
||||
setSearchTerm={setSearchTerm}
|
||||
statusFilter={statusFilter}
|
||||
setStatusFilter={setStatusFilter}
|
||||
pageSize={pageSize}
|
||||
setPageSize={setPageSize}
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalPages={faq?.data?.data?.totalPages}
|
||||
noDataTitle={"faq"}
|
||||
/>
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlert(false)}
|
||||
isOpen={deleteAlert}
|
||||
alertHandler={() => handleDelete(actionId)}
|
||||
message={"Are you sure you want to delete Faq?"}
|
||||
isLoading={deleteIsLoading}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Faq;
|
||||
96
src/Pages/Faq/ViewFaq.jsx
Normal file
96
src/Pages/Faq/ViewFaq.jsx
Normal file
@@ -0,0 +1,96 @@
|
||||
import React from "react";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import { Box, Divider, Image, Tag, Text, useToast } from "@chakra-ui/react";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import Header from "../../Components/Header";
|
||||
import {
|
||||
useGetFaqByIdQuery,
|
||||
useGetPolicyByIdQuery,
|
||||
} from "../../Services/api.service";
|
||||
import { AttachmentIcon } from "@chakra-ui/icons";
|
||||
import extractFilename from "../../Components/Functions/FileNameAlter";
|
||||
import FullscreenLoaders from "../../Components/Loaders/FullscreenLoaders";
|
||||
import pdf from "../../assets/pdfscreen.png";
|
||||
|
||||
const ViewFaq = () => {
|
||||
const { id } = useParams();
|
||||
const toast = useToast();
|
||||
const navigate = useNavigate();
|
||||
const { data, error, isLoading } = useGetFaqByIdQuery(id);
|
||||
const viewFaq = data?.data;
|
||||
|
||||
// console.log(viewPolicy?.banner_image);
|
||||
// console.log(`https://rubix.betadelivery.com/${viewPolicy?.banner_image}`);
|
||||
|
||||
if (isLoading) {
|
||||
return <FullscreenLoaders />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Box
|
||||
{...OPACITY_ON_LOAD}
|
||||
w={"100%"}
|
||||
h={"100vh"}
|
||||
className="overflow-auto "
|
||||
display={"flex"}
|
||||
flexDirection={"column"}
|
||||
>
|
||||
<Header title={"FAQ"} btnTitle={"Edit FAQ"} link={`/faq/edit/${id}`} />
|
||||
|
||||
<Box display={"flex"}>
|
||||
{/* <Box className="col-5 d-flex flex-column gap-2 pt-4">
|
||||
<Box
|
||||
boxSize="sm"
|
||||
className="d-flex h-auto w-100 justify-content-start flex-column align-items-center gap-3"
|
||||
>
|
||||
<Image
|
||||
shadow={"md"}
|
||||
rounded={8}
|
||||
objectFit="cover"
|
||||
w={500}
|
||||
h={240}
|
||||
src={`https://rubix.betadelivery.com/${viewPolicy?.banner_image}`}
|
||||
alt="Selected Image"
|
||||
/>
|
||||
</Box>
|
||||
</Box> */}
|
||||
|
||||
<Box className="col-7 pt-4 p-4">
|
||||
<Box>
|
||||
<Box className="web-text-large fw-bold mb-1 rubix-text-dark">
|
||||
Status
|
||||
</Box>
|
||||
{viewFaq?.status ? (
|
||||
<Tag size={"sm"} borderRadius="full" colorScheme="teal">
|
||||
Active
|
||||
</Tag>
|
||||
) : (
|
||||
<Tag size={"sm"} borderRadius="full" colorScheme="red">
|
||||
Inactive
|
||||
</Tag>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<Box className="mb-3">
|
||||
<Box className="web-text-large fw-bold rubix-text-dark">Title</Box>
|
||||
<Box className="web-text-medium text-secondary">
|
||||
{viewFaq?.question}
|
||||
</Box>
|
||||
</Box>
|
||||
<Box className="mb-3">
|
||||
<Box className="web-text-large fw-bold rubix-text-dark">
|
||||
Content
|
||||
</Box>
|
||||
<Box className="web-text-medium text-secondary">
|
||||
{viewFaq?.answer}
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<Divider />
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ViewFaq;
|
||||
217
src/Pages/NewLetter/NewsLetter.jsx
Normal file
217
src/Pages/NewLetter/NewsLetter.jsx
Normal file
@@ -0,0 +1,217 @@
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Image,
|
||||
Menu,
|
||||
MenuButton,
|
||||
MenuItem,
|
||||
MenuList,
|
||||
Portal,
|
||||
Switch,
|
||||
Text,
|
||||
Tooltip,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import { TABLE_PAGINATION } from "../../Constants/Paginations";
|
||||
import {
|
||||
useDeleteEmailMutation,
|
||||
useGetNewsLetterEmailQuery,
|
||||
useGetNewsLetterQuery,
|
||||
} from "../../Services/api.service";
|
||||
import { useState } from "react";
|
||||
import TabularView from "../../Components/TabularView/TabularView";
|
||||
import CustomAlertDialog from "../../Components/CustomAlertDialog";
|
||||
import { HiDotsVertical } from "react-icons/hi";
|
||||
import { Link } from "react-router-dom";
|
||||
import { formatDate } from "../../Components/Functions/UTCConvertor";
|
||||
import ToastBox from "../../Components/ToastBox";
|
||||
import extractFilename from "../../Components/Functions/FileNameAlter";
|
||||
import { DeleteIcon } from "@chakra-ui/icons";
|
||||
|
||||
const NewsLetter = () => {
|
||||
const toast = useToast();
|
||||
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [statusFilter, setStatusFilter] = useState("all");
|
||||
|
||||
const [deleteAlert, setDeleteAlert] = useState(false);
|
||||
const [actionId, setActionId] = useState(null);
|
||||
const [actionStatus, setActionStatus] = useState(null);
|
||||
const [deleteIsLoading, setDeleteIsLoading] = useState(false);
|
||||
|
||||
const { data } = useGetNewsLetterQuery();
|
||||
// console.log(useGetNewsletterQuery);
|
||||
const faq = data?.data?.rows;
|
||||
console.log(faq);
|
||||
|
||||
const [deleteEmail] = useDeleteEmailMutation();
|
||||
// const [updateFaqStatus] = useUpdateFaqStatusMutation();
|
||||
|
||||
const handleDelete = async (communityId, status) => {
|
||||
if (status) {
|
||||
return toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"warn"}
|
||||
message={"Can't delete Email. Status is true."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
// Trigger the mutation
|
||||
setDeleteIsLoading(true);
|
||||
const response = await deleteEmail(communityId);
|
||||
|
||||
// Handle the response here
|
||||
console.log("Mutation response:", response?.data?.statusCode);
|
||||
console.log("Mutation response:", response?.data?.message);
|
||||
|
||||
if (response?.data?.statusCode === 200) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox status={"success"} message={response?.data?.message} />
|
||||
),
|
||||
});
|
||||
} else {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"error"}
|
||||
message={"Failed to delete partner. Please try again."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error deleting community:", error);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"error"}
|
||||
message={"Error deleting partner. Please try again."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
} finally {
|
||||
// Ensure the loading state is reset and alert is closed
|
||||
setDeleteIsLoading(false);
|
||||
setDeleteAlert(false);
|
||||
}
|
||||
};
|
||||
|
||||
// ====================================================[Table Setup]================================================================
|
||||
const tableHeadRow = [
|
||||
"Title",
|
||||
// "Content",
|
||||
"Created At",
|
||||
"Actions",
|
||||
];
|
||||
|
||||
const extractedArray = faq?.map((item, index) => {
|
||||
return {
|
||||
Title: (
|
||||
<Link w={200} to={`/faq/view/${item.id}`}>
|
||||
<Tooltip
|
||||
className="rounded-2 web-text-xsmall"
|
||||
width={"fit-content"}
|
||||
placement="top"
|
||||
hasArrow
|
||||
label={item?.email}
|
||||
bg="blue.200"
|
||||
>
|
||||
<Box display={"flex"} alignItems={"center"} w={200}>
|
||||
<Text as={"span"} isTruncated={true}>
|
||||
{item?.email}
|
||||
</Text>
|
||||
</Box>
|
||||
</Tooltip>
|
||||
</Link>
|
||||
),
|
||||
"Created At": (
|
||||
<Box
|
||||
w={200}
|
||||
className="d-flex justify-content-between align-items-center"
|
||||
>
|
||||
<Text as={"span"} color={"gray.600"} className=" fw-bold">
|
||||
{formatDate(item?.createdAt)}
|
||||
</Text>
|
||||
{/* <Menu>
|
||||
<MenuButton className="link p-1 rounded-1">
|
||||
<HiDotsVertical className="rubix-text-dark fs-6" />
|
||||
</MenuButton>
|
||||
<Portal>
|
||||
<MenuList minWidth="80px">
|
||||
<Link to={`/faq/edit/${item.id}`}>
|
||||
<MenuItem className="web-text-medium">Edit</MenuItem>
|
||||
</Link>
|
||||
<Link to={`/faq/view/${item.id}`}>
|
||||
<MenuItem className="web-text-medium">View</MenuItem>
|
||||
</Link>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setActionId(item.id);
|
||||
setDeleteAlert(true);
|
||||
setActionStatus(item.status);
|
||||
}}
|
||||
className="web-text-medium"
|
||||
>
|
||||
Delete
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Portal>
|
||||
</Menu> */}
|
||||
</Box>
|
||||
),
|
||||
Actions: (
|
||||
<Box w={200}>
|
||||
<Button
|
||||
size={"xs"}
|
||||
colorScheme="red"
|
||||
variant="ghost"
|
||||
onClick={() => handleDelete(item.id)}
|
||||
>
|
||||
<DeleteIcon me={2} /> Delete
|
||||
</Button>
|
||||
</Box>
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
// ====================================================[Functions]===================================================================
|
||||
|
||||
return (
|
||||
<>
|
||||
<TabularView
|
||||
title={"News Letter"}
|
||||
btnTitle={"Export email"}
|
||||
link={"/faq/add-faq"}
|
||||
apiData={faq}
|
||||
tableHeadRow={tableHeadRow}
|
||||
extractedArray={extractedArray}
|
||||
searchTerm={searchTerm}
|
||||
setSearchTerm={setSearchTerm}
|
||||
statusFilter={statusFilter}
|
||||
setStatusFilter={setStatusFilter}
|
||||
pageSize={pageSize}
|
||||
setPageSize={setPageSize}
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalPages={faq?.data?.data?.totalPages}
|
||||
noDataTitle={"faq"}
|
||||
/>
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlert(false)}
|
||||
isOpen={deleteAlert}
|
||||
alertHandler={() => handleDelete(actionId)}
|
||||
message={"Are you sure you want to delete Faq?"}
|
||||
isLoading={deleteIsLoading}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default NewsLetter;
|
||||
349
src/Pages/Partners/AddPartners.jsx
Normal file
349
src/Pages/Partners/AddPartners.jsx
Normal file
@@ -0,0 +1,349 @@
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Divider,
|
||||
FormControl,
|
||||
FormHelperText,
|
||||
FormLabel,
|
||||
Heading,
|
||||
Image,
|
||||
Input,
|
||||
Stack,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import React, { useState } from "react";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import Header from "../../Components/Header";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import fallbackImage from "../../assets/ultp-fallback-img.webp";
|
||||
import {
|
||||
addPartnerCard,
|
||||
addPolicy,
|
||||
addTerms,
|
||||
addWhitePapers,
|
||||
} from "../../Validations/Validations";
|
||||
import { TiWarning } from "react-icons/ti";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { motion } from "framer-motion";
|
||||
import Loader01 from "../../Components/Loaders/Loader01";
|
||||
import {
|
||||
useCreatePartnersMutation,
|
||||
useCreatePolicyMutation,
|
||||
} from "../../Services/api.service";
|
||||
import ToastBox from "../../Components/ToastBox";
|
||||
import ReactQuill from "react-quill";
|
||||
|
||||
const AddPartner = () => {
|
||||
const toast = useToast();
|
||||
const navigate = useNavigate();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [selectedImage, setSelectedImage] = useState(fallbackImage);
|
||||
const [imageData, setImageData] = useState(null);
|
||||
const [value, setValue] = useState("");
|
||||
|
||||
const [createPartner] = useCreatePartnersMutation();
|
||||
|
||||
// const termContent = data?.data;
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
reset,
|
||||
// setValue: setYupFormValue,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
resolver: yupResolver(addPartnerCard),
|
||||
defaultValues: {
|
||||
website_link: "",
|
||||
description: "",
|
||||
banner_image: "",
|
||||
},
|
||||
});
|
||||
|
||||
console.log(errors);
|
||||
const handleImageChange = (e) => {
|
||||
const file = e.target.files[0];
|
||||
setImageData(file);
|
||||
// setYupFormValue("banner_image", file);
|
||||
console.log(file);
|
||||
if (file) {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => {
|
||||
setSelectedImage(reader.result);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
// setYupFormValue("description", value);
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const formData = new FormData();
|
||||
formData.append("website_link", data?.website_link);
|
||||
formData.append("description", data?.description);
|
||||
console.log(selectedImage);
|
||||
if (data?.banner_image) {
|
||||
formData.append("banner_image", data?.banner_image[0]);
|
||||
}
|
||||
for (let [key, value] of formData.entries()) {
|
||||
console.log(key, value);
|
||||
}
|
||||
// Trigger the mutation
|
||||
createPartner(formData)
|
||||
.then((response) => {
|
||||
// Handle the response here
|
||||
|
||||
if (response?.data?.statusCode === 200) {
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"success"}
|
||||
message={response?.data?.message}
|
||||
/>
|
||||
),
|
||||
});
|
||||
reset();
|
||||
navigate("/partners");
|
||||
} else if (response?.data?.statusCode === 500) {
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"success"}
|
||||
message={response?.data?.message}
|
||||
/>
|
||||
),
|
||||
});
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"Some thing went wrong"}
|
||||
message={"Some thing went wrong"}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// Handle errors
|
||||
console.error("Error creating community:", error);
|
||||
setIsLoading(false);
|
||||
// Handle error notification if needed
|
||||
});
|
||||
} catch (error) {
|
||||
// Handle errors
|
||||
console.error("Error creating community:", error);
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box
|
||||
{...OPACITY_ON_LOAD}
|
||||
w={"100%"}
|
||||
h={"100vh"}
|
||||
className="overflow-auto "
|
||||
display={"flex"}
|
||||
flexDirection={"column"}
|
||||
>
|
||||
<Header title={"Partners Card"} />
|
||||
|
||||
<Box className="d-flex">
|
||||
<Box className="col-5 d-flex flex-column gap-2 pt-4">
|
||||
<Box
|
||||
boxSize="sm"
|
||||
className="d-flex w-100 justify-content-center flex-column align-items-center gap-3"
|
||||
>
|
||||
<Image
|
||||
shadow={"md"}
|
||||
rounded={8}
|
||||
w={500}
|
||||
h={240}
|
||||
src={selectedImage}
|
||||
alt="Selected Image"
|
||||
/>
|
||||
{selectedImage === fallbackImage || imageData === null ? (
|
||||
""
|
||||
) : (
|
||||
<Box display={"flex"} flexDirection={"column"} w={"100%"}>
|
||||
<span className="web-text-small">{imageData?.name}</span>
|
||||
<span className="web-text-small text-secondary fst-italic">
|
||||
{(imageData?.size / (1024 * 1024)).toFixed(2)} mb
|
||||
</span>
|
||||
</Box>
|
||||
)}
|
||||
<Button
|
||||
onClick={() => setSelectedImage(fallbackImage)}
|
||||
backgroundColor="red.400"
|
||||
color={"whitesmoke"}
|
||||
transition={"0.5s"}
|
||||
_hover={{
|
||||
backgroundColor: "red.500",
|
||||
}}
|
||||
size="xs"
|
||||
>
|
||||
Remove
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<form
|
||||
onSubmit={handleSubmit(onSubmit)}
|
||||
className="col-7 pt-4 mb-3 overflow-auto p-4"
|
||||
>
|
||||
<FormControl isRequired className="mb-3">
|
||||
<FormLabel className="web-text-large fw-bold rubix-text-dark">
|
||||
Description
|
||||
</FormLabel>
|
||||
<Input
|
||||
{...register("description")}
|
||||
placeholder="Description"
|
||||
className="web-text-medium"
|
||||
size="sm"
|
||||
/>
|
||||
{errors.description && (
|
||||
<span className="text-danger web-text-small fw-bold ps-2 d-flex align-items-center gap-1 mt-1">
|
||||
<TiWarning className="fw-bold fs-5 " />{" "}
|
||||
{errors.description.message}
|
||||
</span>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<FormControl isRequired className="mb-3">
|
||||
<FormLabel className="web-text-large fw-bold rubix-text-dark">
|
||||
Website Link
|
||||
</FormLabel>
|
||||
<Input
|
||||
{...register("website_link")}
|
||||
placeholder="Website links"
|
||||
className="web-text-medium"
|
||||
size="sm"
|
||||
/>
|
||||
{errors.website_link && (
|
||||
<span className="text-danger web-text-small fw-bold ps-2 d-flex align-items-center gap-1 mt-1">
|
||||
<TiWarning className="fw-bold fs-5 " />{" "}
|
||||
{errors.website_link.message}
|
||||
</span>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<FormControl isRequired className="mb-3">
|
||||
<FormLabel className="web-text-large fw-bold rubix-text-dark">
|
||||
Partner Logo
|
||||
</FormLabel>
|
||||
{/* <ImageDropBox /> */}
|
||||
|
||||
<Box
|
||||
borderColor="gray.300"
|
||||
borderStyle="dashed"
|
||||
borderWidth="2px"
|
||||
rounded="md"
|
||||
shadow="sm"
|
||||
role="group"
|
||||
transition="all 150ms ease-in-out"
|
||||
_hover={{
|
||||
shadow: "md",
|
||||
}}
|
||||
as={motion.div}
|
||||
initial="rest"
|
||||
animate="rest"
|
||||
whileHover="hover"
|
||||
height={"105px"}
|
||||
className="pointer"
|
||||
>
|
||||
<Box position="relative" height="100%" width="100%">
|
||||
<Box
|
||||
position="absolute"
|
||||
top="0"
|
||||
left="0"
|
||||
height="100%"
|
||||
width="100%"
|
||||
display="flex"
|
||||
flexDirection="column"
|
||||
>
|
||||
<Stack
|
||||
height="100%"
|
||||
width="100%"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justify="center"
|
||||
>
|
||||
<span
|
||||
className="d-flex flex-column align-items-center pointer"
|
||||
spacing="1"
|
||||
>
|
||||
<Heading
|
||||
fontSize="lg"
|
||||
color="gray.700"
|
||||
fontWeight="bold"
|
||||
cursor={"pointer"}
|
||||
>
|
||||
Drop images here
|
||||
</Heading>
|
||||
<span
|
||||
fontWeight="light"
|
||||
className="web-text-large text-secondary text-center pointer"
|
||||
>
|
||||
or click to upload
|
||||
</span>
|
||||
</span>
|
||||
</Stack>
|
||||
</Box>
|
||||
<Input
|
||||
{...register("banner_image")}
|
||||
type="file"
|
||||
height="100%"
|
||||
width="100%"
|
||||
position="absolute"
|
||||
top="0"
|
||||
left="0"
|
||||
opacity="0"
|
||||
aria-hidden="true"
|
||||
accept="image/*"
|
||||
onChange={handleImageChange}
|
||||
onDrop={handleImageChange}
|
||||
// onDragEnter={startAnimation}
|
||||
// onDragLeave={stopAnimation}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
{errors.company_logo && (
|
||||
<span className="text-danger web-text-small fw-bold ps-2 d-flex align-items-center gap-1 mt-1">
|
||||
<TiWarning className="fw-bold fs-5 " />{" "}
|
||||
{errors.company_logo.message}
|
||||
</span>
|
||||
)}
|
||||
<FormHelperText className="web-text-small">
|
||||
Maximum limit of image is 5mb.
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
|
||||
<Box className=" d-flex justify-content-end mb-5">
|
||||
<Button
|
||||
isLoading={isLoading}
|
||||
spinner={<Loader01 />}
|
||||
color={"whitesmoke"}
|
||||
backgroundColor={"purple.900"}
|
||||
_hover={{
|
||||
backgroundColor: "purple.800",
|
||||
}}
|
||||
type="submit"
|
||||
rounded={"sm"}
|
||||
size="sm"
|
||||
>
|
||||
Create
|
||||
</Button>
|
||||
</Box>
|
||||
</form>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default AddPartner;
|
||||
353
src/Pages/Partners/EditPartners.jsx
Normal file
353
src/Pages/Partners/EditPartners.jsx
Normal file
@@ -0,0 +1,353 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import Header from "../../Components/Header";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Divider,
|
||||
FormControl,
|
||||
FormHelperText,
|
||||
FormLabel,
|
||||
Heading,
|
||||
Image,
|
||||
Input,
|
||||
Stack,
|
||||
Text,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import fallbackImage from "../../assets/ultp-fallback-img.webp";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import {
|
||||
useGetPartnersByIdQuery,
|
||||
useGetPolicyByIdQuery,
|
||||
useUpdatePartnersMutation,
|
||||
useUpdatePolicyMutation,
|
||||
} from "../../Services/api.service";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { TiWarning } from "react-icons/ti";
|
||||
import { addPartnerCard, addPolicy } from "../../Validations/Validations";
|
||||
import FullscreenLoaders from "../../Components/Loaders/FullscreenLoaders";
|
||||
import { AttachmentIcon } from "@chakra-ui/icons";
|
||||
import extractFilename from "../../Components/Functions/FileNameAlter";
|
||||
import Loader01 from "../../Components/Loaders/Loader01";
|
||||
import { motion } from "framer-motion";
|
||||
import ToastBox from "../../Components/ToastBox";
|
||||
import ReactQuill from "react-quill";
|
||||
|
||||
const EditPartner = () => {
|
||||
const { id } = useParams();
|
||||
const toast = useToast();
|
||||
const navigate = useNavigate();
|
||||
const { data, error, isLoading } = useGetPartnersByIdQuery(id);
|
||||
const [isLoadingEdit, setIsLoadingEdit] = useState(false);
|
||||
const [selectedImage, setSelectedImage] = useState(fallbackImage);
|
||||
const [largeImageData, setLargeImageData] = useState(null);
|
||||
const [updatePartners] = useUpdatePartnersMutation();
|
||||
const [valueQuill, setValueQuill] = useState(data?.data?.content);
|
||||
|
||||
console.log(valueQuill);
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
reset,
|
||||
formState: { errors },
|
||||
setValue,
|
||||
} = useForm({
|
||||
resolver: yupResolver(addPartnerCard),
|
||||
defaultValues: {
|
||||
website_link: "",
|
||||
description: "",
|
||||
company_logo: null,
|
||||
},
|
||||
});
|
||||
|
||||
const partnerCard = data?.data;
|
||||
// console.log(termContent);
|
||||
|
||||
useEffect(() => {
|
||||
if (data?.data) {
|
||||
setSelectedImage(
|
||||
`https://rubix.betadelivery.com/${data?.data?.company_logo}`
|
||||
);
|
||||
setValue("website_link", data?.data?.website_link);
|
||||
setValue("description", data?.data?.description);
|
||||
setValue("company_logo", data?.data?.company_logo);
|
||||
// setValueQuill(data?.data?.content);
|
||||
}
|
||||
}, [data, setValue]);
|
||||
|
||||
const handleImageChange = (e) => {
|
||||
const file = e.target.files[0];
|
||||
setLargeImageData(file);
|
||||
if (file) {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => {
|
||||
setSelectedImage(reader.result);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
console.log(data);
|
||||
|
||||
setIsLoadingEdit(true);
|
||||
const form = new FormData();
|
||||
form.append("website_link", data?.website_link);
|
||||
form.append("description", data?.description);
|
||||
if (data?.company_logo[0]) {
|
||||
form.append("company_logo", data?.company_logo[0]);
|
||||
}
|
||||
|
||||
// Log formData entries
|
||||
for (let [key, value] of form.entries()) {
|
||||
console.log(`${key}: ${value}`);
|
||||
}
|
||||
|
||||
await updatePartners({ id: id, data: form })
|
||||
.then((response) => {
|
||||
// console.log(response?.error?.data?.error?.message);
|
||||
if (response?.data?.statusCode === 200) {
|
||||
setIsLoadingEdit(false);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox status={"success"} message={response?.data?.message} />
|
||||
),
|
||||
});
|
||||
|
||||
reset();
|
||||
navigate("/partners");
|
||||
// setDeleteAlert(false);
|
||||
} else {
|
||||
setIsLoadingEdit(false);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox status={"error"} message={"Something went wrong"} />
|
||||
),
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error creating community:", error);
|
||||
setIsLoadingEdit(false);
|
||||
// setDeleteIsLoading(false);
|
||||
// setDeleteAlert(false);
|
||||
});
|
||||
};
|
||||
|
||||
console.log(errors);
|
||||
if (isLoading) {
|
||||
return <FullscreenLoaders />;
|
||||
}
|
||||
return (
|
||||
<Box
|
||||
{...OPACITY_ON_LOAD}
|
||||
overflowY={"scroll"}
|
||||
paddingBottom={50}
|
||||
height={"100vh"}
|
||||
>
|
||||
<Header title={"Partners Card"} />
|
||||
|
||||
<Box display={"flex"}>
|
||||
<Box className="col-5 d-flex flex-column gap-2 pt-4">
|
||||
<Box
|
||||
boxSize="sm"
|
||||
className="d-flex w-100 justify-content-center flex-column align-items-center gap-3"
|
||||
>
|
||||
<Image
|
||||
shadow={"md"}
|
||||
rounded={8}
|
||||
w={"100%"}
|
||||
h={240}
|
||||
src={selectedImage}
|
||||
alt="Selected Image"
|
||||
/>
|
||||
{selectedImage === fallbackImage || largeImageData === null ? (
|
||||
""
|
||||
) : (
|
||||
<Box display={"flex"} flexDirection={"column"} w={"100%"}>
|
||||
<span className="web-text-small">
|
||||
{largeImageData && largeImageData?.name}
|
||||
</span>
|
||||
<span className="web-text-small text-secondary fst-italic">
|
||||
{largeImageData &&
|
||||
(largeImageData?.size / (1024 * 1024)).toFixed(2)}{" "}
|
||||
mb
|
||||
</span>
|
||||
</Box>
|
||||
)}
|
||||
<Button
|
||||
onClick={() => setSelectedImage(fallbackImage)}
|
||||
backgroundColor="red.400"
|
||||
color={"whitesmoke"}
|
||||
transition={"0.5s"}
|
||||
_hover={{
|
||||
backgroundColor: "red.500",
|
||||
}}
|
||||
size="xs"
|
||||
>
|
||||
Remove
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
<Divider />
|
||||
</Box>
|
||||
|
||||
<form
|
||||
onSubmit={handleSubmit(onSubmit)}
|
||||
className="col-7 pt-4 mb-3 overflow-auto p-4"
|
||||
>
|
||||
<FormControl isRequired className="mb-3">
|
||||
<FormLabel className="web-text-large fw-bold rubix-text-dark">
|
||||
Description
|
||||
</FormLabel>
|
||||
<Input
|
||||
{...register("description")}
|
||||
placeholder="Description"
|
||||
className="web-text-medium"
|
||||
size="sm"
|
||||
/>
|
||||
{errors.description && (
|
||||
<span className="text-danger web-text-small fw-bold ps-2 d-flex align-items-center gap-1 mt-1">
|
||||
<TiWarning className="fw-bold fs-5 " />{" "}
|
||||
{errors.description.message}
|
||||
</span>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<FormControl isRequired className="mb-3">
|
||||
<FormLabel className="web-text-large fw-bold rubix-text-dark">
|
||||
Website Link
|
||||
</FormLabel>
|
||||
<Input
|
||||
{...register("website_link")}
|
||||
placeholder="Website links"
|
||||
className="web-text-medium"
|
||||
size="sm"
|
||||
/>
|
||||
{errors.website_link && (
|
||||
<span className="text-danger web-text-small fw-bold ps-2 d-flex align-items-center gap-1 mt-1">
|
||||
<TiWarning className="fw-bold fs-5 " />{" "}
|
||||
{errors.website_link.message}
|
||||
</span>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<FormControl className="mb-3">
|
||||
<FormLabel className="web-text-large fw-bold rubix-text-dark">
|
||||
Display profile
|
||||
</FormLabel>
|
||||
{/* <ImageDropBox /> */}
|
||||
|
||||
<Box
|
||||
borderColor="gray.300"
|
||||
borderStyle="dashed"
|
||||
borderWidth="2px"
|
||||
rounded="md"
|
||||
shadow="sm"
|
||||
role="group"
|
||||
transition="all 150ms ease-in-out"
|
||||
_hover={{
|
||||
shadow: "md",
|
||||
}}
|
||||
as={motion.div}
|
||||
initial="rest"
|
||||
animate="rest"
|
||||
whileHover="hover"
|
||||
height={"105px"}
|
||||
className="pointer"
|
||||
>
|
||||
<Box position="relative" height="100%" width="100%">
|
||||
<Box
|
||||
position="absolute"
|
||||
top="0"
|
||||
left="0"
|
||||
height="100%"
|
||||
width="100%"
|
||||
display="flex"
|
||||
flexDirection="column"
|
||||
>
|
||||
<Stack
|
||||
height="100%"
|
||||
width="100%"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justify="center"
|
||||
>
|
||||
<span
|
||||
className="d-flex flex-column align-items-center pointer"
|
||||
spacing="1"
|
||||
>
|
||||
<Heading
|
||||
fontSize="lg"
|
||||
color="gray.700"
|
||||
fontWeight="bold"
|
||||
cursor={"pointer"}
|
||||
>
|
||||
Drop images here
|
||||
</Heading>
|
||||
<span
|
||||
fontWeight="light"
|
||||
className="web-text-large text-secondary text-center pointer"
|
||||
>
|
||||
or click to upload
|
||||
</span>
|
||||
</span>
|
||||
</Stack>
|
||||
</Box>
|
||||
<Input
|
||||
{...register("image")}
|
||||
type="file"
|
||||
height="100%"
|
||||
width="100%"
|
||||
position="absolute"
|
||||
top="0"
|
||||
left="0"
|
||||
opacity="0"
|
||||
aria-hidden="true"
|
||||
accept="image/*"
|
||||
onChange={handleImageChange}
|
||||
onDrop={handleImageChange}
|
||||
// onDragEnter={startAnimation}
|
||||
// onDragLeave={stopAnimation}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
{errors.image && (
|
||||
<span className="text-danger web-text-small fw-bold ps-2 d-flex align-items-center gap-1 mt-1">
|
||||
<TiWarning className="fw-bold fs-5 " /> {errors.image.message}
|
||||
</span>
|
||||
)}
|
||||
<FormHelperText className="web-text-small">
|
||||
Maximum limit of image should be 1mb to protect website from slow
|
||||
loading.
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
|
||||
<Box className=" d-flex justify-content-end ">
|
||||
<Button
|
||||
isLoading={isLoadingEdit}
|
||||
spinner={<Loader01 />}
|
||||
color={"whitesmoke"}
|
||||
backgroundColor={"purple.900"}
|
||||
_hover={{
|
||||
backgroundColor: "purple.800",
|
||||
}}
|
||||
type="submit"
|
||||
size="sm"
|
||||
rounded={"sm"}
|
||||
>
|
||||
Save edit
|
||||
</Button>
|
||||
</Box>
|
||||
<Divider />
|
||||
</form>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default EditPartner;
|
||||
306
src/Pages/Partners/Partner.jsx
Normal file
306
src/Pages/Partners/Partner.jsx
Normal file
@@ -0,0 +1,306 @@
|
||||
import {
|
||||
Box,
|
||||
Image,
|
||||
Menu,
|
||||
MenuButton,
|
||||
MenuItem,
|
||||
MenuList,
|
||||
Portal,
|
||||
Switch,
|
||||
Text,
|
||||
Tooltip,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import { TABLE_PAGINATION } from "../../Constants/Paginations";
|
||||
import {
|
||||
useCreatePartnersMutation,
|
||||
useDeletePartnersMutation,
|
||||
useGetPartnersQuery,
|
||||
useUpdatePartnersStatusMutation,
|
||||
} from "../../Services/api.service";
|
||||
import { useState } from "react";
|
||||
import TabularView from "../../Components/TabularView/TabularView";
|
||||
import CustomAlertDialog from "../../Components/CustomAlertDialog";
|
||||
import { HiDotsVertical } from "react-icons/hi";
|
||||
import { Link } from "react-router-dom";
|
||||
import { formatDate } from "../../Components/Functions/UTCConvertor";
|
||||
import ToastBox from "../../Components/ToastBox";
|
||||
import extractFilename from "../../Components/Functions/FileNameAlter";
|
||||
|
||||
const Partner = () => {
|
||||
const toast = useToast();
|
||||
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [statusFilter, setStatusFilter] = useState("all");
|
||||
|
||||
const [deleteAlert, setDeleteAlert] = useState(false);
|
||||
const [actionId, setActionId] = useState(null);
|
||||
const [actionStatus, setActionStatus] = useState(null);
|
||||
const [deleteIsLoading, setDeleteIsLoading] = useState(false);
|
||||
|
||||
const partnersPage = useCreatePartnersMutation({
|
||||
page: currentPage,
|
||||
size: pageSize,
|
||||
});
|
||||
|
||||
const partners = useGetPartnersQuery({
|
||||
page: currentPage,
|
||||
size: pageSize,
|
||||
});
|
||||
|
||||
const [deletePartners] = useDeletePartnersMutation();
|
||||
const [updatePartnerStatus] = useUpdatePartnersStatusMutation();
|
||||
|
||||
console.log(partners?.data?.data?.rows);
|
||||
|
||||
const filteredData = partners?.data?.data?.rows?.filter((item) => {
|
||||
// console.log(item.description);
|
||||
// Filter by name (case insensitive)
|
||||
const name = item.description;
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
const nameMatches = name.toLowerCase().includes(searchLower);
|
||||
|
||||
// Filter by status
|
||||
const status = item.status;
|
||||
|
||||
const statusMatches =
|
||||
statusFilter === "all" ||
|
||||
(statusFilter === "active" && status === true) ||
|
||||
(statusFilter === "inactive" && status === false);
|
||||
|
||||
return nameMatches && statusMatches;
|
||||
});
|
||||
|
||||
// ====================================================[Table Setup]================================================================
|
||||
const tableHeadRow = [
|
||||
"Title",
|
||||
// "Content",
|
||||
"Active",
|
||||
"Created At",
|
||||
];
|
||||
|
||||
const extractedArray = filteredData?.map((item, index) => {
|
||||
return {
|
||||
Title: (
|
||||
<Link to={`/partners/view/${item.id}`}>
|
||||
<Tooltip
|
||||
className="rounded-2 web-text-xsmall"
|
||||
width={"fit-content"}
|
||||
placement="top"
|
||||
hasArrow
|
||||
label={item?.description}
|
||||
bg="blue.200"
|
||||
>
|
||||
<Box display={"flex"} alignItems={"center"} w={200}>
|
||||
<Text as={"span"} isTruncated={true}>
|
||||
{extractFilename(item?.description)}
|
||||
</Text>
|
||||
</Box>
|
||||
</Tooltip>
|
||||
</Link>
|
||||
),
|
||||
Active: (
|
||||
<Switch
|
||||
size={"sm"}
|
||||
colorScheme="teal"
|
||||
onChange={() => handleUpdateStatus(item.id, item?.status)}
|
||||
isChecked={item.status}
|
||||
// disabled={item.status}
|
||||
/>
|
||||
),
|
||||
"Created At": (
|
||||
<span className="d-flex justify-content-between align-items-center">
|
||||
<Text as={"span"} color={"gray.600"} className=" fw-bold">
|
||||
{formatDate(item?.createdAt)}
|
||||
</Text>
|
||||
<Menu>
|
||||
<MenuButton className="link p-1 rounded-1">
|
||||
<HiDotsVertical className="rubix-text-dark fs-6" />
|
||||
</MenuButton>
|
||||
<Portal>
|
||||
<MenuList minWidth="80px">
|
||||
<Link to={`/partners/edit/${item.id}`}>
|
||||
<MenuItem className="web-text-medium">Edit</MenuItem>
|
||||
</Link>
|
||||
<Link to={`/partners/view/${item.id}`}>
|
||||
<MenuItem className="web-text-medium">View</MenuItem>
|
||||
</Link>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setActionId(item.id);
|
||||
setDeleteAlert(true);
|
||||
setActionStatus(item.status);
|
||||
}}
|
||||
className="web-text-medium"
|
||||
>
|
||||
Delete
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Portal>
|
||||
</Menu>
|
||||
</span>
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
// ====================================================[Functions]===================================================================
|
||||
// const handleDelete = async (communityId, status) => {
|
||||
// if (status) {
|
||||
// return toast({
|
||||
// render: () => (
|
||||
// <ToastBox
|
||||
// status={"warn"}
|
||||
// message={"Can't delete Partner. Status is true."}
|
||||
// />
|
||||
// ),
|
||||
// });
|
||||
// }
|
||||
|
||||
// try {
|
||||
// // Trigger the mutation
|
||||
// setDeleteIsLoading(true);
|
||||
// await deletePartners(communityId)
|
||||
// .then((response) => {
|
||||
// // Handle the response here
|
||||
// console.log("Mutation response:", response?.data?.statusCode);
|
||||
// console.log("Mutation response:", response?.data?.message);
|
||||
|
||||
// if (response?.data?.statusCode === 201) {
|
||||
// setDeleteIsLoading(false);
|
||||
// setDeleteAlert(false);
|
||||
// toast({
|
||||
// render: () => (
|
||||
// <ToastBox
|
||||
// status={"success"}
|
||||
// message={response?.data?.message}
|
||||
// />
|
||||
// ),
|
||||
// });
|
||||
// }
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// console.error("Error creating community:", error);
|
||||
// setDeleteIsLoading(false);
|
||||
// setDeleteAlert(false);
|
||||
// });
|
||||
// } catch (error) {
|
||||
// // Handle errors
|
||||
// console.log("Error deleting community:", error);
|
||||
// }
|
||||
// };
|
||||
|
||||
const handleDelete = async (communityId, status) => {
|
||||
if (status) {
|
||||
return toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"warn"}
|
||||
message={"Can't delete Partner. Status is true."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
// Trigger the mutation
|
||||
setDeleteIsLoading(true);
|
||||
const response = await deletePartners(communityId);
|
||||
|
||||
// Handle the response here
|
||||
console.log("Mutation response:", response?.data?.statusCode);
|
||||
console.log("Mutation response:", response?.data?.message);
|
||||
|
||||
if (response?.data?.statusCode === 200) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox status={"success"} message={response?.data?.message} />
|
||||
),
|
||||
});
|
||||
} else {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"error"}
|
||||
message={"Failed to delete partner. Please try again."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error deleting community:", error);
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"error"}
|
||||
message={"Error deleting partner. Please try again."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
} finally {
|
||||
// Ensure the loading state is reset and alert is closed
|
||||
setDeleteIsLoading(false);
|
||||
setDeleteAlert(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleUpdateStatus = async (id) => {
|
||||
try {
|
||||
await updatePartnerStatus({ id })
|
||||
.then((response) => {
|
||||
console.log(response?.data);
|
||||
if (response?.data?.statusCode === 201) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"success"}
|
||||
message={"Please toggle another banner."}
|
||||
/>
|
||||
),
|
||||
});
|
||||
|
||||
// whitePaper?.refetch()
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
} catch (error) {
|
||||
// Handle errors
|
||||
console.error("Error updating community status:", error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<TabularView
|
||||
title={"Partners Card"}
|
||||
btnTitle={"Create Partner card"}
|
||||
link={"/partners/add-partners"}
|
||||
apiData={partners}
|
||||
tableHeadRow={tableHeadRow}
|
||||
extractedArray={extractedArray}
|
||||
searchTerm={searchTerm}
|
||||
setSearchTerm={setSearchTerm}
|
||||
statusFilter={statusFilter}
|
||||
setStatusFilter={setStatusFilter}
|
||||
pageSize={pageSize}
|
||||
setPageSize={setPageSize}
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalPages={partners?.data?.data?.totalPages}
|
||||
noDataTitle={"partners"}
|
||||
/>
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlert(false)}
|
||||
isOpen={deleteAlert}
|
||||
alertHandler={() => handleDelete(actionId)}
|
||||
message={"Are you sure you want to delete Partners?"}
|
||||
isLoading={deleteIsLoading}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Partner;
|
||||
100
src/Pages/Partners/ViewPartner.jsx
Normal file
100
src/Pages/Partners/ViewPartner.jsx
Normal file
@@ -0,0 +1,100 @@
|
||||
import React from "react";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import { Box, Divider, Image, Tag, Text, useToast } from "@chakra-ui/react";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import Header from "../../Components/Header";
|
||||
import {
|
||||
useGetPartnersByIdQuery,
|
||||
useGetPolicyByIdQuery,
|
||||
} from "../../Services/api.service";
|
||||
import { AttachmentIcon } from "@chakra-ui/icons";
|
||||
import extractFilename from "../../Components/Functions/FileNameAlter";
|
||||
import FullscreenLoaders from "../../Components/Loaders/FullscreenLoaders";
|
||||
import pdf from "../../assets/pdfscreen.png";
|
||||
|
||||
const ViewPartner = () => {
|
||||
const { id } = useParams();
|
||||
const toast = useToast();
|
||||
const navigate = useNavigate();
|
||||
const { data, error, isLoading } = useGetPartnersByIdQuery(id);
|
||||
const viewPolicy = data?.data;
|
||||
|
||||
console.log(viewPolicy);
|
||||
console.log(`https://rubix.betadelivery.com/${viewPolicy?.company_logo}`);
|
||||
|
||||
if (isLoading) {
|
||||
return <FullscreenLoaders />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Box
|
||||
{...OPACITY_ON_LOAD}
|
||||
w={"100%"}
|
||||
h={"100vh"}
|
||||
className="overflow-auto "
|
||||
display={"flex"}
|
||||
flexDirection={"column"}
|
||||
>
|
||||
<Header
|
||||
title={"Privacy Policy"}
|
||||
btnTitle={"Edit Privacy Policy"}
|
||||
link={`/policy/edit/${id}`}
|
||||
/>
|
||||
|
||||
<Box display={"flex"}>
|
||||
<Box className="col-5 d-flex flex-column gap-2 pt-4">
|
||||
<Box
|
||||
boxSize="sm"
|
||||
className="d-flex h-auto w-100 justify-content-start flex-column align-items-center gap-3"
|
||||
>
|
||||
<Image
|
||||
shadow={"md"}
|
||||
rounded={8}
|
||||
objectFit="cover"
|
||||
w={500}
|
||||
h={240}
|
||||
src={`https://rubix.betadelivery.com/${viewPolicy?.company_logo}`}
|
||||
alt="Selected Image"
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<Box className="col-7 pt-4 p-4">
|
||||
<Box>
|
||||
<Box className="web-text-large fw-bold mb-1 rubix-text-dark">
|
||||
Status
|
||||
</Box>
|
||||
{viewPolicy?.status ? (
|
||||
<Tag size={"sm"} borderRadius="full" colorScheme="teal">
|
||||
Active
|
||||
</Tag>
|
||||
) : (
|
||||
<Tag size={"sm"} borderRadius="full" colorScheme="red">
|
||||
Inactive
|
||||
</Tag>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<Box className="mb-3">
|
||||
<Box className="web-text-large fw-bold rubix-text-dark">
|
||||
Description
|
||||
</Box>
|
||||
<Box className="web-text-medium text-secondary">
|
||||
{viewPolicy?.description}
|
||||
</Box>
|
||||
</Box>
|
||||
<Box className="mb-3">
|
||||
<Box className="web-text-large fw-bold rubix-text-dark">Link</Box>
|
||||
<Box className="web-text-medium text-secondary">
|
||||
{viewPolicy?.website_link}
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<Divider />
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ViewPartner;
|
||||
@@ -10,6 +10,9 @@ import { AiOutlineIdcard } from "react-icons/ai";
|
||||
import { LuMonitorPause } from "react-icons/lu";
|
||||
import { MdOutlinePrivacyTip } from "react-icons/md";
|
||||
import { GrDocumentVerified } from "react-icons/gr";
|
||||
import { FaQuestionCircle } from "react-icons/fa";
|
||||
import { MdOutlineSettingsApplications } from "react-icons/md";
|
||||
import { MdOutlineUnsubscribe } from "react-icons/md";
|
||||
|
||||
export const nav = [
|
||||
{
|
||||
@@ -71,4 +74,19 @@ export const nav = [
|
||||
path: "/policy",
|
||||
Icon: MdOutlinePrivacyTip,
|
||||
},
|
||||
{
|
||||
title: "FAQ",
|
||||
path: "/faq",
|
||||
Icon: FaQuestionCircle,
|
||||
},
|
||||
{
|
||||
title: "Partners Card",
|
||||
path: "/partners",
|
||||
Icon: MdOutlineSettingsApplications,
|
||||
},
|
||||
{
|
||||
title: "News Letter",
|
||||
path: "/newsLetter",
|
||||
Icon: MdOutlineUnsubscribe,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -64,6 +64,16 @@ import AddPolicy from "../Pages/Policy/AddPolicy";
|
||||
import ViewPolicy from "../Pages/Policy/ViewPolicy";
|
||||
import EditPolicy from "../Pages/Policy/EditPolicy";
|
||||
import Policy from "../Pages/Policy/Policy";
|
||||
import Faq from "../Pages/Faq/Faq";
|
||||
import AddFaq from "../Pages/Faq/AddFaq";
|
||||
import ViewFaq from "../Pages/Faq/ViewFaq";
|
||||
import EditFaq from "../Pages/Faq/EditFaq";
|
||||
import Partner from "../Pages/Partners/Partner";
|
||||
import AddPartner from "../Pages/Partners/AddPartners";
|
||||
import ViewPartner from "../Pages/Partners/ViewPartner";
|
||||
import EditPartner from "../Pages/Partners/EditPartners";
|
||||
import newsLetter from "../Pages/NewLetter/NewsLetter";
|
||||
import NewsLetter from "../Pages/NewLetter/NewsLetter";
|
||||
|
||||
export const RouteLink = [
|
||||
{ path: "/", Component: WelcomePage },
|
||||
@@ -173,4 +183,19 @@ export const RouteLink = [
|
||||
{ path: "/policy/add-policy", Component: AddPolicy },
|
||||
{ path: "/policy/view/:id", Component: ViewPolicy },
|
||||
{ path: "/policy/edit/:id", Component: EditPolicy },
|
||||
|
||||
// =============[ Faq ]================
|
||||
{ path: "/faq", Component: Faq },
|
||||
{ path: "/faq/add-faq", Component: AddFaq },
|
||||
{ path: "/faq/view/:id", Component: ViewFaq },
|
||||
{ path: "/faq/edit/:id", Component: EditFaq },
|
||||
|
||||
// =============[ Partners ]================
|
||||
{ path: "/partners", Component: Partner },
|
||||
{ path: "/partners/add-partners", Component: AddPartner },
|
||||
{ path: "/partners/view/:id", Component: ViewPartner },
|
||||
{ path: "/partners/edit/:id", Component: EditPartner },
|
||||
|
||||
// =============[ NewLetter ]================
|
||||
{ path: "/newsLetter", Component: NewsLetter },
|
||||
];
|
||||
|
||||
@@ -37,7 +37,10 @@ export const rubixApi = createApi({
|
||||
"getUseCase",
|
||||
"getTerms",
|
||||
"getPolicy",
|
||||
"getFaq",
|
||||
"getPartners",
|
||||
|
||||
'getNewsLetter',
|
||||
],
|
||||
endpoints: (builder) => ({
|
||||
// ===============[ Community cards endpoints ]=======================
|
||||
@@ -654,9 +657,109 @@ export const rubixApi = createApi({
|
||||
query: (id) => `/admin/policy/${id}`,
|
||||
providesTags: ["getPolicy"],
|
||||
}),
|
||||
|
||||
// ===============[ Faq endpoints ]=======================
|
||||
getFaq: builder.query({
|
||||
query: () => "/admin/faq",
|
||||
providesTags: ["getFaq"],
|
||||
}),
|
||||
deleteFaq: builder.mutation({
|
||||
query: (id) => ({
|
||||
url: `/admin/faq/${id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
invalidatesTags: ["getFaq"],
|
||||
}),
|
||||
createFaq: builder.mutation({
|
||||
query: (data) => ({
|
||||
url: `/admin/faq`,
|
||||
method: "POST",
|
||||
body: data,
|
||||
}),
|
||||
invalidatesTags: ["getFaq"],
|
||||
}),
|
||||
updateFaqStatus: builder.mutation({
|
||||
query: ({ id }) => ({
|
||||
url: `/admin/faq/change-visibility/${id}`,
|
||||
method: "POST",
|
||||
}),
|
||||
invalidatesTags: ["getFaq"],
|
||||
}),
|
||||
updateFaq: builder.mutation({
|
||||
query: ({ id, data }) => ({
|
||||
url: `/admin/faq/${id}`,
|
||||
method: "PUT",
|
||||
body: data, // Include the data you want to send in the request body
|
||||
}),
|
||||
invalidatesTags: ["getFaq"],
|
||||
}),
|
||||
getFaqById: builder.query({
|
||||
query: (id) => `/admin/faq/${id}`,
|
||||
providesTags: ["getFaq"],
|
||||
}),
|
||||
|
||||
|
||||
// ===============[ Cards endpoints ]=======================
|
||||
getPartners: builder.query({
|
||||
query: () => "/admin/card",
|
||||
providesTags: ["getPartners"],
|
||||
}),
|
||||
deletePartners: builder.mutation({
|
||||
query: (id) => ({
|
||||
url: `/admin/card/${id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
invalidatesTags: ["getPartners"],
|
||||
}),
|
||||
createPartners: builder.mutation({
|
||||
query: (data) => ({
|
||||
url: `/admin/card`,
|
||||
method: "POST",
|
||||
body: data,
|
||||
}),
|
||||
invalidatesTags: ["getPartners"],
|
||||
}),
|
||||
updatePartnersStatus: builder.mutation({
|
||||
query: ({ id }) => ({
|
||||
url: `/admin/card/change-visibility/${id}`,
|
||||
method: "POST",
|
||||
}),
|
||||
invalidatesTags: ["getPartners"],
|
||||
}),
|
||||
updatePartners: builder.mutation({
|
||||
query: ({ id, data }) => ({
|
||||
url: `/admin/card/${id}`,
|
||||
method: "PUT",
|
||||
body: data, // Include the data you want to send in the request body
|
||||
}),
|
||||
invalidatesTags: ["getPartners"],
|
||||
}),
|
||||
getPartnersById: builder.query({
|
||||
query: (id) => `/admin/card/${id}`,
|
||||
providesTags: ["getPartners"],
|
||||
}),
|
||||
|
||||
// ===============[ Cards endpoints ]=======================
|
||||
getNewsLetter: builder.query({
|
||||
query: () => 'newsLetter/request',
|
||||
providesTags: ['getNewsLetter'],
|
||||
}),
|
||||
deleteEmail: builder.mutation({
|
||||
query: (id) => ({
|
||||
url: `/newsLetter/request/${id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
invalidatesTags: ["getNewsLetter"],
|
||||
}),
|
||||
getNewsLetterEmail: builder.query({
|
||||
query: () => 'newsLetter/request',
|
||||
providesTags: ['getNewsLetter'],
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
|
||||
export const {
|
||||
useGetCommunityQuery,
|
||||
useGetCommunityByIdQuery,
|
||||
@@ -765,7 +868,22 @@ export const {
|
||||
useUpdatePolicyMutation,
|
||||
useGetPolicyByIdQuery,
|
||||
|
||||
useGetFaqQuery,
|
||||
useDeleteFaqMutation,
|
||||
useCreateFaqMutation,
|
||||
useUpdateFaqStatusMutation,
|
||||
useUpdateFaqMutation,
|
||||
useGetFaqByIdQuery,
|
||||
|
||||
useGetPartnersQuery,
|
||||
useDeletePartnersMutation,
|
||||
useCreatePartnersMutation,
|
||||
useUpdatePartnersStatusMutation,
|
||||
useUpdatePartnersMutation,
|
||||
useGetPartnersByIdQuery,
|
||||
|
||||
useGetNewsLetterQuery,
|
||||
useDeleteEmailMutation,
|
||||
useGetNewsLetterEmailQuery,
|
||||
|
||||
} = rubixApi;
|
||||
|
||||
@@ -575,4 +575,99 @@ export const addPolicy = Yup.object().shape({
|
||||
// })
|
||||
});
|
||||
|
||||
export const addPartnerCard = Yup.object().shape({
|
||||
website_link: Yup.string().required("link is required"),
|
||||
description: Yup.string().required("description is required"),
|
||||
company_logo: Yup.mixed().required("logo is required")
|
||||
// .test("required", "You need to provide a file", (files) => {
|
||||
// // return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
|
||||
// if (files) return true;
|
||||
// return false;
|
||||
// })
|
||||
// .test(
|
||||
// "fileSize",
|
||||
// " The maximum size of profile picture is 15MB.",
|
||||
// (files) => {
|
||||
// //if u want to allow only certain file sizes
|
||||
// try {
|
||||
// if (files.length !== 0) {
|
||||
// return files[0].size <= 15000000;
|
||||
// }
|
||||
// return true;
|
||||
// } catch (error) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
.optional(),
|
||||
// .test("file_formate", "Image file has unsupported format.", (files) => {
|
||||
// // // console.log(files[0].type)
|
||||
|
||||
// const SUPPORTED_FORMATS = [
|
||||
// "image/jpeg",
|
||||
// "image/png",
|
||||
// "image/jpg",
|
||||
// "image/gif",
|
||||
// "image/tiff",
|
||||
// "image/svg+xml",
|
||||
// ];
|
||||
// try {
|
||||
// if (files.length !== 0) {
|
||||
// setPreviewImage(URL.createObjectURL(files[0]));
|
||||
// return files && SUPPORTED_FORMATS.includes(files[0].type);
|
||||
// }
|
||||
// return true;
|
||||
// } catch (error) {
|
||||
// return false;
|
||||
// }
|
||||
// })
|
||||
});
|
||||
|
||||
export const addFaq = Yup.object().shape({
|
||||
question: Yup.string().required("Qustion is required"),
|
||||
answer: Yup.string()
|
||||
// banner_image: Yup.mixed()
|
||||
// .test("required", "You need to provide a file", (files) => {
|
||||
// // return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
|
||||
// if (files) return true;
|
||||
// return false;
|
||||
// })
|
||||
// .test(
|
||||
// "fileSize",
|
||||
// " The maximum size of profile picture is 15MB.",
|
||||
// (files) => {
|
||||
// //if u want to allow only certain file sizes
|
||||
// try {
|
||||
// if (files.length !== 0) {
|
||||
// return files[0].size <= 15000000;
|
||||
// }
|
||||
// return true;
|
||||
// } catch (error) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
.optional(),
|
||||
// .test("file_formate", "Image file has unsupported format.", (files) => {
|
||||
// // // console.log(files[0].type)
|
||||
|
||||
// const SUPPORTED_FORMATS = [
|
||||
// "image/jpeg",
|
||||
// "image/png",
|
||||
// "image/jpg",
|
||||
// "image/gif",
|
||||
// "image/tiff",
|
||||
// "image/svg+xml",
|
||||
// ];
|
||||
// try {
|
||||
// if (files.length !== 0) {
|
||||
// setPreviewImage(URL.createObjectURL(files[0]));
|
||||
// return files && SUPPORTED_FORMATS.includes(files[0].type);
|
||||
// }
|
||||
// return true;
|
||||
// } catch (error) {
|
||||
// return false;
|
||||
// }
|
||||
// })
|
||||
});
|
||||
|
||||
|
||||
58
yarn.lock
58
yarn.lock
@@ -1214,6 +1214,11 @@ acorn-jsx@^5.3.2:
|
||||
resolved "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz"
|
||||
integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==
|
||||
|
||||
adler-32@~1.3.0:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz"
|
||||
integrity sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==
|
||||
|
||||
ajv@^6.12.4:
|
||||
version "6.12.6"
|
||||
resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz"
|
||||
@@ -1392,6 +1397,14 @@ callsites@^3.0.0:
|
||||
resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz"
|
||||
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
|
||||
|
||||
cfb@~1.2.1:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz"
|
||||
integrity sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==
|
||||
dependencies:
|
||||
adler-32 "~1.3.0"
|
||||
crc-32 "~1.2.0"
|
||||
|
||||
chalk@^2.4.2:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz"
|
||||
@@ -1414,6 +1427,11 @@ clone@^2.1.1:
|
||||
resolved "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz"
|
||||
integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==
|
||||
|
||||
codepage@~1.15.0:
|
||||
version "1.15.0"
|
||||
resolved "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz"
|
||||
integrity sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==
|
||||
|
||||
color-convert@^1.9.0:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz"
|
||||
@@ -1476,6 +1494,11 @@ cosmiconfig@^7.0.0:
|
||||
path-type "^4.0.0"
|
||||
yaml "^1.10.0"
|
||||
|
||||
crc-32@~1.2.0, crc-32@~1.2.1:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz"
|
||||
integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==
|
||||
|
||||
cross-spawn@^7.0.2:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz"
|
||||
@@ -1966,6 +1989,11 @@ for-each@^0.3.3:
|
||||
dependencies:
|
||||
is-callable "^1.1.3"
|
||||
|
||||
frac@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz"
|
||||
integrity sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==
|
||||
|
||||
framer-motion@^11.1.5, framer-motion@>=4.0.0:
|
||||
version "11.1.5"
|
||||
resolved "https://registry.npmjs.org/framer-motion/-/framer-motion-11.1.5.tgz"
|
||||
@@ -3043,6 +3071,13 @@ source-map@^0.5.7:
|
||||
resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz"
|
||||
integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==
|
||||
|
||||
ssf@~0.11.2:
|
||||
version "0.11.2"
|
||||
resolved "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz"
|
||||
integrity sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==
|
||||
dependencies:
|
||||
frac "~1.1.2"
|
||||
|
||||
string.prototype.matchall@^4.0.10:
|
||||
version "4.0.11"
|
||||
resolved "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz"
|
||||
@@ -3336,11 +3371,34 @@ which@^2.0.1:
|
||||
dependencies:
|
||||
isexe "^2.0.0"
|
||||
|
||||
wmf@~1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz"
|
||||
integrity sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==
|
||||
|
||||
word@~0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.npmjs.org/word/-/word-0.3.0.tgz"
|
||||
integrity sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
|
||||
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
||||
|
||||
xlsx@^0.18.5:
|
||||
version "0.18.5"
|
||||
resolved "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz"
|
||||
integrity sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==
|
||||
dependencies:
|
||||
adler-32 "~1.3.0"
|
||||
cfb "~1.2.1"
|
||||
codepage "~1.15.0"
|
||||
crc-32 "~1.2.1"
|
||||
ssf "~0.11.2"
|
||||
wmf "~1.0.1"
|
||||
word "~0.3.0"
|
||||
|
||||
yaml@^1.10.0:
|
||||
version "1.10.2"
|
||||
resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz"
|
||||
|
||||
Reference in New Issue
Block a user