Merge branch 'master' of http://128.199.30.231/possibillion/smellika-admin
This commit is contained in:
commit
2ed7c863b4
15
src/App.js
15
src/App.js
@ -47,10 +47,13 @@ const App = () => {
|
|||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// console.log(response.data)
|
// console.log("jjjjjjjj", response.data);
|
||||||
const data = response.data;
|
const data = response?.data;
|
||||||
if (data.success && data.user.role === "admin") {
|
if (
|
||||||
setUserData(data.user);
|
data?.success &&
|
||||||
|
(data?.user?.role === "admin" || data?.user?.role === "Employee")
|
||||||
|
) {
|
||||||
|
setUserData(data?.user);
|
||||||
} else {
|
} else {
|
||||||
setUserData(false);
|
setUserData(false);
|
||||||
}
|
}
|
||||||
@ -62,7 +65,6 @@ const App = () => {
|
|||||||
};
|
};
|
||||||
getUser();
|
getUser();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HashRouter>
|
<HashRouter>
|
||||||
<Suspense fallback={loading}>
|
<Suspense fallback={loading}>
|
||||||
@ -87,7 +89,8 @@ const App = () => {
|
|||||||
path="/"
|
path="/"
|
||||||
name="Home"
|
name="Home"
|
||||||
element={
|
element={
|
||||||
userdata?.role === "admin" ? (
|
userdata &&
|
||||||
|
(userdata.role === "admin" || userdata.role === "Employee") ? (
|
||||||
<DefaultLayout />
|
<DefaultLayout />
|
||||||
) : userdata === false ? (
|
) : userdata === false ? (
|
||||||
<Login />
|
<Login />
|
||||||
|
67
src/_nav.js
67
src/_nav.js
@ -34,54 +34,64 @@ const _nav = [
|
|||||||
name: "Dashboard",
|
name: "Dashboard",
|
||||||
to: "/dashboard",
|
to: "/dashboard",
|
||||||
icon: <CIcon icon={cilSpeedometer} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilSpeedometer} customClassName="nav-icon" />,
|
||||||
|
group: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Customers",
|
name: "Customers",
|
||||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||||
to: "/customers-details",
|
to: "/customers-details",
|
||||||
|
group: "Customers",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
component: CNavGroup,
|
component: CNavGroup,
|
||||||
name: "Charts",
|
name: "Charts",
|
||||||
icon: <CIcon icon={cilCat} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilCat} customClassName="nav-icon" />,
|
||||||
|
group: "",
|
||||||
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "new user day wise",
|
name: "new user day wise",
|
||||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||||
to: "/new-user-day-wise",
|
to: "/new-user-day-wise",
|
||||||
|
group: "Charts",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Revenue By Product",
|
name: "Revenue By Product",
|
||||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||||
to: "/revenue-by-product",
|
to: "/revenue-by-product",
|
||||||
|
group: "Charts",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Revenue By State",
|
name: "Revenue By State",
|
||||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||||
to: "/revenue-by-state",
|
to: "/revenue-by-state",
|
||||||
|
group: "Charts",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Revenue By City",
|
name: "Revenue By City",
|
||||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||||
to: "/revenue-by-city",
|
to: "/revenue-by-city",
|
||||||
|
group: "Charts",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Orders (Day Wise)",
|
name: "Orders (Day Wise)",
|
||||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||||
to: "/orders-day-wise",
|
to: "/orders-day-wise",
|
||||||
|
group: "Charts",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Revenue (Day Wise)",
|
name: "Revenue (Day Wise)",
|
||||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||||
to: "/revenue-day-wise",
|
to: "/revenue-day-wise",
|
||||||
|
group: "Charts",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -90,24 +100,29 @@ const _nav = [
|
|||||||
component: CNavGroup,
|
component: CNavGroup,
|
||||||
name: "Product Management",
|
name: "Product Management",
|
||||||
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
||||||
|
group: "",
|
||||||
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Categories",
|
name: "Categories",
|
||||||
icon: <CIcon icon={cilCat} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilCat} customClassName="nav-icon" />,
|
||||||
to: "/categories",
|
to: "/categories",
|
||||||
|
group: "Product Management",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Products",
|
name: "Products",
|
||||||
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
||||||
to: "/products",
|
to: "/products",
|
||||||
|
group: "Product Management",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "GST Rate",
|
name: "GST Rate",
|
||||||
icon: <CIcon icon={cilTablet} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilTablet} customClassName="nav-icon" />,
|
||||||
to: "/tax",
|
to: "/tax",
|
||||||
|
group: "Product Management",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -115,12 +130,15 @@ const _nav = [
|
|||||||
component: CNavGroup,
|
component: CNavGroup,
|
||||||
name: "Orders",
|
name: "Orders",
|
||||||
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
||||||
|
group: "",
|
||||||
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "New",
|
name: "New",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/orders/new",
|
to: "/orders/new",
|
||||||
|
group: "Orders",
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// component: CNavItem,
|
// component: CNavItem,
|
||||||
@ -133,36 +151,42 @@ const _nav = [
|
|||||||
name: "Processing",
|
name: "Processing",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/orders/processing",
|
to: "/orders/processing",
|
||||||
|
group: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Dispatched",
|
name: "Dispatched",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/orders/dispatched",
|
to: "/orders/dispatched",
|
||||||
|
group: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Delivered",
|
name: "Delivered",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/orders/delivered",
|
to: "/orders/delivered",
|
||||||
|
group: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Cancelled",
|
name: "Cancelled",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/orders/cancelled",
|
to: "/orders/cancelled",
|
||||||
|
group: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "In Store Cash Orders",
|
name: "In Store Cash Orders",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/inStoreCashOrders/new",
|
to: "/inStoreCashOrders/new",
|
||||||
|
group: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "In Store QRCode Orders",
|
name: "In Store QRCode Orders",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/InStoreQRCodeOrders/new",
|
to: "/InStoreQRCodeOrders/new",
|
||||||
|
group: "Orders",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -170,49 +194,58 @@ const _nav = [
|
|||||||
component: CNavGroup,
|
component: CNavGroup,
|
||||||
name: "Website Related",
|
name: "Website Related",
|
||||||
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
||||||
|
group: "",
|
||||||
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Banner",
|
name: "Banner",
|
||||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||||
to: "/banner",
|
to: "/banner",
|
||||||
|
group: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Register Image",
|
name: "Register Image",
|
||||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||||
to: "/registerImage",
|
to: "/registerImage",
|
||||||
|
group: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Login Image",
|
name: "Login Image",
|
||||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||||
to: "/loginImage",
|
to: "/loginImage",
|
||||||
|
group: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Shop Page Image",
|
name: "Shop Page Image",
|
||||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||||
to: "/shopImage",
|
to: "/shopImage",
|
||||||
|
group: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Testimonials",
|
name: "Testimonials",
|
||||||
icon: <CIcon icon={cilCompress} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilCompress} customClassName="nav-icon" />,
|
||||||
to: "/testimonials",
|
to: "/testimonials",
|
||||||
|
group: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
component: CNavItem,
|
// component: CNavItem,
|
||||||
name: "Contact Requests",
|
// name: "Contact Requests",
|
||||||
icon: <CIcon icon={cilContact} customClassName="nav-icon" />,
|
// icon: <CIcon icon={cilContact} customClassName="nav-icon" />,
|
||||||
to: "/contact/request",
|
// to: "/contact/request",
|
||||||
},
|
// group: "Website Related",
|
||||||
|
// },
|
||||||
|
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "SEO and Analytics",
|
name: "SEO and Analytics",
|
||||||
icon: <CIcon icon={cilContact} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilContact} customClassName="nav-icon" />,
|
||||||
to: "/seo/request/new",
|
to: "/seo/request/new",
|
||||||
|
group: "Website Related",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -220,12 +253,14 @@ const _nav = [
|
|||||||
name: "Content ",
|
name: "Content ",
|
||||||
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
||||||
to: "/content",
|
to: "/content",
|
||||||
|
group: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Home",
|
name: "Home",
|
||||||
icon: <CIcon icon={cilFeaturedPlaylist} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilFeaturedPlaylist} customClassName="nav-icon" />,
|
||||||
to: "/home",
|
to: "/home",
|
||||||
|
group: "Website Related",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -233,18 +268,22 @@ const _nav = [
|
|||||||
component: CNavGroup,
|
component: CNavGroup,
|
||||||
name: "Configuration",
|
name: "Configuration",
|
||||||
icon: <CIcon icon={cilAppsSettings} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilAppsSettings} customClassName="nav-icon" />,
|
||||||
|
group: "",
|
||||||
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Social Media",
|
name: "Social Media",
|
||||||
icon: <CIcon icon={cilMedicalCross} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilMedicalCross} customClassName="nav-icon" />,
|
||||||
to: "/socialmedia",
|
to: "/socialmedia",
|
||||||
|
group: "Configuration",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Application Name",
|
name: "Application Name",
|
||||||
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
||||||
to: "/application/name",
|
to: "/application/name",
|
||||||
|
group: "Configuration",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -252,18 +291,21 @@ const _nav = [
|
|||||||
name: "Address",
|
name: "Address",
|
||||||
icon: <CIcon icon={cilAddressBook} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilAddressBook} customClassName="nav-icon" />,
|
||||||
to: "/address",
|
to: "/address",
|
||||||
|
group: "Configuration",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Logos",
|
name: "Logos",
|
||||||
icon: <CIcon icon={cilCommand} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilCommand} customClassName="nav-icon" />,
|
||||||
to: "/logo",
|
to: "/logo",
|
||||||
|
group: "Configuration",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Copyright Message",
|
name: "Copyright Message",
|
||||||
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
||||||
to: "/copyright/message",
|
to: "/copyright/message",
|
||||||
|
group: "Configuration",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -272,18 +314,22 @@ const _nav = [
|
|||||||
component: CNavGroup,
|
component: CNavGroup,
|
||||||
name: "Affiliate & Coupons",
|
name: "Affiliate & Coupons",
|
||||||
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
||||||
|
group: "",
|
||||||
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Coupons",
|
name: "Coupons",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/affiliate/coupons",
|
to: "/affiliate/coupons",
|
||||||
|
group: "Affiliate & Coupons",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Affiliates",
|
name: "Affiliates",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/affiliate/affiliates",
|
to: "/affiliate/affiliates",
|
||||||
|
group: "Affiliate & Coupons",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -292,18 +338,22 @@ const _nav = [
|
|||||||
component: CNavGroup,
|
component: CNavGroup,
|
||||||
name: "Customer Service",
|
name: "Customer Service",
|
||||||
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
||||||
|
group: "",
|
||||||
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Customer Support",
|
name: "Customer Support",
|
||||||
icon: <CIcon icon={cilAlarm} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilAlarm} customClassName="nav-icon" />,
|
||||||
to: "/support/request",
|
to: "/support/request",
|
||||||
|
group: "Customer Service",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: "Contact Requests",
|
name: "Contact Requests",
|
||||||
icon: <CIcon icon={cilUser} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilUser} customClassName="nav-icon" />,
|
||||||
to: "/contact/request",
|
to: "/contact/request",
|
||||||
|
group: "Customer Service",
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// component: CNavItem,
|
// component: CNavItem,
|
||||||
@ -319,13 +369,15 @@ const _nav = [
|
|||||||
name: "Blog",
|
name: "Blog",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/blogs",
|
to: "/blogs",
|
||||||
|
group: "Blog",
|
||||||
},
|
},
|
||||||
// Employee
|
// Employee
|
||||||
{
|
{
|
||||||
component: CNavItem,
|
component: CNavItem,
|
||||||
name: " Employees & Access",
|
name: "Employees & Access",
|
||||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||||
to: "/employee",
|
to: "/employee",
|
||||||
|
group: "Employees & Access",
|
||||||
},
|
},
|
||||||
//Point of Sale start
|
//Point of Sale start
|
||||||
{
|
{
|
||||||
@ -333,6 +385,7 @@ const _nav = [
|
|||||||
name: "Point of Sale",
|
name: "Point of Sale",
|
||||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||||
to: "/pos",
|
to: "/pos",
|
||||||
|
group: "Point of Sale",
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// component: CNavGroup,
|
// component: CNavGroup,
|
||||||
|
@ -1,28 +1,68 @@
|
|||||||
import React, { Suspense, useState } from "react";
|
import React, { Suspense, useEffect, useState } from "react";
|
||||||
import { Navigate, Route, Routes } from "react-router-dom";
|
import { Navigate, Route, Routes } from "react-router-dom";
|
||||||
import { CContainer, CSpinner } from "@coreui/react";
|
import { CContainer, CSpinner } from "@coreui/react";
|
||||||
|
|
||||||
// routes config
|
// routes config
|
||||||
import routes from "../routes";
|
import routes from "../routes";
|
||||||
|
import { isAutheticated } from "src/auth";
|
||||||
|
import axios from "axios";
|
||||||
|
import toast from "react-hot-toast";
|
||||||
const AppContent = () => {
|
const AppContent = () => {
|
||||||
|
const [userper, setuserper] = useState(null);
|
||||||
|
const token = isAutheticated();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const getUser = async () => {
|
||||||
|
let existanceData = localStorage.getItem("authToken");
|
||||||
|
if (!existanceData) {
|
||||||
|
setuserper(null);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
let response = await axios.get(`/api/v1/user/details`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const data = response?.data;
|
||||||
|
if (
|
||||||
|
data?.success &&
|
||||||
|
(data?.user?.role === "admin" || data?.user?.role === "Employee")
|
||||||
|
) {
|
||||||
|
setuserper(data?.user);
|
||||||
|
} else {
|
||||||
|
setuserper(null);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
setuserper(null);
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
getUser();
|
||||||
|
}, []);
|
||||||
const [appRoutes, setAppRoutes] = useState(routes);
|
const [appRoutes, setAppRoutes] = useState(routes);
|
||||||
return (
|
return (
|
||||||
<CContainer lg>
|
<CContainer lg>
|
||||||
<Suspense fallback={<CSpinner color="primary" />}>
|
<Suspense fallback={<CSpinner color="primary" />}>
|
||||||
<Routes>
|
<Routes>
|
||||||
{appRoutes.map((route, idx) => {
|
{appRoutes.map((route, idx) => {
|
||||||
return (
|
if (
|
||||||
route.element && (
|
userper?.role === "admin" ||
|
||||||
<Route
|
route.navName?.trim() === "" ||
|
||||||
key={idx}
|
(userper?.accessTo && userper?.accessTo[route?.navName] === true)
|
||||||
path={route.path}
|
) {
|
||||||
exact={route.exact}
|
return (
|
||||||
name={route.name}
|
route.element && (
|
||||||
element={<route.element />}
|
<Route
|
||||||
/>
|
key={idx}
|
||||||
)
|
path={route.path}
|
||||||
);
|
exact={route.exact}
|
||||||
|
name={route.name}
|
||||||
|
element={<route.element />}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
})}
|
})}
|
||||||
<Route path="/" element={<Navigate to="dashboard" replace />} />
|
<Route path="/" element={<Navigate to="dashboard" replace />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
import React from 'react'
|
import React from "react";
|
||||||
import { AppContent, AppSidebar, AppFooter, AppHeader } from '../components/index'
|
import {
|
||||||
|
AppContent,
|
||||||
|
AppSidebar,
|
||||||
|
AppFooter,
|
||||||
|
AppHeader,
|
||||||
|
} from "../components/index";
|
||||||
|
|
||||||
const DefaultLayout = () => {
|
const DefaultLayout = () => {
|
||||||
return (
|
return (
|
||||||
@ -13,7 +18,7 @@ const DefaultLayout = () => {
|
|||||||
<AppFooter />
|
<AppFooter />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default DefaultLayout
|
export default DefaultLayout;
|
||||||
|
599
src/routes.js
599
src/routes.js
@ -148,59 +148,157 @@ import AddEmployee from "./views/EmployeeAccess/addEmployee";
|
|||||||
import EditEmployee from "./views/EmployeeAccess/editEmployee";
|
import EditEmployee from "./views/EmployeeAccess/editEmployee";
|
||||||
import ExportToExcel from "./views/exportExcel";
|
import ExportToExcel from "./views/exportExcel";
|
||||||
const routes = [
|
const routes = [
|
||||||
{ path: "/", exact: true, name: "Home" },
|
// { path: "/", exact: true, name: "Home", navName: "" },
|
||||||
|
//dashboard
|
||||||
|
|
||||||
|
{ path: "/dashboard", name: "Dashboard", element: Dashboard, navName: "" },
|
||||||
{
|
{
|
||||||
path: "/change_password",
|
path: "/change_password",
|
||||||
name: "Change Password",
|
name: "Change Password",
|
||||||
element: Change_Password,
|
element: Change_Password,
|
||||||
|
navName: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/profile/edit",
|
||||||
|
name: "Edit Profile",
|
||||||
|
element: EditProfile,
|
||||||
|
navName: "",
|
||||||
},
|
},
|
||||||
{ path: "/profile/edit", name: "Edit Profile", element: EditProfile },
|
|
||||||
// { path: '/profile', name: 'Profile', element: Profile },
|
// { path: '/profile', name: 'Profile', element: Profile },
|
||||||
|
//------------------Charts Routes------------------------------------
|
||||||
|
{
|
||||||
|
path: "/new-user-day-wise",
|
||||||
|
name: "new user day wise",
|
||||||
|
element: UserCharts,
|
||||||
|
navName: "Charts",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/revenue-by-product",
|
||||||
|
name: "Revenue By Product",
|
||||||
|
element: ProductrevenueCharts,
|
||||||
|
navName: "Charts",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/revenue-by-state",
|
||||||
|
name: "Revenue By State",
|
||||||
|
element: StateRevenueCharts,
|
||||||
|
navName: "Charts",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/revenue-by-city",
|
||||||
|
name: "Revenue By City",
|
||||||
|
element: CityRevenueCharts,
|
||||||
|
navName: "Charts",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/orders-day-wise",
|
||||||
|
name: "Orders (Day Wise)",
|
||||||
|
element: OrderdayChart,
|
||||||
|
navName: "Charts",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/revenue-day-wise",
|
||||||
|
name: "Revenue (Day Wise)",
|
||||||
|
element: RevenueCharts,
|
||||||
|
navName: "Charts",
|
||||||
|
},
|
||||||
|
//------------------ End Charts Routes------------------------------------
|
||||||
|
//-----------------------Product Management Routes------------------------------------------------
|
||||||
|
{
|
||||||
|
path: "/products",
|
||||||
|
name: "products",
|
||||||
|
element: Products,
|
||||||
|
navName: "Product Management",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/product/add",
|
||||||
|
name: "Add products",
|
||||||
|
element: AddProduct,
|
||||||
|
navName: "Product Management",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/product/edit/:id",
|
||||||
|
name: "Edit products",
|
||||||
|
element: EditProduct,
|
||||||
|
navName: "Product Management",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/product/view/:id",
|
||||||
|
name: "view products",
|
||||||
|
element: ViewProduct,
|
||||||
|
navName: "Product Management",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/categories",
|
||||||
|
name: "Categories",
|
||||||
|
element: Categories,
|
||||||
|
navName: "Product Management",
|
||||||
|
},
|
||||||
|
//Gst tax
|
||||||
|
{
|
||||||
|
path: "/tax",
|
||||||
|
name: "Tax Rates",
|
||||||
|
element: Tax,
|
||||||
|
navName: "Product Management",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/tax/add",
|
||||||
|
name: "Add Tax",
|
||||||
|
element: Addtax,
|
||||||
|
navName: "Product Management",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/tax/edit/:id",
|
||||||
|
name: "Edit Tax",
|
||||||
|
element: Edittax,
|
||||||
|
navName: "Product Management",
|
||||||
|
},
|
||||||
|
//----------------------- End Product Management Routes------------------------------------------------
|
||||||
|
|
||||||
//Product
|
|
||||||
{ path: "/products", name: "products", element: Products },
|
|
||||||
{ path: "/product/add", name: "Add products", element: AddProduct },
|
|
||||||
{ path: "/product/edit/:id", name: "Edit products", element: EditProduct },
|
|
||||||
{ path: "/product/view/:id", name: "view products", element: ViewProduct },
|
|
||||||
//Departure
|
//Departure
|
||||||
{ path: "/departures", name: "Departures", element: Departures },
|
// { path: "/departures", name: "Departures", element: Departures },
|
||||||
{ path: "/departure/add", name: "Add Departure", element: AddDeparture },
|
// { path: "/departure/add", name: "Add Departure", element: AddDeparture },
|
||||||
{ path: "/product/edit/:id", name: "Edit products", element: EditProduct },
|
// { path: "/product/edit/:id", name: "Edit products", element: EditProduct },
|
||||||
{ path: "/product/view/:id", name: "view products", element: ViewProduct },
|
// { path: "/product/view/:id", name: "view products", element: ViewProduct },
|
||||||
|
|
||||||
// Appointments
|
// Appointments
|
||||||
{ path: "/appointments", name: "Appointments", element: Appointments },
|
// { path: "/appointments", name: "Appointments", element: Appointments },
|
||||||
{
|
// {
|
||||||
path: "/appointment/view/:id",
|
// path: "/appointment/view/:id",
|
||||||
name: "View Appointment",
|
// name: "View Appointment",
|
||||||
element: ViewAppointment,
|
// element: ViewAppointment,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "/appointment/edit/:id",
|
// path: "/appointment/edit/:id",
|
||||||
name: "Edit Appointment",
|
// name: "Edit Appointment",
|
||||||
element: EditAppointment,
|
// element: EditAppointment,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "/appointment/new",
|
// path: "/appointment/new",
|
||||||
name: "Add Appointment",
|
// name: "Add Appointment",
|
||||||
element: AddNewAppointment,
|
// element: AddNewAppointment,
|
||||||
},
|
// },
|
||||||
|
//------------------customers Route-------------------------
|
||||||
{
|
{
|
||||||
path: "/customers-details",
|
path: "/customers-details",
|
||||||
name: "Customers",
|
name: "Customers",
|
||||||
element: CustomerTable,
|
element: CustomerTable,
|
||||||
|
navName: "Customers",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/customers-details/:_id",
|
path: "/customers-details/:_id",
|
||||||
name: "Customers",
|
name: "Customers",
|
||||||
element: SingleUserAllDetails,
|
element: SingleUserAllDetails,
|
||||||
|
navName: "Customers",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/add-customer",
|
path: "/add-customer",
|
||||||
name: "Customers",
|
name: "Customers",
|
||||||
element: AddCustomer,
|
element: AddCustomer,
|
||||||
|
navName: "Customers",
|
||||||
},
|
},
|
||||||
|
//------------------ End customers Route-------------------------
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// path: "/users-address/add",
|
// path: "/users-address/add",
|
||||||
// name: "User Address",
|
// name: "User Address",
|
||||||
@ -239,27 +337,23 @@ const routes = [
|
|||||||
// element: ViewHealthCareProvider,
|
// element: ViewHealthCareProvider,
|
||||||
// },
|
// },
|
||||||
// Categories
|
// Categories
|
||||||
{
|
|
||||||
path: "/categories",
|
|
||||||
name: "Categories",
|
|
||||||
element: Categories,
|
|
||||||
},
|
|
||||||
// Design
|
// Design
|
||||||
{
|
// {
|
||||||
path: "/design",
|
// path: "/design",
|
||||||
name: "Design",
|
// name: "Design",
|
||||||
element: Design,
|
// element: Design,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "//campaigns",
|
// path: "/campaigns",
|
||||||
name: "campaigns",
|
// name: "campaigns",
|
||||||
element: Campaign,
|
// element: Campaign,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "//campaign/add",
|
// path: "/campaign/add",
|
||||||
name: "Add Campaigns",
|
// name: "Add Campaigns",
|
||||||
element: AddCampaign,
|
// element: AddCampaign,
|
||||||
},
|
// },
|
||||||
// {
|
// {
|
||||||
// path: "/campaigns/edit/:id",
|
// path: "/campaigns/edit/:id",
|
||||||
// name: "Edit healthcare providers",
|
// name: "Edit healthcare providers",
|
||||||
@ -273,384 +367,451 @@ const routes = [
|
|||||||
|
|
||||||
// { path: '/franchisee/view/:id', name: 'view franchisee', element: ViewFra },
|
// { path: '/franchisee/view/:id', name: 'view franchisee', element: ViewFra },
|
||||||
//Contact Requests
|
//Contact Requests
|
||||||
|
// ----------------Customer Service Routes-------------------------------
|
||||||
{
|
{
|
||||||
path: "/contact/request",
|
path: "/contact/request",
|
||||||
name: "Customer Service",
|
name: "Customer Service",
|
||||||
element: ContactRequests,
|
element: ContactRequests,
|
||||||
|
navName: "Customer Service",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/contact/request/new",
|
path: "/contact/request/new",
|
||||||
name: "Customer Service",
|
name: "Customer Service",
|
||||||
element: AddContactRequest,
|
element: AddContactRequest,
|
||||||
|
navName: "Customer Service",
|
||||||
},
|
},
|
||||||
//Support Requests
|
//Support Requests
|
||||||
// {
|
{
|
||||||
// path: "/email-cms",
|
path: "/email-cms",
|
||||||
// name: "CustomerSupport Requests",
|
name: "CustomerSupport Requests",
|
||||||
// element: EmailCms,
|
element: EmailCms,
|
||||||
// },
|
navName: "Customer Service",
|
||||||
// {
|
},
|
||||||
// path: "/email-cms/registration-email",
|
{
|
||||||
// name: "CustomerSupport Requests",
|
path: "/email-cms/registration-email",
|
||||||
// element: RegistrationEmail,
|
name: "CustomerSupport Requests",
|
||||||
// },
|
element: RegistrationEmail,
|
||||||
|
navName: "Customer Service",
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: "/support/request",
|
path: "/support/request",
|
||||||
name: "Customer Service",
|
name: "Customer Service",
|
||||||
element: SupportRequest,
|
element: SupportRequest,
|
||||||
|
navName: "Customer Service",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/support/request/closed",
|
path: "/support/request/closed",
|
||||||
name: "Customer Service",
|
name: "Customer Service",
|
||||||
element: SupportRequestClosed,
|
element: SupportRequestClosed,
|
||||||
|
navName: "Customer Service",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/support/request/closed/:ticketID",
|
path: "/support/request/closed/:ticketID",
|
||||||
name: "Customer Service",
|
name: "Customer Service",
|
||||||
element: CloseRequestView,
|
element: CloseRequestView,
|
||||||
|
navName: "Customer Service",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/support/request/reply/:ticketID",
|
path: "/support/request/reply/:ticketID",
|
||||||
name: "Customer Service",
|
name: "Customer Service",
|
||||||
element: SupportReply,
|
element: SupportReply,
|
||||||
|
navName: "Customer Service",
|
||||||
},
|
},
|
||||||
// Content ---- >
|
// ---------------- End Customer Service Routes-------------------------------
|
||||||
|
|
||||||
{
|
|
||||||
path: "/content",
|
|
||||||
name: "Website Relatedt",
|
|
||||||
element: Content,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/content/terms-and-conditions",
|
|
||||||
name: "Website Related",
|
|
||||||
element: EditTermsConditions,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/content/privacy-policy",
|
|
||||||
name: "Website Related",
|
|
||||||
element: EditPrivacyPolicy,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/content/shipping-policy",
|
|
||||||
name: "Website Related",
|
|
||||||
element: EditShippingPolicy,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/content/refund-policy",
|
|
||||||
name: "Website Related",
|
|
||||||
element: EditRefundpolicy,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/content/about-us",
|
|
||||||
name: "Website Related",
|
|
||||||
element: EditAboutUs,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Home
|
|
||||||
{
|
|
||||||
path: "/home",
|
|
||||||
name: "Home",
|
|
||||||
element: Home,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/home/panel-1",
|
|
||||||
name: "EditPanel1",
|
|
||||||
element: EditPanel1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/home/panel-2",
|
|
||||||
name: "EditPanel2",
|
|
||||||
element: EditPanel2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/home/panel-3",
|
|
||||||
name: "EditPanel3",
|
|
||||||
element: EditPanel3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/home/panel-4",
|
|
||||||
name: "EditPanel4",
|
|
||||||
element: Editpanel4,
|
|
||||||
},
|
|
||||||
|
|
||||||
// { path: '/complaint/view/:id', name: 'view Complain', element: ViewComplaint },
|
// { path: '/complaint/view/:id', name: 'view Complain', element: ViewComplaint },
|
||||||
//Complaints
|
//Complaints
|
||||||
|
|
||||||
|
//-------------------------------website related routes----------------------------------
|
||||||
|
{
|
||||||
|
path: "/banner",
|
||||||
|
name: "Banners",
|
||||||
|
element: Banners,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/registerImage",
|
||||||
|
name: "RegisterImage",
|
||||||
|
element: RegisterImage,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/loginImage",
|
||||||
|
name: "LoginImage",
|
||||||
|
element: LoginImage,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/shopImage",
|
||||||
|
name: "ShopImage",
|
||||||
|
element: ShopImage,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/testimonials",
|
path: "/testimonials",
|
||||||
name: "Testimonials",
|
name: "Testimonials",
|
||||||
element: Testimonials,
|
element: Testimonials,
|
||||||
|
navName: "Website Related",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: "/testimonial/new",
|
path: "/testimonial/new",
|
||||||
name: "AddTestimonial",
|
name: "AddTestimonial",
|
||||||
element: AddTestimonial,
|
element: AddTestimonial,
|
||||||
|
navName: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/testimonial/view/:id",
|
path: "/testimonial/view/:id",
|
||||||
name: "ViewTestimonial",
|
name: "ViewTestimonial",
|
||||||
element: ViewTestimonial,
|
element: ViewTestimonial,
|
||||||
|
navName: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/testimonial/edit/:id",
|
path: "/testimonial/edit/:id",
|
||||||
name: "EditTestimonial",
|
name: "EditTestimonial",
|
||||||
element: EditTestimonial,
|
element: EditTestimonial,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
//seo
|
||||||
|
{
|
||||||
|
path: "/seo/request/new",
|
||||||
|
name: "seo Request",
|
||||||
|
element: AddSeoRequest,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
// Content ---- >
|
||||||
|
{
|
||||||
|
path: "/content",
|
||||||
|
name: "Website Related",
|
||||||
|
element: Content,
|
||||||
|
navName: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/banner",
|
path: "/content/terms-and-conditions",
|
||||||
name: "Banners",
|
name: "Website Related",
|
||||||
element: Banners,
|
element: EditTermsConditions,
|
||||||
|
navName: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/registerImage",
|
path: "/content/privacy-policy",
|
||||||
name: "RegisterImage",
|
name: "Website Related",
|
||||||
element: RegisterImage,
|
element: EditPrivacyPolicy,
|
||||||
|
navName: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/loginImage",
|
path: "/content/shipping-policy",
|
||||||
name: "LoginImage",
|
name: "Website Related",
|
||||||
element: LoginImage,
|
element: EditShippingPolicy,
|
||||||
|
navName: "Website Related",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/shopImage",
|
path: "/content/refund-policy",
|
||||||
name: "ShopImage",
|
name: "Website Related",
|
||||||
element: ShopImage,
|
element: EditRefundpolicy,
|
||||||
|
navName: "Website Related",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/content/about-us",
|
||||||
|
name: "Website Related",
|
||||||
|
element: EditAboutUs,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
// Home Pannel website
|
||||||
|
{
|
||||||
|
path: "/home",
|
||||||
|
name: "Home",
|
||||||
|
element: Home,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/home/panel-1",
|
||||||
|
name: "EditPanel1",
|
||||||
|
element: EditPanel1,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/home/panel-2",
|
||||||
|
name: "EditPanel2",
|
||||||
|
element: EditPanel2,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/home/panel-3",
|
||||||
|
name: "EditPanel3",
|
||||||
|
element: EditPanel3,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/home/panel-4",
|
||||||
|
name: "EditPanel4",
|
||||||
|
element: Editpanel4,
|
||||||
|
navName: "Website Related",
|
||||||
|
},
|
||||||
|
//-------------------------------End website related routes----------------------------------
|
||||||
|
|
||||||
//informations
|
//informations
|
||||||
{ path: "/informations", name: "Informations", element: Informations },
|
// { path: "/informations", name: "Informations", element: Informations },
|
||||||
|
// {
|
||||||
|
// path: "/information/new",
|
||||||
|
// name: "Add Informations",
|
||||||
|
// element: AddInformations,
|
||||||
|
// },
|
||||||
|
|
||||||
|
//--------------Order Management Routes---------------------------------------
|
||||||
{
|
{
|
||||||
path: "/information/new",
|
path: "/orders/new",
|
||||||
name: "Add Informations",
|
name: "New Orders",
|
||||||
element: AddInformations,
|
element: NewOrders,
|
||||||
|
navName: "Orders",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/order/add",
|
||||||
|
name: "add Order",
|
||||||
|
element: AddOrder,
|
||||||
|
navName: "Orders",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/orders/edit/:id",
|
||||||
|
name: "Edit Order",
|
||||||
|
element: EditOrder,
|
||||||
|
navName: "Orders",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/orders/:status/:id",
|
||||||
|
name: "View Order",
|
||||||
|
element: ViewOrders,
|
||||||
|
navName: "Orders",
|
||||||
},
|
},
|
||||||
|
|
||||||
//Order Management
|
|
||||||
|
|
||||||
{ path: "/orders/new", name: "New Orders", element: NewOrders },
|
|
||||||
{ path: "/order/add", name: "add Order", element: AddOrder },
|
|
||||||
{ path: "/orders/edit/:id", name: "Edit Order", element: EditOrder },
|
|
||||||
{ path: "/orders/:status/:id", name: "View Order", element: ViewOrders },
|
|
||||||
|
|
||||||
{
|
{
|
||||||
path: "/orders/processing",
|
path: "/orders/processing",
|
||||||
name: "Processing Orders",
|
name: "Processing Orders",
|
||||||
element: ProcessingOrders,
|
element: ProcessingOrders,
|
||||||
|
navName: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/orders/dispatched",
|
path: "/orders/dispatched",
|
||||||
name: "Dispatched Orders",
|
name: "Dispatched Orders",
|
||||||
element: DispatchedOrders,
|
element: DispatchedOrders,
|
||||||
|
navName: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/orders/delivered",
|
path: "/orders/delivered",
|
||||||
name: "Delivered Orders",
|
name: "Delivered Orders",
|
||||||
element: DeliveredOrders,
|
element: DeliveredOrders,
|
||||||
|
navName: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/orders/cancelled",
|
path: "/orders/cancelled",
|
||||||
name: "Cancelled Orders",
|
name: "Cancelled Orders",
|
||||||
element: CancelledOrders,
|
element: CancelledOrders,
|
||||||
|
navName: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/orders/returned",
|
path: "/orders/returned",
|
||||||
name: "Returned Orders",
|
name: "Returned Orders",
|
||||||
element: ReturnedOrders,
|
element: ReturnedOrders,
|
||||||
|
navName: "Orders",
|
||||||
},
|
},
|
||||||
//Point of sale orders
|
|
||||||
{
|
{
|
||||||
path: "/inStoreCashOrders/new",
|
path: "/inStoreCashOrders/new",
|
||||||
name: "In Store Cash Orders",
|
name: "In Store Cash Orders",
|
||||||
element: InStoreCashOrders,
|
element: InStoreCashOrders,
|
||||||
|
navName: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/InStoreQRCodeOrders/new",
|
path: "/InStoreQRCodeOrders/new",
|
||||||
name: "In Store QR Code Orders",
|
name: "In Store QR Code Orders",
|
||||||
element: InStoreQRCodeOrders,
|
element: InStoreQRCodeOrders,
|
||||||
|
navName: "Orders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/inStoreOrders/:status/:id",
|
path: "/inStoreOrders/:status/:id",
|
||||||
name: "View In Store Cash Orders",
|
name: "View In Store Cash Orders",
|
||||||
element: POSViewOrders,
|
element: POSViewOrders,
|
||||||
|
navName: "Orders",
|
||||||
},
|
},
|
||||||
|
//-------------- End Order Management Routes---------------------------------------
|
||||||
|
|
||||||
|
//----------Point of sale orders Routes-----------------------
|
||||||
|
|
||||||
// { path: "/order/:status/:id", name: "View Order", element: ViewOdr },
|
// { path: "/order/:status/:id", name: "View Order", element: ViewOdr },
|
||||||
|
|
||||||
//dashboard
|
|
||||||
|
|
||||||
{ path: "/dashboard", name: "Dashboard", element: Dashboard },
|
|
||||||
|
|
||||||
//------------settings------------------------//
|
//------------settings------------------------//
|
||||||
|
|
||||||
{ path: "/policies", name: "Policies", element: Policies },
|
// { path: "/policies", name: "Policies", element: Policies },
|
||||||
|
|
||||||
{ path: "/socialmedia", name: "Social Media", element: Socialmedia },
|
// { path: "/purpose", name: "Purpose", element: Purpose },
|
||||||
{ path: "/purpose", name: "Purpose", element: Purpose },
|
// { path: "/purpose/add", name: "Add Purpose", element: AddPurpose },
|
||||||
{ path: "/purpose/add", name: "Add Purpose", element: AddPurpose },
|
// //languge
|
||||||
//languge
|
|
||||||
|
|
||||||
{ path: "/languages", name: "languages", element: Languages },
|
// { path: "/languages", name: "languages", element: Languages },
|
||||||
{ path: "/language/add", name: "Add languages", element: AddLanguage },
|
// { path: "/language/add", name: "Add languages", element: AddLanguage },
|
||||||
{ path: "/language/edit/:id", name: "Edit languages", element: EditLanguage },
|
// { path: "/language/edit/:id", name: "Edit languages", element: EditLanguage },
|
||||||
//business Type
|
//business Type
|
||||||
|
|
||||||
{ path: "/business_type", name: "business", element: BusinessType },
|
// { path: "/business_type", name: "business", element: BusinessType },
|
||||||
{
|
// {
|
||||||
path: "/business_type/add",
|
// path: "/business_type/add",
|
||||||
name: "Add business",
|
// name: "Add business",
|
||||||
element: AddBusinessType,
|
// element: AddBusinessType,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "/business_type/edit/:id",
|
// path: "/business_type/edit/:id",
|
||||||
name: "Edit business",
|
// name: "Edit business",
|
||||||
element: EditBusinessType,
|
// element: EditBusinessType,
|
||||||
},
|
// },
|
||||||
|
|
||||||
//purpose
|
//purpose
|
||||||
|
|
||||||
{ path: "/purpose", name: "purpose", element: Purpose },
|
// { path: "/purpose", name: "purpose", element: Purpose },
|
||||||
{ path: "/purpose/add", name: "Add purpose", element: AddPurpose },
|
// { path: "/purpose/add", name: "Add purpose", element: AddPurpose },
|
||||||
{ path: "/purpose/edit/:id", name: "Edit purpose", element: EditPurpose },
|
// { path: "/purpose/edit/:id", name: "Edit purpose", element: EditPurpose },
|
||||||
|
|
||||||
//languge
|
//languge
|
||||||
|
|
||||||
|
//-----------------Configuration Routes-----------------------------------
|
||||||
|
{
|
||||||
|
path: "/socialmedia",
|
||||||
|
name: "Social Media",
|
||||||
|
element: Socialmedia,
|
||||||
|
navName: "Configuration",
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: "/application/name",
|
path: "/application/name",
|
||||||
name: "ApplicationName",
|
name: "ApplicationName",
|
||||||
element: ApplicationName,
|
element: ApplicationName,
|
||||||
|
navName: "Configuration",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/copyright/message",
|
path: "/copyright/message",
|
||||||
name: "Copyright Message",
|
name: "Copyright Message",
|
||||||
element: CopyrightMessage,
|
element: CopyrightMessage,
|
||||||
|
navName: "Configuration",
|
||||||
},
|
},
|
||||||
|
|
||||||
{ path: "/address", name: "Address", element: Address },
|
|
||||||
{ path: "/logo", name: "Logo", element: Logo },
|
|
||||||
|
|
||||||
//Taxes
|
|
||||||
{ path: "/tax", name: "Tax Rates", element: Tax },
|
|
||||||
{ path: "/tax/add", name: "Add Tax", element: Addtax },
|
|
||||||
{ path: "/tax/edit/:id", name: "Edit Tax", element: Edittax },
|
|
||||||
// -------------------------------------------//
|
|
||||||
|
|
||||||
{
|
{
|
||||||
path: "/seo/request/new",
|
path: "/address",
|
||||||
name: "seo Request",
|
name: "Address",
|
||||||
element: AddSeoRequest,
|
element: Address,
|
||||||
|
navName: "Configuration",
|
||||||
|
},
|
||||||
|
{ path: "/logo", name: "Logo", element: Logo, navName: "Configuration" },
|
||||||
|
//----------------- End Configuration Routes-----------------------------------
|
||||||
|
|
||||||
|
//-----------------Affiliate & Coupons Routes-----------------------------------
|
||||||
|
{
|
||||||
|
path: "/affiliate/coupons",
|
||||||
|
name: "Coupon",
|
||||||
|
element: Coupons,
|
||||||
|
navName: "Affiliate & Coupons",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/affiliate/affiliates",
|
||||||
|
name: "Affiliate",
|
||||||
|
element: Affiliates,
|
||||||
|
navName: "Affiliate & Coupons",
|
||||||
},
|
},
|
||||||
//
|
|
||||||
//Affiliate Dashboard
|
|
||||||
{ path: "/affiliate/coupons", name: "Coupon", element: Coupons },
|
|
||||||
{ path: "/affiliate/affiliates", name: "Affiliate", element: Affiliates },
|
|
||||||
{
|
{
|
||||||
path: "/affiliate/coupons/create",
|
path: "/affiliate/coupons/create",
|
||||||
name: "Create Coupon",
|
name: "Create Coupon",
|
||||||
element: CreateCoupon,
|
element: CreateCoupon,
|
||||||
|
navName: "Affiliate & Coupons",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/affiliate/affiliates/create",
|
path: "/affiliate/affiliates/create",
|
||||||
name: "Create Affiliate",
|
name: "Create Affiliate",
|
||||||
element: CreateAffiliate,
|
element: CreateAffiliate,
|
||||||
|
navName: "Affiliate & Coupons",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/affiliate/affiliates/edit/:id",
|
path: "/affiliate/affiliates/edit/:id",
|
||||||
name: "Edit Affiliate",
|
name: "Edit Affiliate",
|
||||||
element: EditAffiliate,
|
element: EditAffiliate,
|
||||||
|
navName: "Affiliate & Coupons",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/affiliate/affiliates/pay/:id",
|
path: "/affiliate/affiliates/pay/:id",
|
||||||
name: "Pay Affiliate",
|
name: "Pay Affiliate",
|
||||||
element: PayAffiliate,
|
element: PayAffiliate,
|
||||||
|
navName: "Affiliate & Coupons",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/affiliate/affiliates/history/:id",
|
path: "/affiliate/affiliates/history/:id",
|
||||||
name: "Pay Affiliate",
|
name: "Pay Affiliate",
|
||||||
element: AffiliateHistory,
|
element: AffiliateHistory,
|
||||||
|
navName: "Affiliate & Coupons",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/affiliate/coupons/edit/:id",
|
path: "/affiliate/coupons/edit/:id",
|
||||||
name: "Edit Coupon",
|
name: "Edit Coupon",
|
||||||
element: EditCoupon,
|
element: EditCoupon,
|
||||||
|
navName: "Affiliate & Coupons",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/affiliate/coupons/history/:id",
|
path: "/affiliate/coupons/history/:id",
|
||||||
name: "Edit Coupon",
|
name: "Edit Coupon",
|
||||||
element: CouponHistory,
|
element: CouponHistory,
|
||||||
|
navName: "Affiliate & Coupons",
|
||||||
},
|
},
|
||||||
//Blogs Section
|
//----------------- End Affiliate & Coupons Routes-----------------------------------
|
||||||
|
|
||||||
|
//---------- Blog Routes---------------------------------
|
||||||
{
|
{
|
||||||
path: "/blogs",
|
path: "/blogs",
|
||||||
name: "Blogs",
|
name: "Blogs",
|
||||||
element: Blogs,
|
element: Blogs,
|
||||||
|
navName: "Blog",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/blogs/create",
|
path: "/blogs/create",
|
||||||
name: "Blogs",
|
name: "Blogs",
|
||||||
element: CreateBlog,
|
element: CreateBlog,
|
||||||
|
navName: "Blog",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/blog/edit/:id",
|
path: "/blog/edit/:id",
|
||||||
name: "Blogs",
|
name: "Blogs",
|
||||||
element: UpdateBlog,
|
element: UpdateBlog,
|
||||||
|
navName: "Blog",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/blog/view/:id",
|
path: "/blog/view/:id",
|
||||||
name: "Blogs",
|
name: "Blogs",
|
||||||
element: ViewBlog,
|
element: ViewBlog,
|
||||||
|
navName: "Blog",
|
||||||
},
|
},
|
||||||
// Employee
|
|
||||||
|
//----------End Blog Routes---------------------------------
|
||||||
|
// ------------------------Employee Routes-----------------------
|
||||||
{
|
{
|
||||||
path: "/employee",
|
path: "/employee",
|
||||||
name: "Employee",
|
name: "Employee",
|
||||||
element: Employee,
|
element: Employee,
|
||||||
|
navName: "Employees & Access",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/add-employee",
|
path: "/add-employee",
|
||||||
name: "Employee",
|
name: "Employee",
|
||||||
element: AddEmployee,
|
element: AddEmployee,
|
||||||
|
navName: "Employees & Access",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "edit-employee/:id",
|
path: "edit-employee/:id",
|
||||||
name: "Employee",
|
name: "Employee",
|
||||||
element: EditEmployee,
|
element: EditEmployee,
|
||||||
|
navName: "Employees & Access",
|
||||||
},
|
},
|
||||||
//Charts
|
// ------------------------ End Employee Routes-----------------------
|
||||||
{
|
|
||||||
path: "/new-user-day-wise",
|
//---------Point of Sale Section Routes------------------------
|
||||||
name: "new user day wise",
|
|
||||||
element: UserCharts,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/revenue-by-product",
|
|
||||||
name: "Revenue By Product",
|
|
||||||
element: ProductrevenueCharts,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/revenue-by-state",
|
|
||||||
name: "Revenue By State",
|
|
||||||
element: StateRevenueCharts,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/revenue-by-city",
|
|
||||||
name: "Revenue By City",
|
|
||||||
element: CityRevenueCharts,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/orders-day-wise",
|
|
||||||
name: "Orders (Day Wise)",
|
|
||||||
element: OrderdayChart,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/revenue-day-wise",
|
|
||||||
name: "Revenue (Day Wise)",
|
|
||||||
element: RevenueCharts,
|
|
||||||
},
|
|
||||||
//Point of Sale Section
|
|
||||||
{
|
{
|
||||||
path: "/pos",
|
path: "/pos",
|
||||||
name: "Point of Sale",
|
name: "Point of Sale",
|
||||||
element: Pos,
|
element: Pos,
|
||||||
|
navName: "Point of Sale",
|
||||||
},
|
},
|
||||||
|
|
||||||
// Export to excel
|
// Export to excel
|
||||||
@ -658,7 +819,9 @@ const routes = [
|
|||||||
path: "/exp",
|
path: "/exp",
|
||||||
name: "Point of Sale",
|
name: "Point of Sale",
|
||||||
element: ExportToExcel,
|
element: ExportToExcel,
|
||||||
|
navName: "Point of Sale",
|
||||||
},
|
},
|
||||||
|
//--------- End Point of Sale Section Routes------------------------
|
||||||
];
|
];
|
||||||
|
|
||||||
export default routes;
|
export default routes;
|
||||||
|
@ -32,8 +32,15 @@ const InternetConnectionPopUp = () => {
|
|||||||
title: "Warning",
|
title: "Warning",
|
||||||
text: "Internet connection is lost. Please check your connection.",
|
text: "Internet connection is lost. Please check your connection.",
|
||||||
icon: "warning",
|
icon: "warning",
|
||||||
button: "Retry",
|
button: {
|
||||||
|
text: "Retry",
|
||||||
|
value: "retry",
|
||||||
|
},
|
||||||
dangerMode: true,
|
dangerMode: true,
|
||||||
|
}).then((value) => {
|
||||||
|
if (value === "retry") {
|
||||||
|
window.location.reload(); // Reload the page
|
||||||
|
}
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -41,6 +41,8 @@ const AddProduct = () => {
|
|||||||
// sku: "",
|
// sku: "",
|
||||||
description: "",
|
description: "",
|
||||||
master_price: "",
|
master_price: "",
|
||||||
|
master_GST: "",
|
||||||
|
|
||||||
// discontinue_on: "",
|
// discontinue_on: "",
|
||||||
// hsn_code: "",
|
// hsn_code: "",
|
||||||
product_Status: "",
|
product_Status: "",
|
||||||
@ -215,6 +217,7 @@ const AddProduct = () => {
|
|||||||
<ProductDetails
|
<ProductDetails
|
||||||
data={{ data, setData }}
|
data={{ data, setData }}
|
||||||
categories={categories}
|
categories={categories}
|
||||||
|
taxes={taxes}
|
||||||
ProductId={{ productId, setProductId }}
|
ProductId={{ productId, setProductId }}
|
||||||
loading={{ loading, setLoading }}
|
loading={{ loading, setLoading }}
|
||||||
/>
|
/>
|
||||||
|
@ -43,6 +43,7 @@ const EditProduct = () => {
|
|||||||
// sku: "",
|
// sku: "",
|
||||||
description: "",
|
description: "",
|
||||||
master_price: "",
|
master_price: "",
|
||||||
|
master_GST: "",
|
||||||
// discontinue_on: "",
|
// discontinue_on: "",
|
||||||
// hsn_code: "",
|
// hsn_code: "",
|
||||||
product_Status: "",
|
product_Status: "",
|
||||||
@ -89,11 +90,12 @@ const EditProduct = () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
||||||
setData((prev) => ({
|
setData((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
...res.data?.data,
|
...res.data?.data,
|
||||||
category: res.data?.data?.category?._id,
|
category: res.data?.data?.category?._id,
|
||||||
|
master_GST: res.data?.data?.master_GST?._id,
|
||||||
|
product_Status: res.data?.data?.product_Status,
|
||||||
// discontinue_on: res.data?.data?.discontinue_on?.slice(0, 10),
|
// discontinue_on: res.data?.data?.discontinue_on?.slice(0, 10),
|
||||||
}));
|
}));
|
||||||
setProductId(res.data?.data?._id);
|
setProductId(res.data?.data?._id);
|
||||||
@ -243,6 +245,7 @@ const EditProduct = () => {
|
|||||||
<ProductDetails
|
<ProductDetails
|
||||||
data={{ data, setData }}
|
data={{ data, setData }}
|
||||||
categories={categories}
|
categories={categories}
|
||||||
|
taxes={taxes}
|
||||||
ProductId={{ productId, setProductId }}
|
ProductId={{ productId, setProductId }}
|
||||||
loading={{ loading, setLoading }}
|
loading={{ loading, setLoading }}
|
||||||
/>
|
/>
|
||||||
|
@ -8,6 +8,8 @@ const ProductDetails = (props) => {
|
|||||||
const { data, setData } = props.data;
|
const { data, setData } = props.data;
|
||||||
const { productId, setProductId } = props.ProductId;
|
const { productId, setProductId } = props.ProductId;
|
||||||
const { loading, setLoading } = props.loading;
|
const { loading, setLoading } = props.loading;
|
||||||
|
const taxes = props.taxes;
|
||||||
|
|
||||||
const categories = props?.categories || [];
|
const categories = props?.categories || [];
|
||||||
|
|
||||||
const handleChange = (e) => {
|
const handleChange = (e) => {
|
||||||
@ -26,7 +28,8 @@ const ProductDetails = (props) => {
|
|||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
if (
|
if (
|
||||||
data.name.trim() === "" ||
|
data.name.trim() === "" ||
|
||||||
// data.master_price.trim() === "" ||
|
data.master_price === "" ||
|
||||||
|
data.master_GST === "" ||
|
||||||
data.category === "" ||
|
data.category === "" ||
|
||||||
data.description === "" ||
|
data.description === "" ||
|
||||||
data.product_Status === ""
|
data.product_Status === ""
|
||||||
@ -102,19 +105,6 @@ const ProductDetails = (props) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3 row">
|
||||||
{/* <div className="col-lg-6">
|
|
||||||
<label htmlFor="product" className="form-label">
|
|
||||||
SKU*
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
id="sku"
|
|
||||||
value={data.sku}
|
|
||||||
maxLength="50"
|
|
||||||
onChange={(e) => handleChange(e)}
|
|
||||||
/>
|
|
||||||
</div> */}
|
|
||||||
<div className="col-lg-6 ">
|
<div className="col-lg-6 ">
|
||||||
<label htmlFor="product" className="form-label">
|
<label htmlFor="product" className="form-label">
|
||||||
Category *
|
Category *
|
||||||
@ -139,18 +129,8 @@ const ProductDetails = (props) => {
|
|||||||
)}
|
)}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-lg-6">
|
<div className="col-lg-6">
|
||||||
{/* <label htmlFor="product" className="form-label">
|
|
||||||
Master Price*
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
id="master_price"
|
|
||||||
value={data.master_price}
|
|
||||||
maxLength="6"
|
|
||||||
onChange={(e) => handleChange(e)}
|
|
||||||
/> */}
|
|
||||||
<label htmlFor="title" className="form-label">
|
<label htmlFor="title" className="form-label">
|
||||||
Product Status *
|
Product Status *
|
||||||
</label>{" "}
|
</label>{" "}
|
||||||
@ -167,6 +147,44 @@ const ProductDetails = (props) => {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mb-3 row">
|
||||||
|
<div className="col-lg-6">
|
||||||
|
<label htmlFor="product" className="form-label">
|
||||||
|
Master Price*
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
placeholder="₹"
|
||||||
|
id="master_price"
|
||||||
|
name="master_price"
|
||||||
|
value={data.master_price}
|
||||||
|
maxLength="6"
|
||||||
|
onChange={(e) => handleChange(e)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="col-lg-6 ">
|
||||||
|
<label htmlFor="product" className="form-label">
|
||||||
|
Master GST *
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
name="master_GST"
|
||||||
|
// value={r.gst_Id?._id ? r.gst_Id?._id : r.gst_Id}
|
||||||
|
value={data?.master_GST}
|
||||||
|
onChange={(e) => handleChange(e)}
|
||||||
|
id="master_GST"
|
||||||
|
className="form-control"
|
||||||
|
>
|
||||||
|
<option value="">---select---</option>
|
||||||
|
{taxes &&
|
||||||
|
taxes.map((item, index) => (
|
||||||
|
<option value={item._id} key={index}>
|
||||||
|
{item.tax} %{item.name}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label htmlFor="product" className="form-label">
|
<label htmlFor="product" className="form-label">
|
||||||
Description*
|
Description*
|
||||||
@ -174,6 +192,7 @@ const ProductDetails = (props) => {
|
|||||||
<textarea
|
<textarea
|
||||||
className="form-control"
|
className="form-control"
|
||||||
id="description"
|
id="description"
|
||||||
|
placeholder="Text..."
|
||||||
value={data.description}
|
value={data.description}
|
||||||
onChange={(e) => handleChange(e)}
|
onChange={(e) => handleChange(e)}
|
||||||
/>
|
/>
|
||||||
@ -199,6 +218,7 @@ const ProductDetails = (props) => {
|
|||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
className="form-control"
|
className="form-control"
|
||||||
|
placeholder="Text..."
|
||||||
style={{
|
style={{
|
||||||
whiteSpace: "pre-wrap",
|
whiteSpace: "pre-wrap",
|
||||||
minHeight: "100px",
|
minHeight: "100px",
|
||||||
|
@ -1,731 +1,3 @@
|
|||||||
// import React, { useState, useEffect } from "react";
|
|
||||||
// import { Link } from "react-router-dom";
|
|
||||||
// import Button from "@material-ui/core/Button";
|
|
||||||
// import { useNavigate } from "react-router-dom";
|
|
||||||
// import axios from "axios";
|
|
||||||
// import { isAutheticated } from "src/auth";
|
|
||||||
// import swal from "sweetalert";
|
|
||||||
// import {
|
|
||||||
// Box,
|
|
||||||
// FormControl,
|
|
||||||
// IconButton,
|
|
||||||
// InputLabel,
|
|
||||||
// MenuItem,
|
|
||||||
// Select,
|
|
||||||
// TextField,
|
|
||||||
// } from "@mui/material";
|
|
||||||
// import SearchIcon from "@mui/icons-material/Search";
|
|
||||||
// import Fuse from "fuse.js";
|
|
||||||
// import { Typography } from "@material-ui/core";
|
|
||||||
// const Products = () => {
|
|
||||||
// const token = isAutheticated();
|
|
||||||
// const [query, setQuery] = useState("");
|
|
||||||
// const navigate = useNavigate();
|
|
||||||
// const [loading, setLoading] = useState(true);
|
|
||||||
// const [success, setSuccess] = useState(true);
|
|
||||||
// const [productsData, setProductsData] = useState([]);
|
|
||||||
// const [filterData, setFilterData] = useState([]);
|
|
||||||
// const [queryData, setQueryData] = useState([]);
|
|
||||||
|
|
||||||
// const [currentPage, setCurrentPage] = useState(1);
|
|
||||||
// const [itemPerPage, setItemPerPage] = useState(10);
|
|
||||||
// const [showData, setShowData] = useState(productsData);
|
|
||||||
|
|
||||||
// const handleShowEntries = (e) => {
|
|
||||||
// setCurrentPage(1);
|
|
||||||
// setItemPerPage(e.target.value);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const getProductsData = async () => {
|
|
||||||
// axios
|
|
||||||
// .get(`/api/product/getAll/`, {
|
|
||||||
// headers: {
|
|
||||||
// Authorization: `Bearer ${token}`,
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// .then((res) => {
|
|
||||||
// setProductsData(res.data?.product);
|
|
||||||
// setLoading(false);
|
|
||||||
// })
|
|
||||||
// .catch((error) => {
|
|
||||||
// const msg = error?.response?.data?.message || "Something went wrong!";
|
|
||||||
|
|
||||||
// swal({
|
|
||||||
// title: error,
|
|
||||||
// text: msg,
|
|
||||||
// icon: "error",
|
|
||||||
// button: "Retry",
|
|
||||||
// dangerMode: true,
|
|
||||||
// });
|
|
||||||
// setLoading(false);
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// getProductsData();
|
|
||||||
// }, [success]);
|
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// const loadData = () => {
|
|
||||||
// const indexOfLastPost = currentPage * itemPerPage;
|
|
||||||
// const indexOfFirstPost = indexOfLastPost - itemPerPage;
|
|
||||||
// setShowData(productsData.slice(indexOfFirstPost, indexOfLastPost));
|
|
||||||
// };
|
|
||||||
// loadData();
|
|
||||||
// }, [currentPage, itemPerPage, productsData]);
|
|
||||||
|
|
||||||
// const handleDelete = (id) => {
|
|
||||||
// swal({
|
|
||||||
// title: "Are you sure?",
|
|
||||||
// icon: "error",
|
|
||||||
// buttons: {
|
|
||||||
// Yes: { text: "Yes", value: true },
|
|
||||||
// Cancel: { text: "Cancel", value: "cancel" },
|
|
||||||
// },
|
|
||||||
// }).then((value) => {
|
|
||||||
// if (value === true) {
|
|
||||||
// axios
|
|
||||||
// .delete(`/api/product/delete/${id}`, {
|
|
||||||
// headers: {
|
|
||||||
// "Access-Control-Allow-Origin": "*",
|
|
||||||
// Authorization: `Bearer ${token}`,
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// .then((res) => {
|
|
||||||
// swal({
|
|
||||||
// title: "Deleted",
|
|
||||||
// text: "Product Deleted successfully!",
|
|
||||||
// icon: "success",
|
|
||||||
// button: "ok",
|
|
||||||
// });
|
|
||||||
// setSuccess((prev) => !prev);
|
|
||||||
// })
|
|
||||||
// .catch((err) => {
|
|
||||||
// const msg = err?.response?.data?.message || "Something went wrong!";
|
|
||||||
|
|
||||||
// swal({
|
|
||||||
// title: "Warning",
|
|
||||||
// text: msg,
|
|
||||||
// icon: "error",
|
|
||||||
// button: "Retry",
|
|
||||||
// dangerMode: true,
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
// const [filterCategory, setFilterCategory] = useState("");
|
|
||||||
|
|
||||||
// const handleSearchClick = (query) => {
|
|
||||||
// const option = {
|
|
||||||
// isCaseSensitive: true,
|
|
||||||
// includeScore: false,
|
|
||||||
// shouldSort: true,
|
|
||||||
// includeMatches: false,
|
|
||||||
// findAllMatches: false,
|
|
||||||
// minMatchCharLength: 1,
|
|
||||||
// location: 0,
|
|
||||||
// threshold: 0.6,
|
|
||||||
// distance: 100,
|
|
||||||
// useExtendedSearch: true,
|
|
||||||
// ignoreLocation: false,
|
|
||||||
// ignoreFieldNorm: false,
|
|
||||||
// fieldNormWeight: 1,
|
|
||||||
// keys: ["name"],
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const fuse = new Fuse(productsData, option);
|
|
||||||
// const result = fuse.search(query);
|
|
||||||
|
|
||||||
// const searchedResult = result.map((result) => result.item);
|
|
||||||
// console.log(searchedResult);
|
|
||||||
// setQueryData(searchedResult);
|
|
||||||
// };
|
|
||||||
// useEffect(() => {
|
|
||||||
// if (query !== "") {
|
|
||||||
// setFilterCategory("");
|
|
||||||
// }
|
|
||||||
// setTimeout(() => handleSearchClick(query), 100);
|
|
||||||
// }, [query]);
|
|
||||||
// const uniqueCategoryNames = [
|
|
||||||
// ...new Set(showData?.map((product) => product?.category?.categoryName)),
|
|
||||||
// ];
|
|
||||||
// useEffect(() => {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// if (filterCategory !== "") {
|
|
||||||
// const filteredProducts = productsData.filter(
|
|
||||||
// (product) => product.category?.categoryName === filterCategory
|
|
||||||
// );
|
|
||||||
|
|
||||||
// setFilterData(filteredProducts);
|
|
||||||
// } else {
|
|
||||||
// // If no category is selected, show all products
|
|
||||||
// setShowData(productsData);
|
|
||||||
// // setFilterData(filteredProducts);
|
|
||||||
// }
|
|
||||||
// }, 100);
|
|
||||||
// }, [filterCategory, productsData]);
|
|
||||||
// return (
|
|
||||||
// <div className="main-content">
|
|
||||||
// <div className="page-content">
|
|
||||||
// <div className="container-fluid">
|
|
||||||
// <div className="row">
|
|
||||||
// <div className="col-12">
|
|
||||||
// <div
|
|
||||||
// className="
|
|
||||||
// page-title-box
|
|
||||||
// d-flex
|
|
||||||
// align-items-center
|
|
||||||
// justify-content-between
|
|
||||||
// "
|
|
||||||
// >
|
|
||||||
// <div style={{ fontSize: "22px" }} className="fw-bold">
|
|
||||||
// Products
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
// <div className="page-title-right">
|
|
||||||
// <Button
|
|
||||||
// variant="contained"
|
|
||||||
// color="primary"
|
|
||||||
// style={{
|
|
||||||
// fontWeight: "bold",
|
|
||||||
// marginBottom: "1rem",
|
|
||||||
// textTransform: "capitalize",
|
|
||||||
// }}
|
|
||||||
// onClick={() => {
|
|
||||||
// navigate("/product/add", { replace: true });
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// Add Product
|
|
||||||
// </Button>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
// <div className="row">
|
|
||||||
// <div className="col-lg-12">
|
|
||||||
// <div className="card">
|
|
||||||
// <div className="card-body">
|
|
||||||
// <div className="row ml-0 mr-0 mb-10">
|
|
||||||
// <div className="col-lg-1">
|
|
||||||
// <div className="dataTables_length">
|
|
||||||
// <label className="w-100">
|
|
||||||
// Show
|
|
||||||
// <select
|
|
||||||
// onChange={(e) => {
|
|
||||||
// setItemPerPage(e.target.value);
|
|
||||||
// setCurrentPage(1);
|
|
||||||
// }}
|
|
||||||
// className="form-control"
|
|
||||||
// disabled={loading}
|
|
||||||
// >
|
|
||||||
// <option value="10">10</option>
|
|
||||||
// <option value="25">25</option>
|
|
||||||
// <option value="50">50</option>
|
|
||||||
// <option value="100">100</option>
|
|
||||||
// </select>
|
|
||||||
// entries
|
|
||||||
// </label>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// <div className="col-lg-3">
|
|
||||||
// <label>Product Name:</label>
|
|
||||||
// <input
|
|
||||||
// type="text"
|
|
||||||
// placeholder="product name"
|
|
||||||
// className="form-control"
|
|
||||||
// ref={nameRef}
|
|
||||||
// disabled={loading}
|
|
||||||
// />
|
|
||||||
// </div>
|
|
||||||
// <div className="col-lg-3">
|
|
||||||
// <label>Filter by Category:</label>
|
|
||||||
// <select
|
|
||||||
// className="form-control"
|
|
||||||
// ref={categoryRef}
|
|
||||||
// disabled={loading}
|
|
||||||
// >
|
|
||||||
// <option value="">All</option>
|
|
||||||
// {categories?.map((e, i) => (
|
|
||||||
// <option key={i} value={e._id}>
|
|
||||||
// {e?.name}
|
|
||||||
// </option>
|
|
||||||
// ))}
|
|
||||||
// </select>
|
|
||||||
// </div>
|
|
||||||
// <div className="col-lg-2">
|
|
||||||
// <button
|
|
||||||
// className="btn btn-primary ms-1 mt-4"
|
|
||||||
// onClick={() => {
|
|
||||||
// getProductsData();
|
|
||||||
// setCurrentPage(1);
|
|
||||||
// }}
|
|
||||||
// disabled={loading}
|
|
||||||
// >
|
|
||||||
// Filter
|
|
||||||
// </button>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
// <div className="table-responsive table-shoot mt-3">
|
|
||||||
// <table
|
|
||||||
// className="table table-centered table-nowrap"
|
|
||||||
// style={{ border: "1px solid" }}
|
|
||||||
// >
|
|
||||||
// <thead
|
|
||||||
// className="thead-info"
|
|
||||||
// style={{ background: "rgb(140, 213, 213)" }}
|
|
||||||
// >
|
|
||||||
// <tr>
|
|
||||||
// <th className="text-start">Image</th>
|
|
||||||
// <th className="text-start">Product</th>
|
|
||||||
// <th className="text-start">Category</th>
|
|
||||||
|
|
||||||
// <th className="text-start">Price</th>
|
|
||||||
// <th className="text-start">Added On</th>
|
|
||||||
// <th className="text-start">Actions</th>
|
|
||||||
// </tr>
|
|
||||||
// </thead>
|
|
||||||
// <tbody>
|
|
||||||
// {!loading && showData.length === 0 && (
|
|
||||||
// <tr className="text-center">
|
|
||||||
// <td colSpan="6">
|
|
||||||
// <h5>No Data Available</h5>
|
|
||||||
// </td>
|
|
||||||
// </tr>
|
|
||||||
// )}
|
|
||||||
// {loading ? (
|
|
||||||
// <tr>
|
|
||||||
// <td className="text-center" colSpan="6">
|
|
||||||
// Loading...
|
|
||||||
// </td>
|
|
||||||
// </tr>
|
|
||||||
// ) : query === "" && filterCategory == "" ? (
|
|
||||||
// showData.map((product, i) => {
|
|
||||||
// return (
|
|
||||||
// <tr key={i}>
|
|
||||||
// <th>
|
|
||||||
// {product.image &&
|
|
||||||
// product.image.map((i, j) => (
|
|
||||||
// <img
|
|
||||||
// key={j}
|
|
||||||
// className="me-2"
|
|
||||||
// src={`${i?.url}`}
|
|
||||||
// width="40"
|
|
||||||
// alt=""
|
|
||||||
// />
|
|
||||||
// ))}
|
|
||||||
// </th>
|
|
||||||
// <td className="text-start">{product.name}</td>
|
|
||||||
// <td className="text-start">
|
|
||||||
// {product.category?.categoryName !== ""
|
|
||||||
// ? product.category?.categoryName
|
|
||||||
// : "Category Not selected "}
|
|
||||||
// </td>
|
|
||||||
// <th className="text-start">
|
|
||||||
// ₹
|
|
||||||
// {product?.total_amount
|
|
||||||
// ? product?.total_amount
|
|
||||||
// : product?.variants[0]?.price}
|
|
||||||
// </th>
|
|
||||||
// <td className="text-start">
|
|
||||||
// {new Date(product.createdAt).toLocaleString(
|
|
||||||
// "en-IN",
|
|
||||||
// {
|
|
||||||
// weekday: "short",
|
|
||||||
// month: "short",
|
|
||||||
// day: "numeric",
|
|
||||||
// year: "numeric",
|
|
||||||
// hour: "numeric",
|
|
||||||
// minute: "numeric",
|
|
||||||
// hour12: true,
|
|
||||||
// }
|
|
||||||
// )}
|
|
||||||
// </td>
|
|
||||||
// <td className="text-start">
|
|
||||||
// <Link to={`/product/view/${product._id}`}>
|
|
||||||
// <button
|
|
||||||
// style={{
|
|
||||||
// color: "white",
|
|
||||||
// marginRight: "1rem",
|
|
||||||
// }}
|
|
||||||
// type="button"
|
|
||||||
// className="
|
|
||||||
// btn btn-primary btn-sm
|
|
||||||
// waves-effect waves-light
|
|
||||||
// btn-table
|
|
||||||
// mx-1
|
|
||||||
// mt-1
|
|
||||||
// "
|
|
||||||
// >
|
|
||||||
// View
|
|
||||||
// </button>
|
|
||||||
// </Link>
|
|
||||||
// <Link to={`/product/edit/${product._id}`}>
|
|
||||||
// <button
|
|
||||||
// style={{
|
|
||||||
// color: "white",
|
|
||||||
// marginRight: "1rem",
|
|
||||||
// }}
|
|
||||||
// type="button"
|
|
||||||
// className="
|
|
||||||
// btn btn-info btn-sm
|
|
||||||
// waves-effect waves-light
|
|
||||||
// btn-table
|
|
||||||
// mt-1
|
|
||||||
// mx-1
|
|
||||||
// "
|
|
||||||
// >
|
|
||||||
// Edit
|
|
||||||
// </button>
|
|
||||||
// </Link>
|
|
||||||
// <Link
|
|
||||||
// to={"#"}
|
|
||||||
// style={{
|
|
||||||
// marginRight: "1rem",
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// <button
|
|
||||||
// style={{ color: "white" }}
|
|
||||||
// type="button"
|
|
||||||
// className="
|
|
||||||
// btn btn-danger btn-sm
|
|
||||||
// waves-effect waves-light
|
|
||||||
// btn-table
|
|
||||||
// mt-1
|
|
||||||
// mx-1
|
|
||||||
|
|
||||||
// "
|
|
||||||
// onClick={() => {
|
|
||||||
// handleDelete(product._id);
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// Delete
|
|
||||||
// </button>
|
|
||||||
// </Link>
|
|
||||||
// </td>
|
|
||||||
// </tr>
|
|
||||||
// );
|
|
||||||
// })
|
|
||||||
// ) : query !== "" ? (
|
|
||||||
// queryData.map((product, i) => {
|
|
||||||
// return (
|
|
||||||
// <tr key={i}>
|
|
||||||
// <th>
|
|
||||||
// {product.image &&
|
|
||||||
// product.image.map((i, j) => (
|
|
||||||
// <img
|
|
||||||
// key={j}
|
|
||||||
// className="me-2"
|
|
||||||
// src={`${i?.url}`}
|
|
||||||
// width="40"
|
|
||||||
// alt=""
|
|
||||||
// />
|
|
||||||
// ))}
|
|
||||||
// </th>
|
|
||||||
// <td className="text-start">{product.name}</td>
|
|
||||||
// <td className="text-start">
|
|
||||||
// {product.category !== ""
|
|
||||||
// ? product.category?.categoryName
|
|
||||||
// : "Category Not selected "}
|
|
||||||
// </td>
|
|
||||||
// <th className="text-start">₹{product.price}</th>
|
|
||||||
// <td className="text-start">
|
|
||||||
// {new Date(product.createdAt).toLocaleString(
|
|
||||||
// "en-IN",
|
|
||||||
// {
|
|
||||||
// weekday: "short",
|
|
||||||
// month: "short",
|
|
||||||
// day: "numeric",
|
|
||||||
// year: "numeric",
|
|
||||||
// hour: "numeric",
|
|
||||||
// minute: "numeric",
|
|
||||||
// hour12: true,
|
|
||||||
// }
|
|
||||||
// )}
|
|
||||||
// </td>
|
|
||||||
// <td className="text-start">
|
|
||||||
// <Link to={`/product/view/${product._id}`}>
|
|
||||||
// <button
|
|
||||||
// style={{
|
|
||||||
// color: "white",
|
|
||||||
// marginRight: "1rem",
|
|
||||||
// }}
|
|
||||||
// type="button"
|
|
||||||
// className="
|
|
||||||
// btn btn-primary btn-sm
|
|
||||||
// waves-effect waves-light
|
|
||||||
// btn-table
|
|
||||||
// mx-1
|
|
||||||
// mt-1
|
|
||||||
// "
|
|
||||||
// >
|
|
||||||
// View
|
|
||||||
// </button>
|
|
||||||
// </Link>
|
|
||||||
// <Link to={`/product/edit/${product._id}`}>
|
|
||||||
// <button
|
|
||||||
// style={{
|
|
||||||
// color: "white",
|
|
||||||
// marginRight: "1rem",
|
|
||||||
// }}
|
|
||||||
// type="button"
|
|
||||||
// className="
|
|
||||||
// btn btn-info btn-sm
|
|
||||||
// waves-effect waves-light
|
|
||||||
// btn-table
|
|
||||||
// mt-1
|
|
||||||
// mx-1
|
|
||||||
// "
|
|
||||||
// >
|
|
||||||
// Edit
|
|
||||||
// </button>
|
|
||||||
// </Link>
|
|
||||||
// <Link
|
|
||||||
// to={"#"}
|
|
||||||
// style={{
|
|
||||||
// marginRight: "1rem",
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// <button
|
|
||||||
// style={{ color: "white" }}
|
|
||||||
// type="button"
|
|
||||||
// className="
|
|
||||||
// btn btn-danger btn-sm
|
|
||||||
// waves-effect waves-light
|
|
||||||
// btn-table
|
|
||||||
// mt-1
|
|
||||||
// mx-1
|
|
||||||
|
|
||||||
// "
|
|
||||||
// onClick={() => {
|
|
||||||
// handleDelete(product._id);
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// Delete
|
|
||||||
// </button>
|
|
||||||
// </Link>
|
|
||||||
// </td>
|
|
||||||
// </tr>
|
|
||||||
// );
|
|
||||||
// })
|
|
||||||
// ) : (
|
|
||||||
// query == "" &&
|
|
||||||
// filterData.map((product, i) => {
|
|
||||||
// return (
|
|
||||||
// <tr key={i}>
|
|
||||||
// <th>
|
|
||||||
// {product.image &&
|
|
||||||
// product.image.map((i, j) => (
|
|
||||||
// <img
|
|
||||||
// key={j}
|
|
||||||
// className="me-2"
|
|
||||||
// src={`${i?.url}`}
|
|
||||||
// width="40"
|
|
||||||
// alt=""
|
|
||||||
// />
|
|
||||||
// ))}
|
|
||||||
// </th>
|
|
||||||
// <td className="text-start">{product.name}</td>
|
|
||||||
// <td className="text-start">
|
|
||||||
// {product.category?.categoryName}
|
|
||||||
// </td>
|
|
||||||
// <th className="text-start">₹{product.price}</th>
|
|
||||||
// <td className="text-start">
|
|
||||||
// {new Date(product.createdAt).toLocaleString(
|
|
||||||
// "en-IN",
|
|
||||||
// {
|
|
||||||
// weekday: "short",
|
|
||||||
// month: "short",
|
|
||||||
// day: "numeric",
|
|
||||||
// year: "numeric",
|
|
||||||
// hour: "numeric",
|
|
||||||
// minute: "numeric",
|
|
||||||
// hour12: true,
|
|
||||||
// }
|
|
||||||
// )}
|
|
||||||
// </td>
|
|
||||||
// <td className="text-start">
|
|
||||||
// <Link to={`/product/view/${product._id}`}>
|
|
||||||
// <button
|
|
||||||
// style={{
|
|
||||||
// color: "white",
|
|
||||||
// marginRight: "1rem",
|
|
||||||
// }}
|
|
||||||
// type="button"
|
|
||||||
// className="
|
|
||||||
// btn btn-primary btn-sm
|
|
||||||
// waves-effect waves-light
|
|
||||||
// btn-table
|
|
||||||
// mx-1
|
|
||||||
// mt-1
|
|
||||||
// "
|
|
||||||
// >
|
|
||||||
// View
|
|
||||||
// </button>
|
|
||||||
// </Link>
|
|
||||||
// <Link to={`/product/edit/${product._id}`}>
|
|
||||||
// <button
|
|
||||||
// style={{
|
|
||||||
// color: "white",
|
|
||||||
// marginRight: "1rem",
|
|
||||||
// }}
|
|
||||||
// type="button"
|
|
||||||
// className="
|
|
||||||
// btn btn-info btn-sm
|
|
||||||
// waves-effect waves-light
|
|
||||||
// btn-table
|
|
||||||
// mt-1
|
|
||||||
// mx-1
|
|
||||||
// "
|
|
||||||
// >
|
|
||||||
// Edit
|
|
||||||
// </button>
|
|
||||||
// </Link>
|
|
||||||
// <Link
|
|
||||||
// to={"#"}
|
|
||||||
// style={{
|
|
||||||
// marginRight: "1rem",
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// <button
|
|
||||||
// style={{ color: "white" }}
|
|
||||||
// type="button"
|
|
||||||
// className="
|
|
||||||
// btn btn-danger btn-sm
|
|
||||||
// waves-effect waves-light
|
|
||||||
// btn-table
|
|
||||||
// mt-1
|
|
||||||
// mx-1
|
|
||||||
|
|
||||||
// "
|
|
||||||
// onClick={() => {
|
|
||||||
// handleDelete(product._id);
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// Delete
|
|
||||||
// </button>
|
|
||||||
// </Link>
|
|
||||||
// </td>
|
|
||||||
// </tr>
|
|
||||||
// );
|
|
||||||
// })
|
|
||||||
// )}
|
|
||||||
// </tbody>
|
|
||||||
// </table>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
// <div className="row mt-20">
|
|
||||||
// <div className="col-sm-12 col-md-6 mb-20">
|
|
||||||
// <div
|
|
||||||
// className="dataTables_info"
|
|
||||||
// id="datatable_info"
|
|
||||||
// role="status"
|
|
||||||
// aria-live="polite"
|
|
||||||
// >
|
|
||||||
// Showing {currentPage * itemPerPage - itemPerPage + 1} to{" "}
|
|
||||||
// {Math.min(
|
|
||||||
// currentPage * itemPerPage,
|
|
||||||
// productsData.length
|
|
||||||
// )}{" "}
|
|
||||||
// of {productsData.length} entries
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
// <div className="col-sm-12 col-md-6">
|
|
||||||
// <div className="d-flex">
|
|
||||||
// <ul className="pagination ms-auto">
|
|
||||||
// <li
|
|
||||||
// className={
|
|
||||||
// currentPage === 1
|
|
||||||
// ? "paginate_button page-item previous disabled"
|
|
||||||
// : "paginate_button page-item previous"
|
|
||||||
// }
|
|
||||||
// >
|
|
||||||
// <span
|
|
||||||
// className="page-link"
|
|
||||||
// style={{ cursor: "pointer" }}
|
|
||||||
// onClick={() => setCurrentPage((prev) => prev - 1)}
|
|
||||||
// >
|
|
||||||
// Previous
|
|
||||||
// </span>
|
|
||||||
// </li>
|
|
||||||
|
|
||||||
// {!(currentPage - 1 < 1) && (
|
|
||||||
// <li className="paginate_button page-item">
|
|
||||||
// <span
|
|
||||||
// className="page-link"
|
|
||||||
// style={{ cursor: "pointer" }}
|
|
||||||
// onClick={(e) =>
|
|
||||||
// setCurrentPage((prev) => prev - 1)
|
|
||||||
// }
|
|
||||||
// >
|
|
||||||
// {currentPage - 1}
|
|
||||||
// </span>
|
|
||||||
// </li>
|
|
||||||
// )}
|
|
||||||
|
|
||||||
// <li className="paginate_button page-item active">
|
|
||||||
// <span
|
|
||||||
// className="page-link"
|
|
||||||
// style={{ cursor: "pointer" }}
|
|
||||||
// >
|
|
||||||
// {currentPage}
|
|
||||||
// </span>
|
|
||||||
// </li>
|
|
||||||
|
|
||||||
// {!(
|
|
||||||
// (currentPage + 1) * itemPerPage - itemPerPage >
|
|
||||||
// productsData.length - 1
|
|
||||||
// ) && (
|
|
||||||
// <li className="paginate_button page-item ">
|
|
||||||
// <span
|
|
||||||
// className="page-link"
|
|
||||||
// style={{ cursor: "pointer" }}
|
|
||||||
// onClick={() => {
|
|
||||||
// setCurrentPage((prev) => prev + 1);
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// {currentPage + 1}
|
|
||||||
// </span>
|
|
||||||
// </li>
|
|
||||||
// )}
|
|
||||||
|
|
||||||
// <li
|
|
||||||
// className={
|
|
||||||
// !(
|
|
||||||
// (currentPage + 1) * itemPerPage - itemPerPage >
|
|
||||||
// productsData.length - 1
|
|
||||||
// )
|
|
||||||
// ? "paginate_button page-item next"
|
|
||||||
// : "paginate_button page-item next disabled"
|
|
||||||
// }
|
|
||||||
// >
|
|
||||||
// <span
|
|
||||||
// className="page-link"
|
|
||||||
// style={{ cursor: "pointer" }}
|
|
||||||
// onClick={() => setCurrentPage((prev) => prev + 1)}
|
|
||||||
// >
|
|
||||||
// Next
|
|
||||||
// </span>
|
|
||||||
// </li>
|
|
||||||
// </ul>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
||||||
// export default Products;
|
|
||||||
|
|
||||||
import React, { useState, useEffect, useRef } from "react";
|
import React, { useState, useEffect, useRef } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
@ -755,8 +27,7 @@ const Products = () => {
|
|||||||
// } = checkPermission("Product Master");
|
// } = checkPermission("Product Master");
|
||||||
const getProductsData = async () => {
|
const getProductsData = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
await axios
|
||||||
axios
|
|
||||||
.get(`/api/product/getAll/admin/`, {
|
.get(`/api/product/getAll/admin/`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
@ -1067,21 +338,15 @@ const Products = () => {
|
|||||||
<th className="text-start">Actions</th>
|
<th className="text-start">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{!loading && productsData?.length === 0 && (
|
|
||||||
<tr className="text-center">
|
|
||||||
<td colSpan="6">
|
|
||||||
<h5>No Data Available</h5>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
)}
|
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<tr>
|
<tr>
|
||||||
<td className="text-center" colSpan="6">
|
<td className="text-center" colSpan="6">
|
||||||
Loading...
|
Loading...
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
) : (
|
) : productsData?.length > 0 ? (
|
||||||
productsData?.map((product, i) => {
|
productsData?.map((product, i) => {
|
||||||
return (
|
return (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
@ -1131,9 +396,9 @@ const Products = () => {
|
|||||||
</td>
|
</td>
|
||||||
<th className="text-start">
|
<th className="text-start">
|
||||||
₹
|
₹
|
||||||
{product?.total_amount
|
{product?.variants?.length > 0
|
||||||
? product?.total_amount
|
? product?.variants[0]?.price
|
||||||
: product?.variants[0]?.price}
|
: product?.master_price}
|
||||||
</th>
|
</th>
|
||||||
<td className="text-start">
|
<td className="text-start">
|
||||||
<span className=""></span>
|
<span className=""></span>
|
||||||
@ -1247,6 +512,15 @@ const Products = () => {
|
|||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
) : (
|
||||||
|
!loading &&
|
||||||
|
productsData?.length === 0 && (
|
||||||
|
<tr className="text-center">
|
||||||
|
<td colSpan="6">
|
||||||
|
<h5>No Product Available...</h5>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)
|
||||||
)}
|
)}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -76,7 +76,6 @@ const ViewProduct = () => {
|
|||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<td>{productData?.name}</td>
|
<td>{productData?.name}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Product Group</th>
|
<th>Product Group</th>
|
||||||
<td>{productData?.category?.categoryName}</td>
|
<td>{productData?.category?.categoryName}</td>
|
||||||
@ -99,15 +98,50 @@ const ViewProduct = () => {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
{productData?.master_price && (
|
||||||
|
<tr>
|
||||||
|
<th>Master Price</th>
|
||||||
|
<td>₹{productData?.master_price}</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
{productData?.master_GST && (
|
||||||
|
<tr>
|
||||||
|
<th>Master GST</th>
|
||||||
|
<td>
|
||||||
|
{productData?.master_GST?.tax}%{" "}
|
||||||
|
{productData?.master_GST?.name}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
{productData?.master_GST && (
|
||||||
|
<tr>
|
||||||
|
<th>Master GST Price</th>
|
||||||
|
<td>
|
||||||
|
₹
|
||||||
|
{(
|
||||||
|
(Number(productData?.master_price) *
|
||||||
|
Number(productData?.master_GST?.tax)) /
|
||||||
|
100
|
||||||
|
)?.toFixed(2)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
<tr>
|
<tr>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<td>{productData?.description}</td>
|
<td>{productData?.description}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Product Status</th>
|
<th>Product Status</th>
|
||||||
<td>{productData?.product_Status}</td>
|
<td
|
||||||
|
className={`badge m-1 ${
|
||||||
|
productData?.product_Status === "Active"
|
||||||
|
? "text-bg-success"
|
||||||
|
: "text-bg-danger"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{productData?.product_Status}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Special Instructions</th>
|
<th>Special Instructions</th>
|
||||||
<td>
|
<td>
|
||||||
|
@ -506,34 +506,64 @@ function ViewOrders() {
|
|||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-sm-6">
|
<div className="col-sm-6">
|
||||||
<div
|
<div
|
||||||
className="d-flex justify-content-center mt-3 me-3 "
|
className="d-flex justify-content-center mt-2 me-3 "
|
||||||
style={{
|
style={{
|
||||||
width: "6rem",
|
width: "6rem",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span
|
<span className=" mt-1" style={{}}>
|
||||||
className="px-2 mt-1"
|
|
||||||
style={{}}
|
|
||||||
>
|
|
||||||
{" "}
|
{" "}
|
||||||
Quantity:{" "}
|
Quantity:{" "}
|
||||||
{productDetails?.quantity}
|
{productDetails?.quantity}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
{productDetails?.variant_Name ? (
|
||||||
<p className="m-0 mt-3 ms-3">
|
<p className="m-0 mt-1 ms-3">
|
||||||
|
<small>Variant :</small> ₹
|
||||||
|
<small>
|
||||||
|
{productDetails?.variant_Name}
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<p className="m-0 mt-1 ms-3">
|
||||||
|
<small>It`s Device</small>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<p className="m-0 mt-1 ms-3">
|
||||||
<stong> Subtotal:</stong> ₹
|
<stong> Subtotal:</stong> ₹
|
||||||
{productDetails?.product_Subtotal}
|
{productDetails?.product_Subtotal}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-sm-6">
|
<div className="col-sm-6">
|
||||||
<p className="m-0 mt-3">
|
<p className="m-0 mt-1">
|
||||||
<stong> Price:</stong> ₹
|
<stong>
|
||||||
{productDetails?.price}
|
{productDetails?.variant_Name
|
||||||
|
? "Price:"
|
||||||
|
: "Master Price"}
|
||||||
|
</stong>{" "}
|
||||||
|
₹{productDetails?.price}
|
||||||
</p>
|
</p>
|
||||||
<p className="m-0 mt-3">
|
{productDetails?.gst_rate && (
|
||||||
<stong> GST:</stong> ₹
|
<p className="m-0 mt-1">
|
||||||
{productDetails?.gst_amount}
|
<small>
|
||||||
|
{productDetails?.variant_Name
|
||||||
|
? "GST Rate:"
|
||||||
|
: "Master GST Rate:"}{" "}
|
||||||
|
</small>
|
||||||
|
<small>
|
||||||
|
{productDetails?.gst_rate} %
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<p className="m-0 mt-1">
|
||||||
|
<small>
|
||||||
|
{productDetails?.variant_Name
|
||||||
|
? "GST:"
|
||||||
|
: "Master GST:"}{" "}
|
||||||
|
</small>{" "}
|
||||||
|
<small>
|
||||||
|
₹{productDetails?.gst_amount}
|
||||||
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -547,8 +577,10 @@ function ViewOrders() {
|
|||||||
<small className="mb-4">Shipping Charge: </small> ₹
|
<small className="mb-4">Shipping Charge: </small> ₹
|
||||||
{orderDetails?.shipping_charge}
|
{orderDetails?.shipping_charge}
|
||||||
<br />
|
<br />
|
||||||
<span className="mt-2"> Total Order Value: </span> ₹
|
<h6 className="mt-2">
|
||||||
{orderDetails?.total_amount}
|
{" "}
|
||||||
|
Total Order Value: ₹{orderDetails?.total_amount}
|
||||||
|
</h6>{" "}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user