diff --git a/src/App.js b/src/App.js index 72ff857..6473605 100644 --- a/src/App.js +++ b/src/App.js @@ -47,10 +47,13 @@ const App = () => { Authorization: `Bearer ${token}`, }, }); - // console.log(response.data) - const data = response.data; - if (data.success && data.user.role === "admin") { - setUserData(data.user); + // console.log("jjjjjjjj", response.data); + const data = response?.data; + if ( + data?.success && + (data?.user?.role === "admin" || data?.user?.role === "Employee") + ) { + setUserData(data?.user); } else { setUserData(false); } @@ -62,7 +65,6 @@ const App = () => { }; getUser(); }, []); - return ( @@ -87,7 +89,8 @@ const App = () => { path="/" name="Home" element={ - userdata?.role === "admin" ? ( + userdata && + (userdata.role === "admin" || userdata.role === "Employee") ? ( ) : userdata === false ? ( diff --git a/src/_nav.js b/src/_nav.js index 13e578e..eb87d25 100644 --- a/src/_nav.js +++ b/src/_nav.js @@ -34,54 +34,64 @@ const _nav = [ name: "Dashboard", to: "/dashboard", icon: , + group: "", }, { component: CNavItem, name: "Customers", icon: , to: "/customers-details", + group: "Customers", }, { component: CNavGroup, name: "Charts", icon: , + group: "", + items: [ { component: CNavItem, name: "new user day wise", icon: , to: "/new-user-day-wise", + group: "Charts", }, { component: CNavItem, name: "Revenue By Product", icon: , to: "/revenue-by-product", + group: "Charts", }, { component: CNavItem, name: "Revenue By State", icon: , to: "/revenue-by-state", + group: "Charts", }, { component: CNavItem, name: "Revenue By City", icon: , to: "/revenue-by-city", + group: "Charts", }, { component: CNavItem, name: "Orders (Day Wise)", icon: , to: "/orders-day-wise", + group: "Charts", }, { component: CNavItem, name: "Revenue (Day Wise)", icon: , to: "/revenue-day-wise", + group: "Charts", }, ], }, @@ -90,24 +100,29 @@ const _nav = [ component: CNavGroup, name: "Product Management", icon: , + group: "", + items: [ { component: CNavItem, name: "Categories", icon: , to: "/categories", + group: "Product Management", }, { component: CNavItem, name: "Products", icon: , to: "/products", + group: "Product Management", }, { component: CNavItem, name: "GST Rate", icon: , to: "/tax", + group: "Product Management", }, ], }, @@ -115,12 +130,15 @@ const _nav = [ component: CNavGroup, name: "Orders", icon: , + group: "", + items: [ { component: CNavItem, name: "New", icon: , to: "/orders/new", + group: "Orders", }, // { // component: CNavItem, @@ -133,36 +151,42 @@ const _nav = [ name: "Processing", icon: , to: "/orders/processing", + group: "Orders", }, { component: CNavItem, name: "Dispatched", icon: , to: "/orders/dispatched", + group: "Orders", }, { component: CNavItem, name: "Delivered", icon: , to: "/orders/delivered", + group: "Orders", }, { component: CNavItem, name: "Cancelled", icon: , to: "/orders/cancelled", + group: "Orders", }, { component: CNavItem, name: "In Store Cash Orders", icon: , to: "/inStoreCashOrders/new", + group: "Orders", }, { component: CNavItem, name: "In Store QRCode Orders", icon: , to: "/InStoreQRCodeOrders/new", + group: "Orders", }, ], }, @@ -170,49 +194,58 @@ const _nav = [ component: CNavGroup, name: "Website Related", icon: , + group: "", + items: [ { component: CNavItem, name: "Banner", icon: , to: "/banner", + group: "Website Related", }, { component: CNavItem, name: "Register Image", icon: , to: "/registerImage", + group: "Website Related", }, { component: CNavItem, name: "Login Image", icon: , to: "/loginImage", + group: "Website Related", }, { component: CNavItem, name: "Shop Page Image", icon: , to: "/shopImage", + group: "Website Related", }, { component: CNavItem, name: "Testimonials", icon: , to: "/testimonials", + group: "Website Related", }, - { - component: CNavItem, - name: "Contact Requests", - icon: , - to: "/contact/request", - }, + // { + // component: CNavItem, + // name: "Contact Requests", + // icon: , + // to: "/contact/request", + // group: "Website Related", + // }, { component: CNavItem, name: "SEO and Analytics", icon: , to: "/seo/request/new", + group: "Website Related", }, { @@ -220,12 +253,14 @@ const _nav = [ name: "Content ", icon: , to: "/content", + group: "Website Related", }, { component: CNavItem, name: "Home", icon: , to: "/home", + group: "Website Related", }, ], }, @@ -233,18 +268,22 @@ const _nav = [ component: CNavGroup, name: "Configuration", icon: , + group: "", + items: [ { component: CNavItem, name: "Social Media", icon: , to: "/socialmedia", + group: "Configuration", }, { component: CNavItem, name: "Application Name", icon: , to: "/application/name", + group: "Configuration", }, { @@ -252,18 +291,21 @@ const _nav = [ name: "Address", icon: , to: "/address", + group: "Configuration", }, { component: CNavItem, name: "Logos", icon: , to: "/logo", + group: "Configuration", }, { component: CNavItem, name: "Copyright Message", icon: , to: "/copyright/message", + group: "Configuration", }, ], }, @@ -272,18 +314,22 @@ const _nav = [ component: CNavGroup, name: "Affiliate & Coupons", icon: , + group: "", + items: [ { component: CNavItem, name: "Coupons", icon: , to: "/affiliate/coupons", + group: "Affiliate & Coupons", }, { component: CNavItem, name: "Affiliates", icon: , to: "/affiliate/affiliates", + group: "Affiliate & Coupons", }, ], }, @@ -292,18 +338,22 @@ const _nav = [ component: CNavGroup, name: "Customer Service", icon: , + group: "", + items: [ { component: CNavItem, name: "Customer Support", icon: , to: "/support/request", + group: "Customer Service", }, { component: CNavItem, name: "Contact Requests", icon: , to: "/contact/request", + group: "Customer Service", }, // { // component: CNavItem, @@ -319,13 +369,15 @@ const _nav = [ name: "Blog", icon: , to: "/blogs", + group: "Blog", }, // Employee { component: CNavItem, - name: " Employees & Access", + name: "Employees & Access", icon: , to: "/employee", + group: "Employees & Access", }, //Point of Sale start { @@ -333,6 +385,7 @@ const _nav = [ name: "Point of Sale", icon: , to: "/pos", + group: "Point of Sale", }, // { // component: CNavGroup, diff --git a/src/components/AppContent.js b/src/components/AppContent.js index 715dbd6..78d7530 100644 --- a/src/components/AppContent.js +++ b/src/components/AppContent.js @@ -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 { CContainer, CSpinner } from "@coreui/react"; // routes config import routes from "../routes"; - +import { isAutheticated } from "src/auth"; +import axios from "axios"; +import toast from "react-hot-toast"; 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); return ( }> {appRoutes.map((route, idx) => { - return ( - route.element && ( - } - /> - ) - ); + if ( + userper?.role === "admin" || + route.navName?.trim() === "" || + (userper?.accessTo && userper?.accessTo[route?.navName] === true) + ) { + return ( + route.element && ( + } + /> + ) + ); + } })} } /> diff --git a/src/layout/DefaultLayout.js b/src/layout/DefaultLayout.js index 43bd644..d2e83fe 100644 --- a/src/layout/DefaultLayout.js +++ b/src/layout/DefaultLayout.js @@ -1,5 +1,10 @@ -import React from 'react' -import { AppContent, AppSidebar, AppFooter, AppHeader } from '../components/index' +import React from "react"; +import { + AppContent, + AppSidebar, + AppFooter, + AppHeader, +} from "../components/index"; const DefaultLayout = () => { return ( @@ -13,7 +18,7 @@ const DefaultLayout = () => { - ) -} + ); +}; -export default DefaultLayout +export default DefaultLayout; diff --git a/src/routes.js b/src/routes.js index c9db5aa..fd32e9f 100644 --- a/src/routes.js +++ b/src/routes.js @@ -148,59 +148,157 @@ import AddEmployee from "./views/EmployeeAccess/addEmployee"; import EditEmployee from "./views/EmployeeAccess/editEmployee"; import ExportToExcel from "./views/exportExcel"; const routes = [ - { path: "/", exact: true, name: "Home" }, + // { path: "/", exact: true, name: "Home", navName: "" }, + //dashboard + + { path: "/dashboard", name: "Dashboard", element: Dashboard, navName: "" }, { path: "/change_password", name: "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 }, + //------------------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 - { path: "/departures", name: "Departures", element: Departures }, - { path: "/departure/add", name: "Add Departure", element: AddDeparture }, - { path: "/product/edit/:id", name: "Edit products", element: EditProduct }, - { path: "/product/view/:id", name: "view products", element: ViewProduct }, + // { path: "/departures", name: "Departures", element: Departures }, + // { path: "/departure/add", name: "Add Departure", element: AddDeparture }, + // { path: "/product/edit/:id", name: "Edit products", element: EditProduct }, + // { path: "/product/view/:id", name: "view products", element: ViewProduct }, // Appointments - { path: "/appointments", name: "Appointments", element: Appointments }, - { - path: "/appointment/view/:id", - name: "View Appointment", - element: ViewAppointment, - }, - { - path: "/appointment/edit/:id", - name: "Edit Appointment", - element: EditAppointment, - }, - { - path: "/appointment/new", - name: "Add Appointment", - element: AddNewAppointment, - }, - + // { path: "/appointments", name: "Appointments", element: Appointments }, + // { + // path: "/appointment/view/:id", + // name: "View Appointment", + // element: ViewAppointment, + // }, + // { + // path: "/appointment/edit/:id", + // name: "Edit Appointment", + // element: EditAppointment, + // }, + // { + // path: "/appointment/new", + // name: "Add Appointment", + // element: AddNewAppointment, + // }, + //------------------customers Route------------------------- { path: "/customers-details", name: "Customers", element: CustomerTable, + navName: "Customers", }, { path: "/customers-details/:_id", name: "Customers", element: SingleUserAllDetails, + navName: "Customers", }, { path: "/add-customer", name: "Customers", element: AddCustomer, + navName: "Customers", }, + //------------------ End customers Route------------------------- + // { // path: "/users-address/add", // name: "User Address", @@ -239,27 +337,23 @@ const routes = [ // element: ViewHealthCareProvider, // }, // Categories - { - path: "/categories", - name: "Categories", - element: Categories, - }, + // Design - { - path: "/design", - name: "Design", - element: Design, - }, - { - path: "//campaigns", - name: "campaigns", - element: Campaign, - }, - { - path: "//campaign/add", - name: "Add Campaigns", - element: AddCampaign, - }, + // { + // path: "/design", + // name: "Design", + // element: Design, + // }, + // { + // path: "/campaigns", + // name: "campaigns", + // element: Campaign, + // }, + // { + // path: "/campaign/add", + // name: "Add Campaigns", + // element: AddCampaign, + // }, // { // path: "/campaigns/edit/:id", // name: "Edit healthcare providers", @@ -273,384 +367,451 @@ const routes = [ // { path: '/franchisee/view/:id', name: 'view franchisee', element: ViewFra }, //Contact Requests - + // ----------------Customer Service Routes------------------------------- { path: "/contact/request", name: "Customer Service", element: ContactRequests, + navName: "Customer Service", }, { path: "/contact/request/new", name: "Customer Service", element: AddContactRequest, + navName: "Customer Service", }, //Support Requests - // { - // path: "/email-cms", - // name: "CustomerSupport Requests", - // element: EmailCms, - // }, - // { - // path: "/email-cms/registration-email", - // name: "CustomerSupport Requests", - // element: RegistrationEmail, - // }, + { + path: "/email-cms", + name: "CustomerSupport Requests", + element: EmailCms, + navName: "Customer Service", + }, + { + path: "/email-cms/registration-email", + name: "CustomerSupport Requests", + element: RegistrationEmail, + navName: "Customer Service", + }, { path: "/support/request", name: "Customer Service", element: SupportRequest, + navName: "Customer Service", }, { path: "/support/request/closed", name: "Customer Service", element: SupportRequestClosed, + navName: "Customer Service", }, { path: "/support/request/closed/:ticketID", name: "Customer Service", element: CloseRequestView, + navName: "Customer Service", }, { path: "/support/request/reply/:ticketID", name: "Customer Service", element: SupportReply, + navName: "Customer Service", }, - // Content ---- > - - { - 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, - }, + // ---------------- End Customer Service Routes------------------------------- // { path: '/complaint/view/:id', name: 'view Complain', element: ViewComplaint }, //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", name: "Testimonials", element: Testimonials, + navName: "Website Related", }, { path: "/testimonial/new", name: "AddTestimonial", element: AddTestimonial, + navName: "Website Related", }, { path: "/testimonial/view/:id", name: "ViewTestimonial", element: ViewTestimonial, + navName: "Website Related", }, { path: "/testimonial/edit/:id", name: "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", - name: "Banners", - element: Banners, + path: "/content/terms-and-conditions", + name: "Website Related", + element: EditTermsConditions, + navName: "Website Related", }, { - path: "/registerImage", - name: "RegisterImage", - element: RegisterImage, + path: "/content/privacy-policy", + name: "Website Related", + element: EditPrivacyPolicy, + navName: "Website Related", }, { - path: "/loginImage", - name: "LoginImage", - element: LoginImage, + path: "/content/shipping-policy", + name: "Website Related", + element: EditShippingPolicy, + navName: "Website Related", }, { - path: "/shopImage", - name: "ShopImage", - element: ShopImage, + path: "/content/refund-policy", + name: "Website Related", + 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 - { 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", - name: "Add Informations", - element: AddInformations, + path: "/orders/new", + name: "New Orders", + 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", name: "Processing Orders", element: ProcessingOrders, + navName: "Orders", }, { path: "/orders/dispatched", name: "Dispatched Orders", element: DispatchedOrders, + navName: "Orders", }, { path: "/orders/delivered", name: "Delivered Orders", element: DeliveredOrders, + navName: "Orders", }, { path: "/orders/cancelled", name: "Cancelled Orders", element: CancelledOrders, + navName: "Orders", }, { path: "/orders/returned", name: "Returned Orders", element: ReturnedOrders, + navName: "Orders", }, - //Point of sale orders { path: "/inStoreCashOrders/new", name: "In Store Cash Orders", element: InStoreCashOrders, + navName: "Orders", }, { path: "/InStoreQRCodeOrders/new", name: "In Store QR Code Orders", element: InStoreQRCodeOrders, + navName: "Orders", }, { path: "/inStoreOrders/:status/:id", name: "View In Store Cash Orders", element: POSViewOrders, + navName: "Orders", }, + //-------------- End Order Management Routes--------------------------------------- + + //----------Point of sale orders Routes----------------------- + // { path: "/order/:status/:id", name: "View Order", element: ViewOdr }, - //dashboard - - { path: "/dashboard", name: "Dashboard", element: Dashboard }, - //------------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/add", name: "Add Purpose", element: AddPurpose }, - //languge + // { path: "/purpose", name: "Purpose", element: Purpose }, + // { path: "/purpose/add", name: "Add Purpose", element: AddPurpose }, + // //languge - { path: "/languages", name: "languages", element: Languages }, - { path: "/language/add", name: "Add languages", element: AddLanguage }, - { path: "/language/edit/:id", name: "Edit languages", element: EditLanguage }, + // { path: "/languages", name: "languages", element: Languages }, + // { path: "/language/add", name: "Add languages", element: AddLanguage }, + // { path: "/language/edit/:id", name: "Edit languages", element: EditLanguage }, //business Type - { path: "/business_type", name: "business", element: BusinessType }, - { - path: "/business_type/add", - name: "Add business", - element: AddBusinessType, - }, - { - path: "/business_type/edit/:id", - name: "Edit business", - element: EditBusinessType, - }, + // { path: "/business_type", name: "business", element: BusinessType }, + // { + // path: "/business_type/add", + // name: "Add business", + // element: AddBusinessType, + // }, + // { + // path: "/business_type/edit/:id", + // name: "Edit business", + // element: EditBusinessType, + // }, //purpose - { path: "/purpose", name: "purpose", element: Purpose }, - { path: "/purpose/add", name: "Add purpose", element: AddPurpose }, - { path: "/purpose/edit/:id", name: "Edit purpose", element: EditPurpose }, + // { path: "/purpose", name: "purpose", element: Purpose }, + // { path: "/purpose/add", name: "Add purpose", element: AddPurpose }, + // { path: "/purpose/edit/:id", name: "Edit purpose", element: EditPurpose }, //languge + + //-----------------Configuration Routes----------------------------------- + { + path: "/socialmedia", + name: "Social Media", + element: Socialmedia, + navName: "Configuration", + }, + { path: "/application/name", name: "ApplicationName", element: ApplicationName, + navName: "Configuration", }, { path: "/copyright/message", name: "Copyright Message", 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", - name: "seo Request", - element: AddSeoRequest, + path: "/address", + name: "Address", + 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", name: "Create Coupon", element: CreateCoupon, + navName: "Affiliate & Coupons", }, { path: "/affiliate/affiliates/create", name: "Create Affiliate", element: CreateAffiliate, + navName: "Affiliate & Coupons", }, { path: "/affiliate/affiliates/edit/:id", name: "Edit Affiliate", element: EditAffiliate, + navName: "Affiliate & Coupons", }, { path: "/affiliate/affiliates/pay/:id", name: "Pay Affiliate", element: PayAffiliate, + navName: "Affiliate & Coupons", }, { path: "/affiliate/affiliates/history/:id", name: "Pay Affiliate", element: AffiliateHistory, + navName: "Affiliate & Coupons", }, { path: "/affiliate/coupons/edit/:id", name: "Edit Coupon", element: EditCoupon, + navName: "Affiliate & Coupons", }, { path: "/affiliate/coupons/history/:id", name: "Edit Coupon", element: CouponHistory, + navName: "Affiliate & Coupons", }, - //Blogs Section + //----------------- End Affiliate & Coupons Routes----------------------------------- + + //---------- Blog Routes--------------------------------- { path: "/blogs", name: "Blogs", element: Blogs, + navName: "Blog", }, { path: "/blogs/create", name: "Blogs", element: CreateBlog, + navName: "Blog", }, { path: "/blog/edit/:id", name: "Blogs", element: UpdateBlog, + navName: "Blog", }, { path: "/blog/view/:id", name: "Blogs", element: ViewBlog, + navName: "Blog", }, - // Employee + + //----------End Blog Routes--------------------------------- + // ------------------------Employee Routes----------------------- { path: "/employee", name: "Employee", element: Employee, + navName: "Employees & Access", }, { path: "/add-employee", name: "Employee", element: AddEmployee, + navName: "Employees & Access", }, { path: "edit-employee/:id", name: "Employee", element: EditEmployee, + navName: "Employees & Access", }, - //Charts - { - path: "/new-user-day-wise", - 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 + // ------------------------ End Employee Routes----------------------- + + //---------Point of Sale Section Routes------------------------ { path: "/pos", name: "Point of Sale", element: Pos, + navName: "Point of Sale", }, // Export to excel @@ -658,7 +819,9 @@ const routes = [ path: "/exp", name: "Point of Sale", element: ExportToExcel, + navName: "Point of Sale", }, + //--------- End Point of Sale Section Routes------------------------ ]; export default routes; diff --git a/src/views/InternetConnectionPopUp.js b/src/views/InternetConnectionPopUp.js index 1ee2f18..db33aed 100644 --- a/src/views/InternetConnectionPopUp.js +++ b/src/views/InternetConnectionPopUp.js @@ -32,8 +32,15 @@ const InternetConnectionPopUp = () => { title: "Warning", text: "Internet connection is lost. Please check your connection.", icon: "warning", - button: "Retry", + button: { + text: "Retry", + value: "retry", + }, dangerMode: true, + }).then((value) => { + if (value === "retry") { + window.location.reload(); // Reload the page + } })} ); diff --git a/src/views/Products/AddProduct.js b/src/views/Products/AddProduct.js index bb79edd..166d59c 100644 --- a/src/views/Products/AddProduct.js +++ b/src/views/Products/AddProduct.js @@ -41,6 +41,8 @@ const AddProduct = () => { // sku: "", description: "", master_price: "", + master_GST: "", + // discontinue_on: "", // hsn_code: "", product_Status: "", @@ -215,6 +217,7 @@ const AddProduct = () => { diff --git a/src/views/Products/EditProduct.js b/src/views/Products/EditProduct.js index ae11182..2ff686b 100644 --- a/src/views/Products/EditProduct.js +++ b/src/views/Products/EditProduct.js @@ -43,6 +43,7 @@ const EditProduct = () => { // sku: "", description: "", master_price: "", + master_GST: "", // discontinue_on: "", // hsn_code: "", product_Status: "", @@ -89,11 +90,12 @@ const EditProduct = () => { }, }) .then((res) => { - setData((prev) => ({ ...prev, ...res.data?.data, 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), })); setProductId(res.data?.data?._id); @@ -243,6 +245,7 @@ const EditProduct = () => { diff --git a/src/views/Products/Productcomponents/ProductDetails.js b/src/views/Products/Productcomponents/ProductDetails.js index 98b525d..2672694 100644 --- a/src/views/Products/Productcomponents/ProductDetails.js +++ b/src/views/Products/Productcomponents/ProductDetails.js @@ -8,6 +8,8 @@ const ProductDetails = (props) => { const { data, setData } = props.data; const { productId, setProductId } = props.ProductId; const { loading, setLoading } = props.loading; + const taxes = props.taxes; + const categories = props?.categories || []; const handleChange = (e) => { @@ -26,7 +28,8 @@ const ProductDetails = (props) => { const handleSubmit = () => { if ( data.name.trim() === "" || - // data.master_price.trim() === "" || + data.master_price === "" || + data.master_GST === "" || data.category === "" || data.description === "" || data.product_Status === "" @@ -102,19 +105,6 @@ const ProductDetails = (props) => { />
- {/*
- - handleChange(e)} - /> -
*/}
+
- {/* - handleChange(e)} - /> */} {" "} @@ -167,6 +147,44 @@ const ProductDetails = (props) => {
+
+
+ + handleChange(e)} + /> +
+
+ + +
+