From 6688dc7674a16590d4caa00c29a6f85fa2133ac1 Mon Sep 17 00:00:00 2001
From: pawan-dot <71133473+pawan-dot@users.noreply.github.com>
Date: Wed, 18 Jan 2023 14:35:10 +0530
Subject: [PATCH] first commit
---
public/index.html | 2 +-
src/Action/categoryAction.js | 59 --
src/Action/directoryAction.js | 0
src/App.js | 4 +-
src/_nav.js | 54 --
src/components/AppFooter.js | 2 +-
src/components/AppHeader.js | 2 +-
src/components/AppSidebar.js | 2 +-
src/components/header/AppHeaderDropdown.js | 4 +-
src/index.js | 3 +-
src/reducers/categoryReducer.js | 46 --
src/reducers/directoryReducer.js | 61 --
src/routes.js | 106 +---
src/views/Banners/AddBanner.js | 278 ---------
src/views/Banners/Banner.js | 179 ------
src/views/Banners/EditBanner.js | 320 ----------
src/views/Banners/ViewBanner.js | 128 ----
src/views/CMS/AddNewPageCms.js | 183 ------
src/views/CMS/EditCms.js | 247 --------
src/views/CMS/Pagination.js | 25 -
src/views/CMS/ViewCms.js | 135 -----
src/views/CMS/cms.js | 178 ------
src/views/Category/AddCategory.js | 171 ------
src/views/Category/Category.js | 188 ------
src/views/Category/EditCategory.js | 231 -------
src/views/Directory/Add_Business.js | 549 -----------------
src/views/Directory/Bisuness.js | 267 ---------
src/views/Directory/EditBisuness.js | 565 ------------------
src/views/Directory/Pagination.js | 25 -
src/views/Directory/View_Bisuness.js | 119 ----
src/views/Events/AddEvent.js | 216 -------
src/views/Events/AllRegisterUser.js | 115 ----
src/views/Events/EditEvent.js | 235 --------
src/views/Events/Event.js | 130 ----
src/views/Events/RegisterUser.js | 92 ---
src/views/Events/ViewEvent.js | 123 ----
src/views/FAQs/AddFaqs.js | 174 ------
src/views/FAQs/EditFaqs.js | 185 ------
src/views/FAQs/Faqs.js | 164 -----
src/views/FAQs/ViewFaqs.js | 132 ----
src/views/Feedback/Pagination.js | 25 -
src/views/Feedback/ViewFeedback.js | 123 ----
src/views/Feedback/feedback.js | 146 -----
src/views/News/AddNews.js | 161 -----
src/views/News/EditNews.js | 176 ------
src/views/News/News.js | 164 -----
src/views/News/ViewNews.js | 131 ----
src/views/Offers/AddOffer.js | 240 --------
src/views/Offers/EditOffer.js | 247 --------
src/views/Offers/Offer.js | 162 -----
src/views/Offers/ViewOffer.js | 136 -----
src/views/Requirement/AddRequirement.js | 217 -------
src/views/Requirement/EditRequirement.js | 232 -------
src/views/Requirement/Pagination.js | 25 -
src/views/Requirement/Requirement.js | 142 -----
src/views/Requirement/RequirementOpt.js | 133 -----
src/views/Requirement/ViewRequirement.js | 142 -----
src/views/pages/login/Login.js | 2 +-
src/views/pages/register/ForgotPassword.js | 2 +-
.../pages/{ => register}/page404/Page404.js | 0
src/views/widgets/WidgetsDropdown.js | 79 +--
61 files changed, 16 insertions(+), 8368 deletions(-)
delete mode 100644 src/Action/categoryAction.js
delete mode 100644 src/Action/directoryAction.js
delete mode 100644 src/reducers/categoryReducer.js
delete mode 100644 src/reducers/directoryReducer.js
delete mode 100644 src/views/Banners/AddBanner.js
delete mode 100644 src/views/Banners/Banner.js
delete mode 100644 src/views/Banners/EditBanner.js
delete mode 100644 src/views/Banners/ViewBanner.js
delete mode 100644 src/views/CMS/AddNewPageCms.js
delete mode 100644 src/views/CMS/EditCms.js
delete mode 100644 src/views/CMS/Pagination.js
delete mode 100644 src/views/CMS/ViewCms.js
delete mode 100644 src/views/CMS/cms.js
delete mode 100644 src/views/Category/AddCategory.js
delete mode 100644 src/views/Category/Category.js
delete mode 100644 src/views/Category/EditCategory.js
delete mode 100644 src/views/Directory/Add_Business.js
delete mode 100644 src/views/Directory/Bisuness.js
delete mode 100644 src/views/Directory/EditBisuness.js
delete mode 100644 src/views/Directory/Pagination.js
delete mode 100644 src/views/Directory/View_Bisuness.js
delete mode 100644 src/views/Events/AddEvent.js
delete mode 100644 src/views/Events/AllRegisterUser.js
delete mode 100644 src/views/Events/EditEvent.js
delete mode 100644 src/views/Events/Event.js
delete mode 100644 src/views/Events/RegisterUser.js
delete mode 100644 src/views/Events/ViewEvent.js
delete mode 100644 src/views/FAQs/AddFaqs.js
delete mode 100644 src/views/FAQs/EditFaqs.js
delete mode 100644 src/views/FAQs/Faqs.js
delete mode 100644 src/views/FAQs/ViewFaqs.js
delete mode 100644 src/views/Feedback/Pagination.js
delete mode 100644 src/views/Feedback/ViewFeedback.js
delete mode 100644 src/views/Feedback/feedback.js
delete mode 100644 src/views/News/AddNews.js
delete mode 100644 src/views/News/EditNews.js
delete mode 100644 src/views/News/News.js
delete mode 100644 src/views/News/ViewNews.js
delete mode 100644 src/views/Offers/AddOffer.js
delete mode 100644 src/views/Offers/EditOffer.js
delete mode 100644 src/views/Offers/Offer.js
delete mode 100644 src/views/Offers/ViewOffer.js
delete mode 100644 src/views/Requirement/AddRequirement.js
delete mode 100644 src/views/Requirement/EditRequirement.js
delete mode 100644 src/views/Requirement/Pagination.js
delete mode 100644 src/views/Requirement/Requirement.js
delete mode 100644 src/views/Requirement/RequirementOpt.js
delete mode 100644 src/views/Requirement/ViewRequirement.js
rename src/views/pages/{ => register}/page404/Page404.js (100%)
diff --git a/public/index.html b/public/index.html
index 6fb9f6a..5ced6a1 100644
--- a/public/index.html
+++ b/public/index.html
@@ -15,7 +15,7 @@
-
CMP-Dashboard
+ ATP-Dashboard
*/}
-
-
-
-
Home Screen Banners
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Title |
- Image |
- {/* Section |
- Sub Section | */}
- Status |
- Added On |
- Action |
-
-
-
- {banner && banner.map((item, index) =>
-
- {item?.title} |
-
-  |
-
-
- {/* {item?.section} |
- {item?.subSection} | */}
-
- new Date() ? "success" : "danger"
- } font-size-10`}
- >
- {new Date(`${item?.endDate}`) > new Date() ? "Live" : "Suspended"}
-
- |
-
- {/* {item?.addedOn} */}
- {new Date(`${item?.addedOn}`).toDateString()} , {`${formatAMPM(item?.addedOn)}`}
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- )}
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default banner;
diff --git a/src/views/Banners/EditBanner.js b/src/views/Banners/EditBanner.js
deleted file mode 100644
index 413fb45..0000000
--- a/src/views/Banners/EditBanner.js
+++ /dev/null
@@ -1,320 +0,0 @@
-
-
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory } from "react-router-dom";
-import swal from 'sweetalert';
-import { useParams } from "react-router-dom";
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilNotes, cilCalendar, cilNoteAdd } from '@coreui/icons'
-const EditBanner = () => {
- const { id } = useParams();
- const token = isAutheticated();
- let history = useHistory();
- const [image, setImage] = useState("");
- const [title, setTitle] = useState("");
- // const [subTitle, setSubTitle] = useState("");
- const [imagesPreview, setImagesPreview] = useState();
-
- // const [section, setSection] = useState("");
-
- const [startDate, setStartDate] = useState("");
- const [endDate, setEndDate] = useState("");
-
- // const [subSection, setSubSection] = useState("");
- // const [category, setCategory] = useState(false);
-
- const [loading, setLoading] = useState(false);
- //fetch one Offer
- useEffect(async () => {
- const res = await axios.get(`/api/banner/getOne/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
-
- // console.log(res.data.banner.startDate)
- setTitle(res.data.banner.title)
- // setSubTitle(res.data.banner.subTitle)
- // setSection(res.data.banner.section)
- // setSubSection(res.data.banner.subSection)
- setImagesPreview(res.data.banner.image.url)
- setStartDate(res.data.banner.startDate)
- setEndDate(res.data.banner.endDate)
-
- }, [id]);
-
- const handleSubmit = async () => {
- if (!(title && startDate && endDate)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("title", title);
- // myForm.set("subTitle", subTitle);
- // myForm.set("section", section);
- // myForm.set("subSection", subSection);
- myForm.set("startDate", startDate);
- myForm.set("endDate", endDate);
- myForm.set("image", image);
- setLoading({ loading: true });
- try {
- let res = await axios.put(
- `/api/banner/update/${id}`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- if (res.data) {
- swal("success!", "Banner Updated Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
- } catch (error) {
- swal('Error!', error, 'error')
- setLoading(false);
- }
- // console.log(image)
-
-
-
- };
- // const handleImage = (e) => {
- // const files = e.target.files[0];
- // // console.log(files)
- // setImage(files);
-
- // };
- // //
- const handleImage = (e) => {
- const files = e.target.files[0];
-
- // console.log(files)
- setImage(files);
- // only for file preview------------------------------------
- const Reader = new FileReader();
- Reader.readAsDataURL(files);
-
- Reader.onload = () => {
- if (Reader.readyState === 2) {
- setImagesPreview(Reader.result);
- }
- };
-
-
- // -----------------------------------------------------------------------------
- };
- const onCancel = () => {
- // window.location = "/comproducts";
- history.goBack()
-
- };
-
-
- // useEffect(() => {
- // const getData = async () => {
- // let res = await axios.get(
- // `/api/category/getAll`,
- // {
- // headers: {
- // Authorization: `Bearer ${token}`,
- // },
- // }
- // );
- // console.log(res.data)
- // setCategory(res.data.category)
- // }
- // if (section === "category") {
- // getData()
- // } else {
- // setCategory(false)
- // }
- // }, [section])
-
- return (
- <>
-
-
-
-
-
-
-
- Edit Banner
-
-
-
-
-
-
- setTitle(e.target.value)}
- value={title}
- placeholder="Title" />
-
- {/*
-
-
-
- setSubTitle(e.target.value)}
- value={subTitle}
- placeholder="sub title" />
- */}
-
- {/*
-
-
-
-
-
-
- {category && <>
-
- SubSection
-
-
- >}
- */}
-
-
- Start Date*
-
-
- {/* */}
-
- setStartDate(e.target.value)}
- value={startDate}
- placeholder="Start Date" />
-
-
-
-
- End Date*
-
-
- setEndDate(e.target.value)}
- value={endDate}
- placeholder="EndDate" />
-
- {/*
-
-
-
- setLocation(e.target.value)}
- value={location}
- placeholder="Location" />
- */}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default EditBanner
\ No newline at end of file
diff --git a/src/views/Banners/ViewBanner.js b/src/views/Banners/ViewBanner.js
deleted file mode 100644
index dcc40e5..0000000
--- a/src/views/Banners/ViewBanner.js
+++ /dev/null
@@ -1,128 +0,0 @@
-
-
-
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { Link, useParams } from "react-router-dom";
-import { isAutheticated } from "../../auth";
-
-function ViewBanner() {
- const [banner, setBanner] = useState([])
- const { id } = useParams();
- // console.log(id)
- const token = isAutheticated();
-
- const getBanner = useCallback(async () => {
- let res = await axios.get(
- `/api/banner/getOne/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
-
- setBanner(res.data.banner)
-
-
- }, [token]);
-
- useEffect(() => {
- getBanner();
- }, [getBanner]);
-
-
-
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
Home Screen Banner
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Id | {banner?._id} |
- Title | {banner?.title} |
-
- Image |
-
- |
- {/* Section | {banner?.section} |
- Sub Section | {banner?.subSection} |
*/}
- Start Date |
- {new Date(`${banner?.startDate}`).toDateString()}
- |
- End Date |
- {new Date(`${banner?.endDate}`).toDateString()} |
- Added On |
- {new Date(`${banner?.addedOn}`).toDateString()} , {`${formatAMPM(banner?.addedOn)}`}
- |
- Updated At |
- {new Date(`${banner?.updatedAt}`).toDateString()} , {`${formatAMPM(banner?.updatedAt)}`}
- |
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default ViewBanner;
diff --git a/src/views/CMS/AddNewPageCms.js b/src/views/CMS/AddNewPageCms.js
deleted file mode 100644
index 3d9abff..0000000
--- a/src/views/CMS/AddNewPageCms.js
+++ /dev/null
@@ -1,183 +0,0 @@
-
-import React, { useEffect, useState } from 'react'
-import { CKEditor } from '@ckeditor/ckeditor5-react'
-
-import { Link, useHistory } from 'react-router-dom'
-import { isAutheticated } from "../../auth";
-import swal from 'sweetalert'
-import axios from 'axios'
-
-import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
-
-
-const AddNewPageCms = () => {
- const token = isAutheticated()
- const history = useHistory()
- const [image, setImage] = useState()
- const [data, setData] = useState({
- title: '',
- page_data: '',
- })
- const [loading, setLoading] = useState(false)
-
- const handleChange = (e) => {
-
- setData((prev) => ({ ...prev, [e.target.id]: e.target.value }))
- }
-
- const handleSubmit = async () => {
- if (data.title.trim() === '' || data.page_data.trim() === '') {
- swal({
- title: 'Warning',
- text: 'Fill all mandatory fields',
- icon: 'error',
- button: 'Close',
- dangerMode: true,
- })
- return
- }
- setLoading(true)
- const formData = new FormData()
- formData.append('title', data.title)
- formData.append('page_data', data.page_data)
- formData.append('image', image)
- try {
- const res = await axios
- .post(`/api/restriction/cms/create/`, formData, {
- headers: {
- 'Access-Control-Allow-Origin': '*',
- Authorization: `Bearer ${token}`,
- 'Content-Type': 'multipart/formdata',
- },
- })
- if (res.data.success === true) {
-
- setLoading(false)
- swal({
- title: 'Added',
- text: 'Page added successfully!',
- icon: 'success',
- button: 'Return',
- })
- history.goBack()
-
- }
- } catch (error) {
- const message = 'Something went wrong!'
- setLoading(false)
- swal({
- title: 'Warning',
- text: message,
- icon: 'error',
- button: 'Retry',
- dangerMode: true,
- })
- }
- }
-
-
- return (
-
-
-
-
-
- Add Page in CMS
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Title
-
-
- {
- handleChange(e)
- }}
- />
-
-
-
Page data *
-
-
- {
- editor.editing.view.change((writer) => {
- writer.setStyle('height', '200px', editor.editing.view.document.getRoot())
- })
- }}
- data={data.page_data}
- // config={{
- // extraPlugins: [MyCustomUploadAdapterPlugin],
- // }}
- placeholder='page data...'
- onChange={(event, editor) => {
- let e = { target: { value: editor.getData(), id: 'page_data' } }
- handleChange(e)
- }}
- />
-
-
-
-
-
image *
-
-
setImage(e.target.files[0])}
- />
- {/*
Upload videos, images and pdf only
*/}
-
-
-
-
-
-
- )
-}
-
-export default AddNewPageCms
diff --git a/src/views/CMS/EditCms.js b/src/views/CMS/EditCms.js
deleted file mode 100644
index 6d8d412..0000000
--- a/src/views/CMS/EditCms.js
+++ /dev/null
@@ -1,247 +0,0 @@
-
-import React, { useEffect, useState } from 'react'
-import { CKEditor } from '@ckeditor/ckeditor5-react'
-
-import { Link, useHistory, useParams } from 'react-router-dom'
-import { isAutheticated } from "../../auth";
-import swal from 'sweetalert'
-import axios from 'axios'
-
-import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
-import { useCallback } from 'react';
-
-
-const EditCms = () => {
- const { id } = useParams()
- const token = isAutheticated()
- const history = useHistory()
- const [image, setImage] = useState()
- const [imagesPreview, setImagesPreview] = useState();
- const [data, setData] = useState({
- title: '',
- page_data: '',
- })
- const [loading, setLoading] = useState(false)
-
- const handleChange = (e) => {
-
- setData((prev) => ({ ...prev, [e.target.id]: e.target.value }))
- }
- const handleImage = (e) => {
- const files = e.target.files[0];
- setImage(files);
- // only for file preview------------------------------------
- const Reader = new FileReader();
- Reader.readAsDataURL(files);
-
- Reader.onload = () => {
- if (Reader.readyState === 2) {
- setImagesPreview(Reader.result);
- }
- };
- // -----------------------------------------------------------------------------
- };
- const getCms = useCallback(async () => {
-
-
- let res = await axios.get(
- `/api/restriction/getOne/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- if (res.data.CmpRestriction) {
- setData((prev) => ({ ...res.data.CmpRestriction }))
- if (res.data.CmpRestriction.image) {
- setImagesPreview(res.data.CmpRestriction.image.url)
- }
-
- }
- }, [token]
- )
-
- useEffect(() => {
- getCms();
- }, []);
-
- const handleSubmit = async () => {
- if (data.title.trim() === '' || data.page_data.trim() === '') {
- swal({
- title: 'Warning',
- text: 'Fill all mandatory fields',
- icon: 'error',
- button: 'Close',
- dangerMode: true,
- })
- return
- }
- setLoading(true)
- const formData = new FormData()
- formData.append('title', data.title)
- formData.append('page_data', data.page_data)
- formData.append('image', image)
- try {
- const res = await axios
- .put(`/api/restriction/cms/update/${id}`, formData, {
- headers: {
- 'Access-Control-Allow-Origin': '*',
- Authorization: `Bearer ${token}`,
- 'Content-Type': 'multipart/formdata',
- },
- })
- if (res.data.success === true) {
-
- setLoading(false)
- swal({
- title: 'Edited',
- text: 'Page edited successfully!',
- icon: 'success',
- button: 'Return',
- })
- history.goBack()
-
- }
- } catch (error) {
- const message = error?.response?.data?.message || 'Something went wrong!'
- setLoading(false)
- swal({
- title: 'Warning',
- text: message,
- icon: 'error',
- button: 'Retry',
- dangerMode: true,
- })
- }
- }
-
-
- return (
-
-
-
-
-
- Edit Page
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Title
-
-
- {
- handleChange(e)
- }}
- />
-
-
-
Page data *
-
-
-
-
-
-
- {/*
-
- {
- editor.editing.view.change((writer) => {
- writer.setStyle('height', '200px', editor.editing.view.document.getRoot())
- })
- }}
- data={data.page_data}
- // config={{
- // extraPlugins: [MyCustomUploadAdapterPlugin],
- // }}
-
- onChange={(event, editor) => {
- let e = { target: { value: editor.getData(), id: 'page_data' } }
- handleChange(e)
- }}
- />
-
-
*/}
-
-
-
image *
-
-
- {/*
Upload videos, images and pdf only
*/}
-
-
-
-
-
-
-
- )
-}
-
-export default EditCms
diff --git a/src/views/CMS/Pagination.js b/src/views/CMS/Pagination.js
deleted file mode 100644
index b648950..0000000
--- a/src/views/CMS/Pagination.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-import { Link } from "react-router-dom";
-const Pagination = ({ postsPerPage, totalPosts, paginate }) => {
- const pageNumbers = [];
-
- for (let i = 1; i <= Math.ceil(totalPosts / postsPerPage); i++) {
- pageNumbers.push(i);
- }
-
- return (
-
- );
-};
-
-export default Pagination;
\ No newline at end of file
diff --git a/src/views/CMS/ViewCms.js b/src/views/CMS/ViewCms.js
deleted file mode 100644
index 83aa007..0000000
--- a/src/views/CMS/ViewCms.js
+++ /dev/null
@@ -1,135 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { Link, useParams } from "react-router-dom";
-import { isAutheticated } from "../../auth";
-
-function ViewOffer() {
- const [cmsRes, setCmsRes] = useState([])
- const { id } = useParams();
- // console.log(id)
- const token = isAutheticated();
-
- const getOffer = useCallback(async () => {
- let res = await axios.get(
- `/api/restriction/getOne/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- //console.log(res.data)
- setCmsRes(res.data.CmpRestriction)
-
-
- }, [token]);
-
- useEffect(() => {
- getOffer();
- }, [getOffer]);
-
-
-
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-CMS
- {/*
*/}
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- {/* Id | */}
- Title |
- {cmsRes?.title} |
-
- page Content |
- {`${cmsRes?.page_data}`} |
-
- {/* Privacy Policy |
- {cmsRes?.Privacy_Policy} |
-
*/}
-
- image |
- {cmsRes.image ?
-  | :
- <>>
- }
-
- Added On |
-
- {new Date(`${cmsRes?.createdAt}`).toDateString()} , {`${formatAMPM(cmsRes?.createdAt)}`}
- |
-
- Updated At |
-
- {new Date(`${cmsRes?.updatedAt}`).toDateString()} , {`${formatAMPM(cmsRes?.updatedAt)}`}
- |
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default ViewOffer;
-
diff --git a/src/views/CMS/cms.js b/src/views/CMS/cms.js
deleted file mode 100644
index cfefa06..0000000
--- a/src/views/CMS/cms.js
+++ /dev/null
@@ -1,178 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import Pagination from "./Pagination";
-
-function cms() {
- const [cmsRes, setCmsRes] = useState([])
-
- const [currentPage, setCurrentPage] = useState(1);
- const [postsPerPage] = useState(15);
- const token = isAutheticated();
-
- const getRestriction = useCallback(async () => {
- let res = await axios.get(
- `/api/restriction/getAll`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
-
- setCmsRes(res.data.CmpRestriction)
-
-
- }, [token]);
-
- useEffect(() => {
- getRestriction();
- }, [getRestriction]);
-
-
- const indexOfLastPost = currentPage * postsPerPage;
- const indexOfFirstPost = indexOfLastPost - postsPerPage;
- const currentPosts = cmsRes.slice(indexOfFirstPost, indexOfLastPost);
-
- // Change page
- const paginate = pageNumber => setCurrentPage(pageNumber);
- const handleDelete = async (id) => {
- let status = window.confirm("Do you want to delete");
- if (!status) return;
-
- let res = await axios.delete(`/api/restriction/cms/delete/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- // console.log(res)
- if (res.data.success == true) {
- swal("success!", "Cms Deleted Successfully!", "success");
- window.location.reload();
- // if (res.status === 200) window.location.reload();
- }
- else {
- swal("error!", "failled!", "error");
-
- }
- };
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-CMS
- {/* */}
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
- Title |
- {/* Page Data | */}
-
- {/* image | */}
- Added On |
- Action |
-
-
-
- {currentPosts && currentPosts.map((item, index) =>
-
-
-
- {item.title} |
- {/* {item?.page_data} | */}
- {/* {item.image ?
-  | :
- <>>
- } */}
-
-
- {/* {item?.addedOn} */}
- {new Date(`${item?.createdAt}`).toDateString()} , {`${formatAMPM(item?.createdAt)}`}
-
- |
-
-
-
-
-
-
-
-
-
-
-
- |
-
- )}
-
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
- );
-}
-
-export default cms;
diff --git a/src/views/Category/AddCategory.js b/src/views/Category/AddCategory.js
deleted file mode 100644
index 200a4bb..0000000
--- a/src/views/Category/AddCategory.js
+++ /dev/null
@@ -1,171 +0,0 @@
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-//import Footer from "../../Footer";
-import { Link } from "react-router-dom";
-import { useHistory } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilLockLocked, cilUser } from '@coreui/icons'
-const AddProduct = () => {
- const token = isAutheticated();
- let history = useHistory();
- const [image, setImage] = useState("");
- const [ctegoryBannerImage, setCtegoryBannerImage] = useState("");
- const [name, setName] = useState("");
- const [loading, setLoading] = useState(false);
-
-
- const handleSubmit = async () => {
- if (!(name && image && ctegoryBannerImage)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("name", name);
-
-
- myForm.set("image", image);
- myForm.set("category_banner", ctegoryBannerImage);
- setLoading({ loading: true });
- // console.log(image)
- try {
- let res = await axios.post(
- `/api/category/create`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- //console.log(res.data.data.name)
- if (res.data) {
- swal("success!", "Category Added Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
- } catch (error) {
- swal('Error!', "something went wrong", 'error')
-
- setLoading(false);
- }
-
-
-
- };
- const handleImage = (e) => {
- const files = e.target.files[0];
- // console.log(files)
- setImage(files);
-
- };
- //
- const onCancel = () => {
- // window.location = "/comproducts";
- history.goBack()
-
- };
-
- return (
- <>
-
-
-
-
-
-
-
- Add Category
-
-
-
-
-
-
- setName(e.target.value)}
- value={name}
- placeholder="Name" />
-
-
category image *
-
-
-
- {/* */}
-
-
-
-
category Banner image *
-
-
-
-
- setCtegoryBannerImage(e.target.files[0])}
-
-
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default AddProduct
\ No newline at end of file
diff --git a/src/views/Category/Category.js b/src/views/Category/Category.js
deleted file mode 100644
index ff89ee4..0000000
--- a/src/views/Category/Category.js
+++ /dev/null
@@ -1,188 +0,0 @@
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-
-function Products() {
- const [category, setCategory] = useState([])
- const [state, setState] = useState({
- products: [],
- page: 1,
- limit: 10,
- totalProducts: 0,
- pages: 1,
- });
-
- window.scrollTo({ behavior: "smooth", top: "0px" });
-
- const { products, page, limit, totalProducts, pages } = state;
-
- const changeState = (newState) =>
- setState((prevState) => ({ ...prevState, ...newState }));
-
- const token = isAutheticated();
-
- const getProducts = useCallback(async () => {
- let res = await axios.get(
- `/api/category/getAll`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data.category)
- setCategory(res.data.category)
- // console.log(category[0].addedOn)
- changeState({
- ...res.data,
- pages: Math.ceil(res.data.totalProducts / limit),
- });
- }, [limit, page, token]);
-
- useEffect(() => {
- getProducts();
- }, [getProducts]);
-
- // const getTotalPages = useMemo(() => {
- // const length = pages > 1 ? pages : totalProducts ? 1 : 0;
- // return Array.from({ length }, (_, i) => i + 1);
- // }, [pages, totalProducts]);
-
- // console.log(getTotalPages);
-
- const handleDelete = async (id) => {
- let status = window.confirm("Do you want to delete");
- if (!status) return;
-
- let res = await axios.delete(`/api/category/delete/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- // console.log(res)
- if (res.data.success == true) {
- swal("success!", "Category Deleted Successfully!", "success");
- window.location.reload();
- // if (res.status === 200) window.location.reload();
- }
- else {
- swal("error!", "failled!", "error");
-
- }
- };
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
Categories
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Name |
- Category Image |
- Category Banner |
- Added On |
- Actions |
-
-
-
- {category && category.map((item, index) =>
-
- {item?.name} |
-
-
- |
-
-
- {item.category_banner && }
- |
-
- {/* {item?.addedOn} */}
- {new Date(`${item?.addedOn}`).toDateString()} , {`${formatAMPM(item?.addedOn)}`}
-
- |
-
-
-
-
-
-
-
-
- |
-
- )}
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default Products;
diff --git a/src/views/Category/EditCategory.js b/src/views/Category/EditCategory.js
deleted file mode 100644
index aa6c8c5..0000000
--- a/src/views/Category/EditCategory.js
+++ /dev/null
@@ -1,231 +0,0 @@
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-//import Footer from "../../Footer";
-import { Link, useParams } from "react-router-dom";
-import { useHistory } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilLockLocked, cilUser } from '@coreui/icons'
-const AddProduct = () => {
- const token = isAutheticated();
- let history = useHistory();
- const { id } = useParams();
- // console.log(id)
- const [image, setImage] = useState("");
- const [name, setName] = useState("");
- const [imagesPreview, setImagesPreview] = useState();
- const [ctegoryBannerImage, setCtegoryBannerImage] = useState("");
- const [ctegoryBannerImagePreview, setCtegoryBannerImagePreview] = useState("");
-
- const [loading, setLoading] = useState(false);
- useEffect(async () => {
- const res = await axios.get(`/api/category/getOne/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
-
- // setImage(res.data.category.image.url)
- setImagesPreview(res.data.category.image.url)
- setCtegoryBannerImagePreview(res.data.category.category_banner.url)
- setName(res.data.category.name)
- }, [id]);
-
-
- const handleSubmit = async () => {
- if (!(name)) {
- return swal('Error!', 'Name fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("name", name);
-
-
- myForm.set("image", image);
- myForm.set("category_banner", ctegoryBannerImage);
-
- setLoading({ loading: true });
- // console.log(image)
- try {
- let res = await axios.put(
- `/api/category/update/${id}`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- //console.log(res.data.data.name)
- if (res.data) {
- swal("success!", "Category Edited Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
- } catch (error) {
- swal('Error!', "something went wrong", 'error')
-
- setLoading(false);
- }
- }
- const handleImage = (e) => {
- const files = e.target.files[0];
-
- // console.log(files)
- setImage(files);
- // only for file preview------------------------------------
- const Reader = new FileReader();
- Reader.readAsDataURL(files);
-
- Reader.onload = () => {
- if (Reader.readyState === 2) {
- setImagesPreview(Reader.result);
- }
- };
-
-
- // -----------------------------------------------------------------------------
- };
- const handleBannerImage = (e) => {
- const files = e.target.files[0];
-
- // console.log(files)
- setCtegoryBannerImage(files);
- // only for file preview------------------------------------
- const Reader = new FileReader();
- Reader.readAsDataURL(files);
-
- Reader.onload = () => {
- if (Reader.readyState === 2) {
- setCtegoryBannerImagePreview(Reader.result);
- }
- };
-
-
- // -----------------------------------------------------------------------------
- };
-
-
- //
- const onCancel = () => {
- history.goBack()
-
- };
-
- return (
- <>
-
-
-
-
-
-
-
- Edit Category
-
-
-
-
-
-
- setName(e.target.value)}
- value={name}
- placeholder="Name" />
-
-
-
category image *
-
-
-
- {/* */}
-
-
-
-
-
category Banner image *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default AddProduct
\ No newline at end of file
diff --git a/src/views/Directory/Add_Business.js b/src/views/Directory/Add_Business.js
deleted file mode 100644
index dbae303..0000000
--- a/src/views/Directory/Add_Business.js
+++ /dev/null
@@ -1,549 +0,0 @@
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { Country, State, City } from "country-state-city";
-import swal from 'sweetalert';
-
-
-import { Link, useParams } from "react-router-dom";
-import { useHistory } from "react-router-dom";
-
-const Add_Business = () => {
- const [categoryName, setCategoryName] = useState([]);
- const [image, setImage] = useState();
-
-
- const token = isAutheticated();
-
- let history = useHistory();
- const [state, setState] = useState({
- name: "",
- phone: "",
- email: "",
- Bname: "",
- Sname: "",
- country: "",
- city: "",
- loading: false,
- description: "",
- category: "",
- status: "",
- Glocation: "",
- LinkedinUrl: "",
- FacebookUrl: "",
- InstagramUrl: ""
-
- });
-
-
- const { description, loading } = state;
- const changeState = (newState) =>
- setState((prevState) => ({ ...prevState, ...newState }));
-
-
- const handleChange = (e) => {
- changeState({ ...state, [e.target.name]: e.target.value })
-
- };
-
-
-
- const fetchCategory = useCallback(async () => {
- const res = await axios.get(`/api/category/getAll`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
-
- // console.log(res.data.category);
- setCategoryName(res.data.category)
- if (res.status === 200) changeState({ ...res.data });
- }, [token]);
-
- useEffect(async () => {
-
-
-
-
- fetchCategory();
-
- }, [fetchCategory]);
-
-
- const handleSubmit = async () => {
- if (!(state.name && state.phone && state.email && state.Bname && state.Sname && state.country && state.city && state.description
- && state.category && state.status && image)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
-
- const myForm = new FormData();
- myForm.set('name', state.name)
- myForm.set('phone', state.phone)
- myForm.set('email', state.email)
- myForm.set('Bname', state.Bname)
- myForm.set('Sname', state.Sname)
- myForm.set('country', state.country)
- myForm.set('city', state.city)
- myForm.set('description', state.description)
-
- myForm.set('category', state.category)
-
- myForm.set('status', state.status)
-
- myForm.set('Glocation', state.Glocation)
- myForm.set('LinkedinUrl', state.Glocation)
- myForm.set('FacebookUrl', state.FacebookUrl)
- myForm.set('InstagramUrl', state.InstagramUrl)
- myForm.set("image", image);
-
-
- changeState({ loading: true });
- try {
- let res = await axios.post(
- `/api/directory/create/`,
-
- myForm
- ,
- {
- headers: {
- "content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- //if (res.status === 200) window.location.reload();
- // console.log(res.status == 201)
- if (res.status == 201) {
- changeState({ loading: false });
- swal("Add Business successfully!");
- history.goBack()
- }
- } catch (error) {
- swal('Error!', error, 'error')
-
- changeState({ loading: false });
- }
-
- };
- const onCancel = () => {
- // window.location = "/comproducts";
- history.goBack()
-
- };
-
-
-
-
- // console.log(state)
- return (
- <>
-
-
-
-
-
-
- Add Bisuness
-
-
-
-
-
- {/* */}
-
- {/* */}
-
- {/* */}
-
- {/* */}
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
- {/* */}
- {/*
*/}
-
- >
- )
-}
-
-export default Add_Business
-
-
-//const myForm = new FormData();
- // myForm.set('name', state.name)
- // myForm.set('phone', state.phone)
- // myForm.set('email', state.email)
- // myForm.set('Bname', state.Bname)
- // myForm.set('Sname', state.Sname)
- // myForm.set('country', state.country)
- // myForm.set('city', state.city)
- // myForm.set('description', state.description)
-
- // myForm.set('category', state.category)
-
- // myForm.set('status', state.status)
-
- // myForm.set('Glocation', state.Glocation)
- // myForm.set('LinkedinUrl', state.Glocation)
- // myForm.set('FacebookUrl', state.FacebookUrl)
- // myForm.set('InstagramUrl', state.InstagramUrl)
- // myForm.set("image", image);
- // changeState({ loading: true });
diff --git a/src/views/Directory/Bisuness.js b/src/views/Directory/Bisuness.js
deleted file mode 100644
index c63433a..0000000
--- a/src/views/Directory/Bisuness.js
+++ /dev/null
@@ -1,267 +0,0 @@
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import Pagination from "./Pagination";
-
-const Bisuness = () => {
- const [bisuness, setBisuness] = useState([])
- const [currentPage, setCurrentPage] = useState(1);
- const [postsPerPage] = useState(20);
-
-
- const token = isAutheticated();
-
- const getProducts = useCallback(async () => {
- let res = await axios.get(
- `/api/directory/getAll`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data.directory)
- setBisuness(res.data.directory)
- // changeState({
- // ...res.data,
- // pages: Math.ceil(res.data.totalProducts / limit),
- // });
- }, [token]);
-
- useEffect(() => {
- getProducts();
- }, [getProducts]);
-
- // Get current posts
- //pagination
- const indexOfLastPost = currentPage * postsPerPage;
- const indexOfFirstPost = indexOfLastPost - postsPerPage;
- const currentPosts = bisuness.slice(indexOfFirstPost, indexOfLastPost);
-
- // Change page
- const paginate = pageNumber => setCurrentPage(pageNumber);
-
- const handleDelete = async (id) => {
- let status = window.confirm("Do you want to delete");
- if (!status) return;
-
- let res = await axios.delete(`/api/directory/delete/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- // console.log(res)
-
- if (res.data.success == true) {
- swal("success!", "Directory Deleted Successfully!", "success");
- window.location.reload();
-
- }
- };
-
- const toggleStatus = async (id) => {
- let status = window.confirm("Do you want to change status");
- if (!status) {
- return;
- }
- let res = await axios.get(`/api/directory/admin/setStatus/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- // console.log(res)
- if (res.status === 200) window.location.reload();
- };
-
- return (
- <>
-
-
-
- {/* */}
-
-
-
-
Bisuness-Directory
-
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Name |
- Category |
- City |
- Status |
- Actions |
-
-
-
- {currentPosts.map((item, index) =>
-
-
- {item?.name} |
- {item?.category} |
- {item?.city} |
-
-
- {item.status === "true" ? "Live" : "Suspended"}
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
- )}
-
-
-
-
- {/*
-
-
- Showing{" "}
- {!totalProducts
- ? totalProducts
- : page * limit - (limit - 1)}{" "}
- to{" "}
- {totalProducts > limit
- ? limit * page > totalProducts
- ? totalProducts
- : limit * page
- : totalProducts}{" "}
- of {totalProducts} entries
-
-
-
-
-
-
- -
-
-
-
- {getTotalPages.map((pageNo) => {
- return (
- -
-
-
- );
- })}
-
- -
-
-
-
-
-
-
*/}
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
-
- >
- )
-}
-
-export default Bisuness
\ No newline at end of file
diff --git a/src/views/Directory/EditBisuness.js b/src/views/Directory/EditBisuness.js
deleted file mode 100644
index 447f9bc..0000000
--- a/src/views/Directory/EditBisuness.js
+++ /dev/null
@@ -1,565 +0,0 @@
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { Country, State, City } from "country-state-city";
-import swal from 'sweetalert';
-import { Link, useParams } from "react-router-dom";
-import { useHistory } from "react-router-dom";
-
-const EditBisuness = () => {
- const [categoryName, setCategoryName] = useState([]);
- const [image, setImage] = useState();
- const token = isAutheticated();
-
- let history = useHistory();
- const [state, setState] = useState({
- name: "",
- phone: "",
- email: "",
- Building_Name: "",
- Street_Name: "",
- country: "",
- city: "",
- loading: false,
- description: "",
- category: "",
- status: "",
- Glocation: "",
- LinkedinUrl: "",
- FacebookUrl: "",
- InstagramUrl: ""
- });
-
- const { id } = useParams();
- // console.log(id)
-
- const { description, loading } = state;
-
-
- const changeState = (newState) =>
- setState((prevState) => ({ ...prevState, ...newState }));
-
-
-
- const handleChange = (e) => {
- changeState({ ...state, [e.target.name]: e.target.value })
-
- };
-
-
- //category
- const fetchCategory = useCallback(async () => {
- const res = await axios.get(`/api/category/getAll`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
-
- // console.log(res.data.category);
- setCategoryName(res.data.category)
- if (res.status === 200) changeState({ ...res.data });
- }, [token]);
-
- useEffect(async () => {
-
- fetchCategory();
-
- }, [fetchCategory]);
-
-
-
-
-
-
- const fetchDirectory = useCallback(async () => {
- const res = await axios.get(`/api/directory/getOne/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
-
-
- setState(res.data.directory)
- changeState({ loading: false });
- if (res.status === 200) changeState({ ...res.data });
- }, [token]);
-
- useEffect(() => {
- fetchDirectory();
- }, [fetchDirectory]);
-
-
-
-
- const handleSubmit = async () => {
- if (!(state.name && state.phone && state.email && state.Building_Name && state.Street_Name && state.country && state.city && state.description
- && state.category && state.status)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
- myForm.set('name', state.name)
- myForm.set('phone', state.phone)
- myForm.set('email', state.email)
- myForm.set('Building_Name', state.Building_Name)
- myForm.set('Street_Name', state.Street_Name)
- myForm.set('country', state.country)
- myForm.set('city', state.city)
- myForm.set('description', state.description)
-
- myForm.set('category', state.category)
-
- myForm.set('status', state.status)
-
- myForm.set('Glocation', state.Glocation)
- myForm.set('LinkedinUrl', state.Glocation)
- myForm.set('FacebookUrl', state.FacebookUrl)
- myForm.set('InstagramUrl', state.InstagramUrl)
- myForm.set("image", image);
-
- changeState({ loading: true });
- try {
- let res = await axios.put(
- `/api/directory/update/${id}`,
- myForm,
- {
- headers: {
- "content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
-
- if (res.status == 200) {
- changeState({ loading: false });
- swal("Edit Business successfully!");
- history.goBack()
- }
- } catch (error) {
- swal('Error!', error, 'error')
-
- changeState({ loading: false });
- }
-
- };
- const onCancel = () => {
- history.goBack()
-
- };
-
-
-
-
- // console.log(image)
- return (
- <>
-
-
-
-
-
-
- Edit Bisuness
-
-
-
-
-
- {/* */}
-
- {/* */}
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
- {/* */}
- {/*
*/}
- {/* */}
-
-
- {/* */}
-
- {/* */}
- {/*
*/}
-
- >
- )
-}
-
-export default EditBisuness
\ No newline at end of file
diff --git a/src/views/Directory/Pagination.js b/src/views/Directory/Pagination.js
deleted file mode 100644
index e2ce0f8..0000000
--- a/src/views/Directory/Pagination.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-import { Link } from "react-router-dom";
-const Pagination = ({ postsPerPage, totalPosts, paginate }) => {
- const pageNumbers = [];
-
- for (let i = 1; i <= Math.ceil(totalPosts / postsPerPage); i++) {
- pageNumbers.push(i);
- }
-
- return (
-
- );
-};
-
-export default Pagination;
\ No newline at end of file
diff --git a/src/views/Directory/View_Bisuness.js b/src/views/Directory/View_Bisuness.js
deleted file mode 100644
index d8d21d4..0000000
--- a/src/views/Directory/View_Bisuness.js
+++ /dev/null
@@ -1,119 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import { useParams } from "react-router-dom";
-const View_Bisuness = () => {
- const { id } = useParams();
- // console.log(id)
- const [bisuness, setBisuness] = useState([])
-
-
- // const { products, page, limit, totalProducts, pages } = state;
-
-
- const token = isAutheticated();
-
- const view_business = useCallback(async () => {
- let res = await axios.get(
- `/api/directory/getOne/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data.directory)
- setBisuness(res.data.directory)
- // changeState({
- // ...res.data,
- // pages: Math.ceil(res.data.totalProducts / limit),
- // });
- // limit, page,
- }, [token]);
-
- useEffect(() => {
- view_business();
- }, [view_business]);
-
-
- return (
- <>
-
-
-
- {/* */}
-
-
-
-
View Bisuness
- {/* */}
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
- Name | {bisuness?.name} |
- Bisuness image |
-
- |
- Category | {bisuness?.category} |
- email | {bisuness?.email} |
- phone | {bisuness?.phone} |
- Building_Name | {bisuness?.Building_Name} |
- Street_Name | {bisuness?.Street_Name} |
- city | {bisuness?.city} |
- description | {bisuness?.description} |
- Status |
-
- {bisuness?.status ? "Live" : "Suspended"}
-
- |
- Google Location | {bisuness?.Glocation} |
- LinkedinUrl | {bisuness?.LinkedinUrl} |
- FacebookUrl | {bisuness?.FacebookUrl} |
- intagramUrl | {bisuness?.InstagramUrl} |
-
-
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- >
- )
-}
-
-export default View_Bisuness
\ No newline at end of file
diff --git a/src/views/Events/AddEvent.js b/src/views/Events/AddEvent.js
deleted file mode 100644
index 0366dce..0000000
--- a/src/views/Events/AddEvent.js
+++ /dev/null
@@ -1,216 +0,0 @@
-
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilSettings, cilLockLocked, cilUser, cilBell, cilLocationPin, cilAudioDescription, cilCalendar, cilWatch, cilAlarm } from '@coreui/icons'
-const AddEvent = () => {
- const token = isAutheticated();
- let history = useHistory();
- const [image, setImage] = useState("");
- const [title, setTitle] = useState("");
- const [description, setDescription] = useState("");
- const [location, setLocation] = useState("");
- const [date, setDate] = useState(new Date());
- const [time, setTime] = useState('');
-
- const [loading, setLoading] = useState(false);
- const handleSubmit = async () => {
- if (!(title && description && image && location && time && date)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("title", title);
- myForm.set("description", description);
- myForm.set("location", location);
- myForm.set("date", date)
- myForm.set("time", time)
- myForm.set("image", image);
- setLoading({ loading: true });
- // console.log(image)
- try {
- let res = await axios.post(
- `/api/event/create`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- if (res.data) {
- swal("success!", "Event Added Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
- } catch (error) {
- swal('Error!', 'Something went Wrong', 'error')
-
- setLoading(false);
- }
-
-
-
- };
- const handleImage = (e) => {
- const files = e.target.files[0];
- // console.log(files)
- setImage(files);
-
- };
- //
- const onCancel = () => {
- // window.location = "/comproducts";
- history.goBack()
-
- };
-
- return (
- <>
-
-
-
-
-
-
-
- Add Event
-
-
-
-
-
-
- setTitle(e.target.value)}
- value={title}
- placeholder="Title (maximum 50 characters)" />
-
-
- {title ? <>
- {50 - title.length} characters left
- > : <>>
-
- }
-
-
-
-
-
- setDescription(e.target.value)}
- value={description}
- placeholder="Description (maximum 250 characters)" />
-
- {description ? <>
- {250 - description.length} characters left
- > : <>>
-
- }
-
-
- {/* Date* */}
-
-
- {/* */}
-
- setDate(e.target.value)}
- value={date}
- placeholder="Event Date" />
-
-
-
-
- {/* Time* */}
-
-
- setTime(e.target.value)}
- value={time}
- placeholder="Event Time" />
-
-
-
-
-
- setLocation(e.target.value)}
- value={location}
- placeholder="Location" />
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default AddEvent
\ No newline at end of file
diff --git a/src/views/Events/AllRegisterUser.js b/src/views/Events/AllRegisterUser.js
deleted file mode 100644
index 38bab08..0000000
--- a/src/views/Events/AllRegisterUser.js
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { Link, useParams } from "react-router-dom";
-import { isAutheticated } from "../../auth";
-
-const AllRegisterUser = () => {
- const { id } = useParams();
- const token = isAutheticated();
- const [registerUser, setRegisterUser] = useState([])
- const getRegisterUser = useCallback(async () => {
- let res = await axios.get(
- `/api/event/admin/registerUser/getAll/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- setRegisterUser(res.data.user)
-
-
- }, [token]);
-
- useEffect(() => {
- getRegisterUser();
- }, [getRegisterUser]);
- // console.log(registerUser)
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
- <>
-
-
- {/* */}
-
-
-
-
CMP-Event Register Users
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Name |
- Profile Image |
- Email |
- Phone |
- register At |
-
-
-
-
- {registerUser && registerUser.map((item, index) =>
-
- {item.userId?.name} |
-
-  |
- {item.userId?.email} |
- {item.userId?.phone} |
-
- {/* {item?.addedOn} */}
- {new Date(`${item.userId?.createdAt}`).toDateString()} , {`${formatAMPM(item.userId?.createdAt)}`}
-
- |
-
-
-
-
- )}
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
>
- );
-}
-
-export default AllRegisterUser;
diff --git a/src/views/Events/EditEvent.js b/src/views/Events/EditEvent.js
deleted file mode 100644
index 4b1a62b..0000000
--- a/src/views/Events/EditEvent.js
+++ /dev/null
@@ -1,235 +0,0 @@
-
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory } from "react-router-dom";
-import { Link, useParams } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilSettings, cilLockLocked, cilUser, cilBell, cilLocationPin, cilAudioDescription, cilCalendar, cilAlarm } from '@coreui/icons'
-const EditEvent = () => {
- const { id } = useParams();
- // console.log(id)
- const token = isAutheticated();
- let history = useHistory();
- const [image, setImage] = useState("");
- const [title, setTitle] = useState("");
- const [description, setDescription] = useState("");
- const [location, setLocation] = useState("");
- const [date, setDate] = useState(new Date());
- const [time, setTime] = useState('');
- const [loading, setLoading] = useState(false);
-
- //fetch one image
- useEffect(async () => {
- const res = await axios.get(`/api/event/getOne/${id}`, {
- // headers: {
- // Authorization: `Bearer ${token}`,
- // },
- });
- // console.log(res.data)
- setTitle(res.data.Event.title)
- setDescription(res.data.Event.description)
- setDate(res.data.Event.date)
- setTime(res.data.Event.time)
- setLocation(res.data.Event.location)
-
- }, [id]);
-
- const handleSubmit = async () => {
- if (!(title && description && image && location && time && date)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("title", title);
- myForm.set("description", description);
- myForm.set("date", date)
- myForm.set("time", time)
- myForm.set("location", location);
- myForm.set("image", image);
- setLoading({ loading: true });
- // console.log(image)
- try {
- let res = await axios.put(
- `/api/event/update/${id}`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- if (res.data) {
- swal("success!", "Event Edit Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
-
- } catch (error) {
- swal('Error!', 'Something went Wrong', 'error')
-
- setLoading(false);
- }
-
-
-
- };
- const handleImage = (e) => {
- const files = e.target.files[0];
- // console.log(files)
- setImage(files);
-
- };
- //
- const onCancel = () => {
- // window.location = "/comproducts";
- history.goBack()
-
- };
-
- return (
- <>
-
-
-
-
-
-
-
- Edit Event
-
-
-
-
-
-
- setTitle(e.target.value)}
- value={title}
- placeholder="Title (maximum 50 characters)" />
-
- {title ? <>
- {50 - title.length} characters left
- > : <>>
-
- }
-
-
-
-
- setDescription(e.target.value)}
- value={description}
- placeholder="Description (maximum 250 characters)" />
-
- {description ? <>
- {250 - description.length} characters left
- > : <>>
-
- }
-
-
- {/* Date* */}
-
-
- {/* */}
-
- setDate(e.target.value)}
- value={date}
- placeholder="Event Date" />
-
-
-
-
- {/* Time* */}
-
-
- setTime(e.target.value)}
- value={time}
- placeholder=" Event time" />
-
-
-
-
-
- setLocation(e.target.value)}
- value={location}
- placeholder="Location" />
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default EditEvent
\ No newline at end of file
diff --git a/src/views/Events/Event.js b/src/views/Events/Event.js
deleted file mode 100644
index ebc413f..0000000
--- a/src/views/Events/Event.js
+++ /dev/null
@@ -1,130 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-import swal from 'sweetalert';
-import RegisterUser from "./RegisterUser";
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-
-function Event() {
- const [event, setEvent] = useState([])
-
- const token = isAutheticated();
-
- const getEvent = useCallback(async () => {
- let res = await axios.get(
- `/api/event/getAll`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- setEvent(res.data.Event)
-
-
- }, [token]);
-
- useEffect(() => {
- getEvent();
- }, [getEvent]);
-
-
- const handleDelete = async (id) => {
- let status = window.confirm("Do you want to delete");
- if (!status) return;
-
- let res = await axios.delete(`/api/event/delete/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- // console.log(res)
- if (res.data.success == true) {
- swal("success!", "Event Deleted Successfully!", "success");
- window.location.reload();
- }
- };
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-Event
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Title |
- Image |
- Event Date |
- Event Time |
- Location |
- Added On |
- Attended By |
- Action |
-
-
-
- {event && event.map((item, index) =>
-
- )}
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default Event;
diff --git a/src/views/Events/RegisterUser.js b/src/views/Events/RegisterUser.js
deleted file mode 100644
index a0ed18b..0000000
--- a/src/views/Events/RegisterUser.js
+++ /dev/null
@@ -1,92 +0,0 @@
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-
-const RegisterUser = ({ item, handleDelete, formatAMPM }) => {
- const [totalRegisterUser, setTotalRegisterUser] = useState([])
- const token = isAutheticated();
- const getRegisterUser = useCallback(async () => {
- let res = await axios.get(
- `/api/event/admin/registerUser/getAll/${item._id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- setTotalRegisterUser(res.data.totalUserRegister)
-
-
- }, [token]);
-
- useEffect(() => {
- getRegisterUser();
- }, [getRegisterUser, item]);
- return (
- <>
-
- {item?.title} |
-
-  |
- {new Date(`${item?.date}`).toDateString()} |
- {item?.time} |
- {item?.location} |
-
- {/* {item?.addedOn} */}
- {new Date(`${item?.addedOn}`).toDateString()} , {`${formatAMPM(item?.addedOn)}`}
-
- |
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- >
- )
-}
-
-export default RegisterUser
\ No newline at end of file
diff --git a/src/views/Events/ViewEvent.js b/src/views/Events/ViewEvent.js
deleted file mode 100644
index b8efbc7..0000000
--- a/src/views/Events/ViewEvent.js
+++ /dev/null
@@ -1,123 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { Link, useParams } from "react-router-dom";
-import { isAutheticated } from "../../auth";
-
-function ViewEvent() {
- const [event, setEvent] = useState([])
- const { id } = useParams();
- const token = isAutheticated();
-
- const getEvent = useCallback(async () => {
- let res = await axios.get(
- `/api/event/getOne/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data.Event)
- setEvent(res.data.Event)
-
-
- }, [token]);
-
- useEffect(() => {
- getEvent();
- }, [getEvent]);
-
-
-
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-Event
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Id | {event?._id} |
- Title | {event?.title} |
-
- Image |
-
- |
- Description | {event?.description} |
- Event Date | {new Date(`${event?.date}`).toDateString()} |
- Event Time | {event?.time} |
- Location | {event?.location} |
- Added On |
- {new Date(`${event?.addedOn}`).toDateString()} , {`${formatAMPM(event?.addedOn)}`}
- |
- Updated At |
-
- {new Date(`${event?.updatedAt}`).toDateString()} , {`${formatAMPM(event?.updatedAt)}`}
- |
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default ViewEvent;
diff --git a/src/views/FAQs/AddFaqs.js b/src/views/FAQs/AddFaqs.js
deleted file mode 100644
index a0ad586..0000000
--- a/src/views/FAQs/AddFaqs.js
+++ /dev/null
@@ -1,174 +0,0 @@
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilSettings, cilLockLocked, cilUser, cilNoteAdd } from '@coreui/icons'
-const AddFaqs = () => {
- const token = isAutheticated();
- let history = useHistory();
- // const [image, setImage] = useState("");
- const [topic, setTopic] = useState("");
- const [description, setDescription] = useState("");
- const [loading, setLoading] = useState(false);
-
-
- const handleSubmit = async () => {
- if (!(topic && description)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("topic", topic);
- myForm.set("description", description);
- // myForm.set("image", image);
- setLoading({ loading: true });
- // console.log(image)
- try {
- let res = await axios.post(
- `/api/faqs/create/`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- console.log(res.data)
- if (res.data) {
- swal("success!", "FAQs Added Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
- } catch (error) {
- swal('Error!', error, 'error')
-
- setLoading(false);
- }
-
-
-
- };
- // const handleImage = (e) => {
- // const files = e.target.files[0];
- // // console.log(files)
- // setImage(files);
-
- // };
- //
- const onCancel = () => {
- // window.location = "/comproducts";
- history.goBack()
-
- };
-
- return (
- <>
-
-
-
-
-
-
-
- Add FAQs
-
-
-
-
-
-
- setTopic(e.target.value)}
- value={topic}
- placeholder="Topic ( maximum 50 character )" />
-
- {topic ? <>
- {50 - topic.length} characters left
- > : <>>
-
- }
-
-
-
-
-
-
- {description ? <>
- {500 - description.length} characters left
- > : <>>
-
- }
- {/*
-
-
-
-
- */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default AddFaqs
\ No newline at end of file
diff --git a/src/views/FAQs/EditFaqs.js b/src/views/FAQs/EditFaqs.js
deleted file mode 100644
index b6355a4..0000000
--- a/src/views/FAQs/EditFaqs.js
+++ /dev/null
@@ -1,185 +0,0 @@
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory, useParams } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilSettings, cilLockLocked, cilUser, cilNoteAdd } from '@coreui/icons'
-const EditFaqs = () => {
- const { id } = useParams()
- const token = isAutheticated();
- let history = useHistory();
- // const [image, setImage] = useState("");
- const [topic, setTopic] = useState("");
- const [description, setDescription] = useState("");
- const [loading, setLoading] = useState(false);
-
- //fetch one image
- useEffect(async () => {
- const res = await axios.get(`/api/faqs/getOne/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- setTopic(res.data.Faqs.topic)
- setDescription(res.data.Faqs.description)
-
- }, [id]);
- const handleSubmit = async () => {
- if (!(topic && description)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("topic", topic);
- myForm.set("description", description);
- // myForm.set("image", image);
- setLoading({ loading: true });
- // console.log(image)
- try {
- let res = await axios.put(
- `/api/faqs/update/${id}`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- console.log(res.data)
- if (res.data) {
- swal("success!", "FAQs Edit Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
- } catch (error) {
- swal('Error!', error, 'error')
-
- setLoading(false);
- }
-
-
-
- };
- // const handleImage = (e) => {
- // const files = e.target.files[0];
- // // console.log(files)
- // setImage(files);
-
- // };
- //
- const onCancel = () => {
- // window.location = "/comproducts";
-
- history.goBack()
-
- };
-
- return (
- <>
-
-
-
-
-
-
-
- Edit FAQs
-
-
-
-
-
-
- setTopic(e.target.value)}
- value={topic}
- placeholder="Topic ( maximum 50 character )" />
-
- {topic ? <>
- {50 - topic.length} characters left
- > : <>>
-
- }
-
-
-
-
-
- {description ? <>
- {500 - description.length} characters left
- > : <>>
-
- }
- {/*
-
-
-
-
- */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default EditFaqs
\ No newline at end of file
diff --git a/src/views/FAQs/Faqs.js b/src/views/FAQs/Faqs.js
deleted file mode 100644
index 1e8907e..0000000
--- a/src/views/FAQs/Faqs.js
+++ /dev/null
@@ -1,164 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-
-function Faqs() {
- const [faqs, setFeqs] = useState([])
-
- const token = isAutheticated();
-
- const getfaqs = useCallback(async () => {
- let res = await axios.get(
- `/api/faqs/getAll`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- setFeqs(res.data.Faqs)
-
-
- }, [token]);
-
- useEffect(() => {
- getfaqs();
- }, [getfaqs]);
-
-
- const handleDelete = async (id) => {
- let status = window.confirm("Do you want to delete");
- if (!status) return;
-
- let res = await axios.delete(`/api/faqs/delete/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- // console.log(res)
- if (res.data.success == true) {
- swal("success!", "FAQs Deleted Successfully!", "success");
- window.location.reload();
- }
- };
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-FAQs
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Topic |
- {/* Image | */}
- Added On |
- Action |
-
-
-
- {faqs && faqs.map((item, index) =>
-
- {item?.topic} |
- {/*
-  | */}
-
- {/* {item?.addedOn} */}
- {new Date(`${item?.createdAt}`).toDateString()} , {`${formatAMPM(item?.createdAt)}`}
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- )}
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default Faqs;
diff --git a/src/views/FAQs/ViewFaqs.js b/src/views/FAQs/ViewFaqs.js
deleted file mode 100644
index 8e6c39f..0000000
--- a/src/views/FAQs/ViewFaqs.js
+++ /dev/null
@@ -1,132 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { Link, useParams } from "react-router-dom";
-import { isAutheticated } from "../../auth";
-
-function ViewFaqs() {
- const [faqs, setFaqs] = useState([])
- const { id } = useParams();
- // console.log(id)
- const token = isAutheticated();
-
- const getFaqs = useCallback(async () => {
- let res = await axios.get(
- `/api/faqs/getOne/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data.news)
- setFaqs(res.data.Faqs)
-
-
- }, [token]);
-
- useEffect(() => {
- getFaqs();
- }, [getFaqs]);
-
-
-
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-FAQs
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Id |
- {faqs?._id} |
-
- TOPIC |
- {faqs?.topic} |
-
-
- {/* Image |
-
-
- |
-
*/}
-
- Description |
- {faqs?.description} |
-
- Added On |
-
- {new Date(`${faqs?.createdAt}`).toDateString()} , {`${formatAMPM(faqs?.createdAt)}`}
- |
-
- Updated At |
-
- {new Date(`${faqs?.updatedAt}`).toDateString()} , {`${formatAMPM(faqs?.updatedAt)}`}
- |
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default ViewFaqs;
diff --git a/src/views/Feedback/Pagination.js b/src/views/Feedback/Pagination.js
deleted file mode 100644
index 92a8292..0000000
--- a/src/views/Feedback/Pagination.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-import { Link } from "react-router-dom";
-const Pagination = ({ postsPerPage, totalPosts, paginate }) => {
- const pageNumbers = [];
-
- for (let i = 1; i <= Math.ceil(totalPosts / postsPerPage); i++) {
- pageNumbers.push(i);
- }
-
- return (
-
- );
-};
-
-export default Pagination;
\ No newline at end of file
diff --git a/src/views/Feedback/ViewFeedback.js b/src/views/Feedback/ViewFeedback.js
deleted file mode 100644
index 7cd90bd..0000000
--- a/src/views/Feedback/ViewFeedback.js
+++ /dev/null
@@ -1,123 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { Link, useParams } from "react-router-dom";
-import { isAutheticated } from "../../auth";
-
-function ViewFeedback() {
- const [user, setUser] = useState([])
-
-
- const [feedback, setFeedback] = useState([])
- const { id } = useParams();
- // console.log(id)
- const token = isAutheticated();
-
- const getFeedback = useCallback(async () => {
- let res = await axios.get(
- `/api/feedback/getOne/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- setFeedback(res.data.feedback)
-
- let resp = await axios.get(
- `/api/v1/admin/user/${feedback.user}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- setUser(resp.data.user)
-
-
- }, [token, feedback.user]);
-
- useEffect(() => {
- getFeedback();
- }, [getFeedback]);
-
-
-
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-Customer feedback
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- User_Id | {user?._id} |
- Name | {feedback?.name} |
- email | {user?.email} |
-
- Image |
-
- |
- Description | {feedback?.description} |
-
- Pnone No. | {user?.phone} |
- Feedback Given At |
- {new Date(`${feedback?.createdAt}`).toDateString()} , {`${formatAMPM(feedback?.createdAt)}`}
- |
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default ViewFeedback;
diff --git a/src/views/Feedback/feedback.js b/src/views/Feedback/feedback.js
deleted file mode 100644
index f4f1244..0000000
--- a/src/views/Feedback/feedback.js
+++ /dev/null
@@ -1,146 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import Pagination from "./Pagination";
-import { Link } from "react-router-dom";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-
-function feedback() {
- const [feedback, setFeedback] = useState([])
-
-
- const [currentPage, setCurrentPage] = useState(1);
- const [postsPerPage] = useState(20);
- const token = isAutheticated();
-
- const getRestriction = useCallback(async () => {
- let res = await axios.get(
- `/api/feedback/getAll`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data.feedback)
- setFeedback(res.data.feedback)
-
-
- }, [token]);
-
- useEffect(() => {
- getRestriction();
- }, [getRestriction]);
-
-
- // console.log(cmsRes)
-
- // Get current posts
- //pagination
- const indexOfLastPost = currentPage * postsPerPage;
- const indexOfFirstPost = indexOfLastPost - postsPerPage;
- const currentPosts = feedback.slice(indexOfFirstPost, indexOfLastPost);
-
- // Change page
- const paginate = pageNumber => setCurrentPage(pageNumber);
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
-
- return (
- <>
-
-
-
- {/* */}
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
- Name |
- Description |
- Given At |
- Action |
-
-
-
- {currentPosts && currentPosts.map((item, index) =>
-
-
- {item?.name} |
- {item?.description} |
-
-
-
- {new Date(`${item?.createdAt}`).toDateString()} , {`${formatAMPM(item?.createdAt)}`}
-
- |
-
-
-
-
-
-
-
-
-
-
- |
-
- )}
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
-
- >
- );
-}
-
-export default feedback;
diff --git a/src/views/News/AddNews.js b/src/views/News/AddNews.js
deleted file mode 100644
index 2894100..0000000
--- a/src/views/News/AddNews.js
+++ /dev/null
@@ -1,161 +0,0 @@
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilSettings, cilLockLocked, cilUser } from '@coreui/icons'
-const AddNews = () => {
- const token = isAutheticated();
- let history = useHistory();
- const [image, setImage] = useState("");
- const [title, setTitle] = useState("");
- const [description, setDescription] = useState("");
- const [loading, setLoading] = useState(false);
-
-
- const handleSubmit = async () => {
- if (!(title && description && image)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("title", title);
- myForm.set("description", description);
- myForm.set("image", image);
- setLoading({ loading: true });
- // console.log(image)
- try {
- let res = await axios.post(
- `/api/news/create`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- console.log(res.data)
- if (res.data) {
- swal("success!", "News Added Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
- } catch (error) {
- swal('Error!', error, 'error')
-
- setLoading(false);
- }
-
-
-
- };
- const handleImage = (e) => {
- const files = e.target.files[0];
- // console.log(files)
- setImage(files);
-
- };
- //
- const onCancel = () => {
- // window.location = "/comproducts";
- history.goBack()
-
- };
-
- return (
- <>
-
-
-
-
-
-
-
- Add News
-
-
-
-
-
-
- setTitle(e.target.value)}
- value={title}
- placeholder="Title" />
-
-
-
-
-
- setDescription(e.target.value)}
- value={description}
- placeholder="Description" />
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default AddNews
\ No newline at end of file
diff --git a/src/views/News/EditNews.js b/src/views/News/EditNews.js
deleted file mode 100644
index ab0d633..0000000
--- a/src/views/News/EditNews.js
+++ /dev/null
@@ -1,176 +0,0 @@
-
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory } from "react-router-dom";
-import { Link, useParams } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilSettings, cilLockLocked, cilUser } from '@coreui/icons'
-const EditNews = () => {
- const { id } = useParams();
- // console.log(id)
- const token = isAutheticated();
- let history = useHistory();
- const [image, setImage] = useState("");
- const [title, setTitle] = useState("");
- const [description, setDescription] = useState("");
- const [loading, setLoading] = useState(false);
-
- //fetch one image
- useEffect(async () => {
- const res = await axios.get(`/api/news/getOne/${id}`, {
- // headers: {
- // Authorization: `Bearer ${token}`,
- // },
- });
- setTitle(res.data.news.title)
- setDescription(res.data.news.description)
-
- }, [id]);
-
- const handleSubmit = async () => {
- if (!(title && description && image)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("title", title);
- myForm.set("description", description);
- myForm.set("image", image);
- setLoading({ loading: true });
- // console.log(image)
- try {
- let res = await axios.put(
- `/api/news/update/${id}`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- if (res.data) {
- swal("success!", "News Edit Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
- } catch (error) {
- swal('Error!', error, 'error')
-
- setLoading(false);
- }
-
-
-
- };
- const handleImage = (e) => {
- const files = e.target.files[0];
- // console.log(files)
- setImage(files);
-
- };
- //
- const onCancel = () => {
- // window.location = "/comproducts";
- history.goBack()
-
- };
-
- return (
- <>
-
-
-
-
-
-
-
- Edit News
-
-
-
-
-
-
- setTitle(e.target.value)}
- value={title}
- placeholder="Title" />
-
-
-
-
-
- setDescription(e.target.value)}
- value={description}
- placeholder="Description" />
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default EditNews
\ No newline at end of file
diff --git a/src/views/News/News.js b/src/views/News/News.js
deleted file mode 100644
index beb11e1..0000000
--- a/src/views/News/News.js
+++ /dev/null
@@ -1,164 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-
-function News() {
- const [news, setNews] = useState([])
-
- const token = isAutheticated();
-
- const getNews = useCallback(async () => {
- let res = await axios.get(
- `/api/news/getAll`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
-
- setNews(res.data.news)
-
-
- }, [token]);
-
- useEffect(() => {
- getNews();
- }, [getNews]);
-
-
- const handleDelete = async (id) => {
- let status = window.confirm("Do you want to delete");
- if (!status) return;
-
- let res = await axios.delete(`/api/news/delete/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- console.log(res)
- if (res.data.success == true) {
- swal("success!", "News Deleted Successfully!", "success");
- window.location.reload();
- }
- };
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-News
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Title |
- Image |
- Added On |
- Action |
-
-
-
- {news && news.map((item, index) =>
-
- {item?.title} |
-
-  |
-
- {/* {item?.addedOn} */}
- {new Date(`${item?.addedOn}`).toDateString()} , {`${formatAMPM(item?.addedOn)}`}
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- )}
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default News;
diff --git a/src/views/News/ViewNews.js b/src/views/News/ViewNews.js
deleted file mode 100644
index 98ce43a..0000000
--- a/src/views/News/ViewNews.js
+++ /dev/null
@@ -1,131 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { Link, useParams } from "react-router-dom";
-import { isAutheticated } from "../../auth";
-
-function ViewNews() {
- const [news, setNews] = useState([])
- const { id } = useParams();
- const token = isAutheticated();
-
- const getNews = useCallback(async () => {
- let res = await axios.get(
- `/api/news/getOne/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
-
- setNews(res.data.news)
-
-
- }, [token]);
-
- useEffect(() => {
- getNews();
- }, [getNews]);
-
-
-
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-News
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Id |
- {news?._id} |
-
- Title |
- {news?.title} |
-
-
- Image |
-
-
- |
-
-
- Description |
- {news?.description} |
-
- Added On |
-
- {new Date(`${news?.addedOn}`).toDateString()} , {`${formatAMPM(news?.addedOn)}`}
- |
-
- Updated At |
-
- {new Date(`${news?.updatedAt}`).toDateString()} , {`${formatAMPM(news?.updatedAt)}`}
- |
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default ViewNews;
diff --git a/src/views/Offers/AddOffer.js b/src/views/Offers/AddOffer.js
deleted file mode 100644
index 81a81fc..0000000
--- a/src/views/Offers/AddOffer.js
+++ /dev/null
@@ -1,240 +0,0 @@
-
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilSettings, cilLockLocked, cilUser, cilBell, cilLocationPin, cilAudioDescription } from '@coreui/icons'
-const AddOffer = () => {
- const token = isAutheticated();
- let history = useHistory();
- //console.log(token)
- const [image, setImage] = useState("");
- const [title, setTitle] = useState("");
- const [bisunessName, setBisunessName] = useState([]);
- const [sendBisunessName, setSendBisunessName] = useState('');
-
- const [description, setDescription] = useState("");
- const [location, setLocation] = useState("");
-
- const [loading, setLoading] = useState(false);
-
- const changeState = (newState) =>
- setBisunessName((prevState) => ({ ...prevState, ...newState }));
-
- const handleChange = (e) => {
- changeState({ ...bisunessName, [e.target.name]: e.target.value })
-
- };
- const fetchBusuness = useCallback(async () => {
- const res = await axios.get(`/api/directory/getAll`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
-
- // console.log(res.data.directory);
- setBisunessName(res.data.directory)
-
- }, [token]);
-
- useEffect(async () => {
- fetchBusuness();
-
- }, [fetchBusuness]);
-
-
-
- const handleSubmit = async () => {
- if (!(title && description && image && location && sendBisunessName)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("title", title);
- myForm.set("description", description);
- myForm.set("bisunessName", sendBisunessName);
- myForm.set("location", location);
- myForm.set("image", image);
- setLoading({ loading: true });
- // console.log(image)
- try {
- let res = await axios.post(
- `/api/offer/create`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- if (res.data) {
- swal("success!", "Event Added Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
-
- } catch (error) {
- swal('Error!', 'something Went Wrong', 'error')
-
- setLoading(false);
- }
-
-
- };
- const handleImage = (e) => {
- const files = e.target.files[0];
- // console.log(files)
- setImage(files);
-
- };
- //
- const onCancel = () => {
- // window.location = "/comproducts";
- history.goBack()
-
- };
- // console.log(bisunessName)
- return (
- <>
-
-
-
-
-
-
-
- Add New Offer
-
-
-
-
-
-
- setTitle(e.target.value)}
- value={title}
- placeholder="Title (maximum 50 characters)" />
-
-
- {title ? <>
- {50 - title.length} characters left
- > : <>>
-
- }
-
-
-
-
-
- setDescription(e.target.value)}
- value={description}
- placeholder="Description (maximum 250 characters)" />
-
- {description ? <>
- {250 - description.length} characters left
- > : <>>
-
- }
-
-
-
-
-
-
-
-
-
-
-
- setLocation(e.target.value)}
- value={location}
- placeholder="Location" />
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default AddOffer
\ No newline at end of file
diff --git a/src/views/Offers/EditOffer.js b/src/views/Offers/EditOffer.js
deleted file mode 100644
index 56a6d88..0000000
--- a/src/views/Offers/EditOffer.js
+++ /dev/null
@@ -1,247 +0,0 @@
-
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory } from "react-router-dom";
-import swal from 'sweetalert';
-import { Link, useParams } from "react-router-dom";
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilSettings, cilLockLocked, cilUser, cilBell, cilLocationPin, cilAudioDescription } from '@coreui/icons'
-const EditOffer = () => {
- const { id } = useParams();
- const token = isAutheticated();
- // console.log(token)
- let history = useHistory();
- const [image, setImage] = useState("");
- const [title, setTitle] = useState("");
- const [bisunessName, setBisunessName] = useState([]);
- const [sendBisunessName, setSendBisunessName] = useState('');
-
- const [description, setDescription] = useState("");
- const [location, setLocation] = useState("");
-
- const [loading, setLoading] = useState(false);
-
-
- //fetch one Offer
- useEffect(async () => {
- const res = await axios.get(`/api/offer/getOne/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- // console.log(res.data)
- setTitle(res.data.offer.title)
- setDescription(res.data.offer.description)
- setLocation(res.data.offer.location)
- setSendBisunessName(res.data.offer.bisunessName)
-
- }, [id]);
- const fetchBusuness = useCallback(async () => {
- const res = await axios.get(`/api/directory/getAll`, {
- // headers: {
- // Authorization: `Bearer ${token}`,
- // },
- });
-
- // console.log(res.data.directory);
- setBisunessName(res.data.directory)
-
- }, [token]);
-
- useEffect(async () => {
- fetchBusuness();
-
- }, [fetchBusuness]);
-
-
-
- const handleSubmit = async () => {
- if (!(title && description && image && location && sendBisunessName)) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- const myForm = new FormData();
-
- myForm.set("title", title);
- myForm.set("description", description);
- myForm.set("bisunessName", sendBisunessName);
- myForm.set("location", location);
- myForm.set("image", image);
- setLoading({ loading: true });
- // console.log(image)
- try {
- let res = await axios.put(
- `/api/offer/update/${id}`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- if (res.data) {
- swal("success!", "Event Added Successfully!", "success");
- setLoading(false);
- history.goBack();
- }
- } catch (error) {
- swal('Error!', 'something Went Wrong', 'error')
-
- setLoading(false);
- }
-
-
-
- };
- const handleImage = (e) => {
- const files = e.target.files[0];
- // console.log(files)
- setImage(files);
-
- };
- //
- const onCancel = () => {
- // window.location = "/comproducts";
- history.goBack()
-
- };
- // console.log(bisunessName)
- return (
- <>
-
-
-
-
-
-
-
- Edit Offer
-
-
-
-
-
-
- setTitle(e.target.value)}
- value={title}
- placeholder="Title (maximum 50 characters)" />
-
- {title ? <>
- {50 - title.length} characters left
- > : <>>
-
- }
-
-
-
-
- setDescription(e.target.value)}
- value={description}
- placeholder="Description (maximum 250 characters)" />
-
- {description ? <>
- {250 - description.length} characters left
- > : <>>
-
- }
-
-
-
-
-
-
-
-
-
-
-
- setLocation(e.target.value)}
- value={location}
- placeholder="Location" />
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default EditOffer
\ No newline at end of file
diff --git a/src/views/Offers/Offer.js b/src/views/Offers/Offer.js
deleted file mode 100644
index 81f824d..0000000
--- a/src/views/Offers/Offer.js
+++ /dev/null
@@ -1,162 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-
-function Offer() {
- const [offer, setOffer] = useState([])
-
- const token = isAutheticated();
-
- const getOffer = useCallback(async () => {
- let res = await axios.get(
- `/api/offer/getAll`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(res.data)
- setOffer(res.data.offer)
-
-
- }, [token]);
-
- useEffect(() => {
- getOffer();
- }, [getOffer]);
-
-
- const handleDelete = async (id) => {
- let status = window.confirm("Do you want to delete");
- if (!status) return;
-
- let res = await axios.delete(`/api/offer/delete/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- console.log(res)
- if (res.data.success == true) {
- swal("success!", "Offer Deleted Successfully!", "success");
- window.location.reload();
- }
- };
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-Offers
-
-
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Title |
- Image |
- Business Name |
- Location |
- Added On |
- Action |
-
-
-
- {offer && offer.map((item, index) =>
-
- {item?.title} |
-
-
-  |
- {item?.bisunessName} |
- {item?.location} |
-
- {/* {item?.addedOn} */}
- {new Date(`${item?.addedOn}`).toDateString()} , {`${formatAMPM(item?.addedOn)}`}
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- )}
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default Offer;
diff --git a/src/views/Offers/ViewOffer.js b/src/views/Offers/ViewOffer.js
deleted file mode 100644
index 6fea4c7..0000000
--- a/src/views/Offers/ViewOffer.js
+++ /dev/null
@@ -1,136 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { Link, useParams } from "react-router-dom";
-import { isAutheticated } from "../../auth";
-
-function ViewOffer() {
- const [offer, setOffer] = useState([])
- const { id } = useParams();
- const token = isAutheticated();
-
- const getOffer = useCallback(async () => {
- let res = await axios.get(
- `/api/offer/getOne/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
-
- setOffer(res.data.offer)
-
-
- }, [token]);
-
- useEffect(() => {
- getOffer();
- }, [getOffer]);
-
-
-
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-Offers
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Id |
- {offer?._id} |
-
- Title |
- {offer?.title} |
-
-
- Image |
-
-
- |
-
- Bisuness Name |
- {offer?.bisunessName} |
-
- Description |
- {offer?.description} |
-
- Location |
- {offer?.location} |
-
- Added On |
-
- {new Date(`${offer?.addedOn}`).toDateString()} , {`${formatAMPM(offer?.addedOn)}`}
- |
-
- Updated At |
-
- {new Date(`${offer?.updatedAt}`).toDateString()} , {`${formatAMPM(offer?.updatedAt)}`}
- |
-
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default ViewOffer;
diff --git a/src/views/Requirement/AddRequirement.js b/src/views/Requirement/AddRequirement.js
deleted file mode 100644
index 672e55a..0000000
--- a/src/views/Requirement/AddRequirement.js
+++ /dev/null
@@ -1,217 +0,0 @@
-
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilSettings, cilLockLocked, cilUser, cilBell, cilLocationPin, cilAudioDescription, cilObjectGroup } from '@coreui/icons'
-const AddRequirement = () => {
- const token = isAutheticated();
- // console.log(token)
- let history = useHistory();
-
- const [areaOfInterest, setAreaOfInterest] = useState("");
- const [description, setDescription] = useState("");
- const [title, setTitle] = useState("");
- const [imagesPreview, setImagesPreview] = useState([]);
- const [allimage, setAllImage] = useState([]);
- // const [images, setImages] = useState([]);
-
- const [loading, setLoading] = useState(false);
-
- const handleImage = (e) => {
-
- setAllImage([...allimage, ...e.target.files]);
-
- // only for file preview------------------------------------
- const files = Array.from(e.target.files);
- files.forEach((file) => {
- const reader = new FileReader();
-
- reader.onload = () => {
- if (reader.readyState === 2) {
- setImagesPreview((old) => [...old, reader.result]);
-
- }
- };
-
- reader.readAsDataURL(file)
- });
- // -----------------------------------------------------------------------------
- };
-
- const handleSubmit = async () => {
- const myForm = new FormData();
-
- myForm.set("title", title);
- myForm.set("description", description);
- myForm.set("areaOfInterest", areaOfInterest);
- allimage.forEach((Singleimage) => {
- myForm.append("image", Singleimage);
-
- });
- if (!(title && description && areaOfInterest && allimage[0])) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- setLoading(true);
- try {
- let res = await axios.post(
- `/api/requirement/create`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- if (res.data.success === true) {
- swal("success!", "Requirements Added Successfully!", "success");
- history.goBack();
- setLoading(false);
- }
-
- } catch (error) {
- setLoading(false);
- swal('Error!', error, 'error')
-
-
- }
-
- };
-
- const onCancel = () => {
- history.goBack()
-
- };
-
- return (
- <>
-
-
-
-
-
-
-
- Add Requirements
-
-
-
-
-
-
- setTitle(e.target.value)}
- value={title}
- placeholder="Title (maximum 50 characters)" />
-
- {title ? <>
- {50 - title.length} characters left
- > : <>>
-
- }
-
-
-
-
- setAreaOfInterest(e.target.value)}
- value={areaOfInterest}
- placeholder="Area Of Interest" />
-
-
-
-
-
-
- setDescription(e.target.value)}
- value={description}
- placeholder="Description (maximum 250 characters)" />
-
- {description ? <>
- {250 - description.length} characters left
- > : <>>
-
- }
-
-
-
- {/* */}
-
-
-
-
*Please Upload maximum four images
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default AddRequirement
\ No newline at end of file
diff --git a/src/views/Requirement/EditRequirement.js b/src/views/Requirement/EditRequirement.js
deleted file mode 100644
index d9ecd62..0000000
--- a/src/views/Requirement/EditRequirement.js
+++ /dev/null
@@ -1,232 +0,0 @@
-
-
-import axios from "axios";
-import React, { useCallback, useEffect, useState } from "react";
-import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import ClipLoader from "react-spinners/ClipLoader";
-import { useHistory, useParams } from "react-router-dom";
-import swal from 'sweetalert';
-
-import {
- CButton,
- CCard,
- CCardBody,
- CCol,
- CContainer,
- CForm,
- CFormInput,
- CInputGroup,
- CInputGroupText,
- CRow,
-} from '@coreui/react'
-import CIcon from '@coreui/icons-react'
-import { cilPencil, cilSettings, cilLockLocked, cilUser, cilBell, cilLocationPin, cilAudioDescription, cilObjectGroup } from '@coreui/icons'
-const EditRequirement = () => {
- const token = isAutheticated();
- const { id } = useParams()
- let history = useHistory();
- const [areaOfInterest, setAreaOfInterest] = useState("");
- const [description, setDescription] = useState("");
- const [title, setTitle] = useState("");
- const [imagesPreview, setImagesPreview] = useState([]);
- const [allimage, setAllImage] = useState([]);
- const [loading, setLoading] = useState(false);
-
- //fetch one requirement
- useEffect(async () => {
- const res = await axios.get(`/api/requirement/getOne/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- // console.log(res.data)
- setTitle(res.data.Requirement.title)
- setDescription(res.data.Requirement.description)
- setAreaOfInterest(res.data.Requirement.areaOfInterest)
-
-
- }, [id]);
-
-
- const handleImage = (e) => {
-
- setAllImage([...allimage, ...e.target.files]);
-
- // only for file preview------------------------------------
- const files = Array.from(e.target.files);
- files.forEach((file) => {
- const reader = new FileReader();
-
- reader.onload = () => {
- if (reader.readyState === 2) {
- setImagesPreview((old) => [...old, reader.result]);
-
- }
- };
-
- reader.readAsDataURL(file)
- });
- // -----------------------------------------------------------------------------
- };
-
-
- const handleSubmit = async () => {
- const myForm = new FormData();
-
- myForm.set("title", title);
- myForm.set("description", description);
- myForm.set("areaOfInterest", areaOfInterest);
- allimage.forEach((Singleimage) => {
- myForm.append("image", Singleimage);
-
- });
- if (!(title && description && areaOfInterest && allimage[0])) {
- return swal('Error!', 'All fields are required', 'error')
-
- }
- setLoading(true);
- try {
- let res = await axios.put(
- `/api/requirement/update/${id}`, myForm,
- {
- headers: {
- "Content-Type": 'multipart/form-data',
- Authorization: `Bearer ${token}`,
- },
- }
- );
- if (res.data.success === true) {
- swal("success!", "Requirements Updated Successfully!", "success");
- history.goBack();
- setLoading(false);
- }
-
- } catch (error) {
- setLoading(false);
- swal('Error!', error, 'error')
-
-
- }
-
- };
-
- const onCancel = () => {
- history.goBack()
-
- };
-
- return (
- <>
-
-
-
-
-
-
-
- Edit Requirements
-
-
-
-
-
-
- setTitle(e.target.value)}
- value={title}
- placeholder="Title (maximum 50 characters)" />
-
- {title ? <>
- {50 - title.length} characters left
- > : <>>
-
- }
-
-
-
-
- setAreaOfInterest(e.target.value)}
- value={areaOfInterest}
- placeholder="Area Of Interest" />
-
-
-
-
-
-
- setDescription(e.target.value)}
- value={description}
- placeholder="Description (maximum 250 characters)" />
-
- {description ? <>
- {250 - description.length} characters left
- > : <>>
-
- }
-
-
-
- {/* */}
-
-
-
-
*Please Upload maximum four images
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
-}
-
-export default EditRequirement
\ No newline at end of file
diff --git a/src/views/Requirement/Pagination.js b/src/views/Requirement/Pagination.js
deleted file mode 100644
index 4df8d64..0000000
--- a/src/views/Requirement/Pagination.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-import { Link } from "react-router-dom";
-const Pagination = ({ postsPerPage, totalPosts, paginate }) => {
- const pageNumbers = [];
-
- for (let i = 1; i <= Math.ceil(totalPosts / postsPerPage); i++) {
- pageNumbers.push(i);
- }
-
- return (
-
- );
-};
-
-export default Pagination;
\ No newline at end of file
diff --git a/src/views/Requirement/Requirement.js b/src/views/Requirement/Requirement.js
deleted file mode 100644
index 6264d5d..0000000
--- a/src/views/Requirement/Requirement.js
+++ /dev/null
@@ -1,142 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { isAutheticated } from "../../auth";
-import Pagination from "./Pagination";
-import RequirementOpt from "./RequirementOpt";
-
-function Requirement() {
- const [requirement, setRequirement] = useState([])
- const [currentPage, setCurrentPage] = useState(1);
- const [postsPerPage] = useState(20);
- const token = isAutheticated();
- // console.log(token)
- const getRequirement = useCallback(async () => {
- let res = await axios.get(
- `/api/requirement/getAll`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
-
- setRequirement(res.data.Requirement)
-
- }, [token]);
-
- useEffect(() => {
- getRequirement();
- }, [getRequirement]);
-
-
- const indexOfLastPost = currentPage * postsPerPage;
- const indexOfFirstPost = indexOfLastPost - postsPerPage;
- const currentPosts = requirement.slice(indexOfFirstPost, indexOfLastPost);
-
- // Change page
- const paginate = pageNumber => setCurrentPage(pageNumber);
-
-
-
-
-
-
-
- const handleApprove = async (id) => {
- let status = window.confirm("Do you want to Approve");
- if (!status) return;
- // console.log(email)
- try {
- let res = await axios.get(`/api/admin/requirement/approve/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- console.log(res.data)
- getRequirement()
- if (res.data.success == true) {
- swal("success!", "Requirement Approved !", "success");
-
- }
- } catch (error) {
-
- swal("Error:!", console.log(error), "error");
- }
-
- };
-
-
-
-
- return (
-
-
-
- {/* */}
-
-
-
-
CMP-Requirements
-
- {/*
-
- -
- CMD-App
-
- - CMD-Category
-
-
*/}
-
-
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
- Title |
- Image |
- Area Of Interest |
- Added By |
- Added On |
- Action |
-
-
-
- {currentPosts && currentPosts.map((item, index) =>
-
- )}
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
-
- );
-}
-
-export default Requirement;
diff --git a/src/views/Requirement/RequirementOpt.js b/src/views/Requirement/RequirementOpt.js
deleted file mode 100644
index 6552bdd..0000000
--- a/src/views/Requirement/RequirementOpt.js
+++ /dev/null
@@ -1,133 +0,0 @@
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import { Link } from "react-router-dom";
-import swal from 'sweetalert';
-import { isAutheticated } from "../../auth";
-
-
-const RequirementOpt = ({ item, handleApprove }) => {
- const [user, setUser] = useState()
- const [approve, setApprove] = useState(false)
- const token = isAutheticated();
-
- useEffect(async () => {
- let resp = await axios.get(
- `/api/v1/admin/user/${item.addedBy}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
-
- setUser(resp.data.user)
-
- ///approved
- const getData = async () => {
- try {
- const response = await axios.get(`/api/requirement/getOne/${item._id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- })
- // console.log(response.data)
- if (response.data.Requirement.approved === true) {
- setApprove(true)
- } else {
- setApprove(false)
- }
- } catch (e) {
-
- setApprove(false)
- }
- }
- getData()
- }, [item]);
-
-
-
- const handleDelete = async (id) => {
- let status = window.confirm("Do you want to delete");
- if (!status) return;
-
- let res = await axios.delete(`/api/requirement/delete/${id}`, {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- });
- // console.log(res)
- if (res.data.success == true) {
- swal("success!", "Requirement Deleted Successfully!", "success");
- window.location.reload();
- }
- };
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
- return (
- <>
-
- {item?.title} |
-
-
- |
- {item?.areaOfInterest} |
- {user && {user?.name} | }
-
- {/* {item?.addedOn} */}
- {new Date(`${item?.createdAt}`).toDateString()} , {`${formatAMPM(item?.createdAt)}`}
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- >
- )
-}
-
-export default RequirementOpt
\ No newline at end of file
diff --git a/src/views/Requirement/ViewRequirement.js b/src/views/Requirement/ViewRequirement.js
deleted file mode 100644
index c64a9fd..0000000
--- a/src/views/Requirement/ViewRequirement.js
+++ /dev/null
@@ -1,142 +0,0 @@
-
-import axios from "axios";
-import React, { useEffect, useState, useCallback, useMemo } from "react";
-import swal from 'sweetalert';
-// import { API } from "../../data";
-import { Link, useParams } from "react-router-dom";
-import { isAutheticated } from "../../auth";
-
-function ViewRequirement() {
- const [requirement, setRequirement] = useState([])
- const [allImage, setAllImage] = useState([])
- const { id } = useParams();
- // console.log(id)
- const token = isAutheticated();
-
- const getUserDetails = useCallback(async () => {
-
-
- let resp = await axios.get(
- `/api/requirement/getOne/${id}`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- // console.log(resp.data.Requirement.image)
- setRequirement(resp.data.Requirement)
- setAllImage(resp.data.Requirement.image)
-
-
- }, [token]);
-
- useEffect(() => {
- getUserDetails();
- }, [getUserDetails]);
-
-
- // allImage.map(item => {
- // console.log(item.url)
- // })
-
-
- //change time formate
- function formatAMPM(date) {
- var hours = new Date(date).getHours();
- var minutes = new Date(date).getMinutes();
- var ampm = hours >= 12 ? 'PM' : 'AM';
- hours = hours % 12;
- hours = hours ? hours : 12; // the hour '0' should be '12'
- minutes = minutes < 10 ? '0' + minutes : minutes;
- var strTime = hours + ':' + minutes + ' ' + ampm;
- return strTime;
- }
-
-
- return (
-
-
-
- {/* */}
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
- User_Id |
-
- {requirement?._id} |
-
-
-
- Title |
- {requirement?.title} |
-
- Area Of Interest |
- {requirement?.areaOfInterest} |
-
- {/* Image |
-
-
-
-
- |
-
-
*/}
-
-
- {/* Description | */}
-
-
- Description |
- {requirement?.description} |
-
- Added On |
-
-
- {new Date(`${requirement?.createdAt}`).toDateString()} , {`${formatAMPM(requirement?.createdAt)}`}
- |
- Updated At |
-
- {new Date(`${requirement?.updatedAt}`).toDateString()} , {`${formatAMPM(requirement?.updatedAt)}`}
- |
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
-
-
-
- {/* */}
-
-
- );
-}
-
-export default ViewRequirement;
-
diff --git a/src/views/pages/login/Login.js b/src/views/pages/login/Login.js
index 2198ce1..6ea9d81 100644
--- a/src/views/pages/login/Login.js
+++ b/src/views/pages/login/Login.js
@@ -146,7 +146,7 @@ const Login = () => {
Login
- Sign In to Your CMP Dashboard Account.
+ Sign In to Your ATP Dashboard Account.
diff --git a/src/views/pages/register/ForgotPassword.js b/src/views/pages/register/ForgotPassword.js
index d9f306a..cb1e857 100644
--- a/src/views/pages/register/ForgotPassword.js
+++ b/src/views/pages/register/ForgotPassword.js
@@ -40,7 +40,7 @@ const ForgotPassword = () => {
}
} catch (e) {
- alert("Wrong Email ID. Enter valid email to get the password")
+ swal('Error!', 'Wrong Email ID. Enter valid email to get the password', 'error')
setLoading(false)
diff --git a/src/views/pages/page404/Page404.js b/src/views/pages/register/page404/Page404.js
similarity index 100%
rename from src/views/pages/page404/Page404.js
rename to src/views/pages/register/page404/Page404.js
diff --git a/src/views/widgets/WidgetsDropdown.js b/src/views/widgets/WidgetsDropdown.js
index 468f679..ba45361 100644
--- a/src/views/widgets/WidgetsDropdown.js
+++ b/src/views/widgets/WidgetsDropdown.js
@@ -26,81 +26,10 @@ const WidgetsDropdown = ({ users, category, requirement, news, offer, event }) =
>
}
title="Total Users"
- // action={
- //
- //
- //
- //
- //
- // Action
- // Another action
- // Something else here...
- // Disabled action
- //
- //
- // }
- // chart={
- //
- // }
+
/>
-
+ {/*
-
+ /> */}
+ {/* */}
)
}