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}`,
|
||||
},
|
||||
});
|
||||
// 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 (
|
||||
<HashRouter>
|
||||
<Suspense fallback={loading}>
|
||||
@ -87,7 +89,8 @@ const App = () => {
|
||||
path="/"
|
||||
name="Home"
|
||||
element={
|
||||
userdata?.role === "admin" ? (
|
||||
userdata &&
|
||||
(userdata.role === "admin" || userdata.role === "Employee") ? (
|
||||
<DefaultLayout />
|
||||
) : userdata === false ? (
|
||||
<Login />
|
||||
|
65
src/_nav.js
65
src/_nav.js
@ -34,54 +34,64 @@ const _nav = [
|
||||
name: "Dashboard",
|
||||
to: "/dashboard",
|
||||
icon: <CIcon icon={cilSpeedometer} customClassName="nav-icon" />,
|
||||
group: "",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Customers",
|
||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||
to: "/customers-details",
|
||||
group: "Customers",
|
||||
},
|
||||
|
||||
{
|
||||
component: CNavGroup,
|
||||
name: "Charts",
|
||||
icon: <CIcon icon={cilCat} customClassName="nav-icon" />,
|
||||
group: "",
|
||||
|
||||
items: [
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "new user day wise",
|
||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||
to: "/new-user-day-wise",
|
||||
group: "Charts",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Revenue By Product",
|
||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||
to: "/revenue-by-product",
|
||||
group: "Charts",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Revenue By State",
|
||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||
to: "/revenue-by-state",
|
||||
group: "Charts",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Revenue By City",
|
||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||
to: "/revenue-by-city",
|
||||
group: "Charts",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Orders (Day Wise)",
|
||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||
to: "/orders-day-wise",
|
||||
group: "Charts",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Revenue (Day Wise)",
|
||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||
to: "/revenue-day-wise",
|
||||
group: "Charts",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -90,24 +100,29 @@ const _nav = [
|
||||
component: CNavGroup,
|
||||
name: "Product Management",
|
||||
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
||||
group: "",
|
||||
|
||||
items: [
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Categories",
|
||||
icon: <CIcon icon={cilCat} customClassName="nav-icon" />,
|
||||
to: "/categories",
|
||||
group: "Product Management",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Products",
|
||||
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
||||
to: "/products",
|
||||
group: "Product Management",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "GST Rate",
|
||||
icon: <CIcon icon={cilTablet} customClassName="nav-icon" />,
|
||||
to: "/tax",
|
||||
group: "Product Management",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -115,12 +130,15 @@ const _nav = [
|
||||
component: CNavGroup,
|
||||
name: "Orders",
|
||||
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
||||
group: "",
|
||||
|
||||
items: [
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "New",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/orders/new",
|
||||
group: "Orders",
|
||||
},
|
||||
// {
|
||||
// component: CNavItem,
|
||||
@ -133,36 +151,42 @@ const _nav = [
|
||||
name: "Processing",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/orders/processing",
|
||||
group: "Orders",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Dispatched",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/orders/dispatched",
|
||||
group: "Orders",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Delivered",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/orders/delivered",
|
||||
group: "Orders",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Cancelled",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/orders/cancelled",
|
||||
group: "Orders",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "In Store Cash Orders",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/inStoreCashOrders/new",
|
||||
group: "Orders",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "In Store QRCode Orders",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/InStoreQRCodeOrders/new",
|
||||
group: "Orders",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -170,49 +194,58 @@ const _nav = [
|
||||
component: CNavGroup,
|
||||
name: "Website Related",
|
||||
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
||||
group: "",
|
||||
|
||||
items: [
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Banner",
|
||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||
to: "/banner",
|
||||
group: "Website Related",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Register Image",
|
||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||
to: "/registerImage",
|
||||
group: "Website Related",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Login Image",
|
||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||
to: "/loginImage",
|
||||
group: "Website Related",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Shop Page Image",
|
||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||
to: "/shopImage",
|
||||
group: "Website Related",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Testimonials",
|
||||
icon: <CIcon icon={cilCompress} customClassName="nav-icon" />,
|
||||
to: "/testimonials",
|
||||
group: "Website Related",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Contact Requests",
|
||||
icon: <CIcon icon={cilContact} customClassName="nav-icon" />,
|
||||
to: "/contact/request",
|
||||
},
|
||||
// {
|
||||
// component: CNavItem,
|
||||
// name: "Contact Requests",
|
||||
// icon: <CIcon icon={cilContact} customClassName="nav-icon" />,
|
||||
// to: "/contact/request",
|
||||
// group: "Website Related",
|
||||
// },
|
||||
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "SEO and Analytics",
|
||||
icon: <CIcon icon={cilContact} customClassName="nav-icon" />,
|
||||
to: "/seo/request/new",
|
||||
group: "Website Related",
|
||||
},
|
||||
|
||||
{
|
||||
@ -220,12 +253,14 @@ const _nav = [
|
||||
name: "Content ",
|
||||
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
||||
to: "/content",
|
||||
group: "Website Related",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Home",
|
||||
icon: <CIcon icon={cilFeaturedPlaylist} customClassName="nav-icon" />,
|
||||
to: "/home",
|
||||
group: "Website Related",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -233,18 +268,22 @@ const _nav = [
|
||||
component: CNavGroup,
|
||||
name: "Configuration",
|
||||
icon: <CIcon icon={cilAppsSettings} customClassName="nav-icon" />,
|
||||
group: "",
|
||||
|
||||
items: [
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Social Media",
|
||||
icon: <CIcon icon={cilMedicalCross} customClassName="nav-icon" />,
|
||||
to: "/socialmedia",
|
||||
group: "Configuration",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Application Name",
|
||||
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
||||
to: "/application/name",
|
||||
group: "Configuration",
|
||||
},
|
||||
|
||||
{
|
||||
@ -252,18 +291,21 @@ const _nav = [
|
||||
name: "Address",
|
||||
icon: <CIcon icon={cilAddressBook} customClassName="nav-icon" />,
|
||||
to: "/address",
|
||||
group: "Configuration",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Logos",
|
||||
icon: <CIcon icon={cilCommand} customClassName="nav-icon" />,
|
||||
to: "/logo",
|
||||
group: "Configuration",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Copyright Message",
|
||||
icon: <CIcon icon={cilText} customClassName="nav-icon" />,
|
||||
to: "/copyright/message",
|
||||
group: "Configuration",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -272,18 +314,22 @@ const _nav = [
|
||||
component: CNavGroup,
|
||||
name: "Affiliate & Coupons",
|
||||
icon: <CIcon icon={cilCart} customClassName="nav-icon" />,
|
||||
group: "",
|
||||
|
||||
items: [
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Coupons",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/affiliate/coupons",
|
||||
group: "Affiliate & Coupons",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Affiliates",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/affiliate/affiliates",
|
||||
group: "Affiliate & Coupons",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -292,18 +338,22 @@ const _nav = [
|
||||
component: CNavGroup,
|
||||
name: "Customer Service",
|
||||
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
||||
group: "",
|
||||
|
||||
items: [
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Customer Support",
|
||||
icon: <CIcon icon={cilAlarm} customClassName="nav-icon" />,
|
||||
to: "/support/request",
|
||||
group: "Customer Service",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Contact Requests",
|
||||
icon: <CIcon icon={cilUser} customClassName="nav-icon" />,
|
||||
to: "/contact/request",
|
||||
group: "Customer Service",
|
||||
},
|
||||
// {
|
||||
// component: CNavItem,
|
||||
@ -319,6 +369,7 @@ const _nav = [
|
||||
name: "Blog",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/blogs",
|
||||
group: "Blog",
|
||||
},
|
||||
// Employee
|
||||
{
|
||||
@ -326,6 +377,7 @@ const _nav = [
|
||||
name: "Employees & Access",
|
||||
icon: <CIcon icon={cilImage} customClassName="nav-icon" />,
|
||||
to: "/employee",
|
||||
group: "Employees & Access",
|
||||
},
|
||||
//Point of Sale start
|
||||
{
|
||||
@ -333,6 +385,7 @@ const _nav = [
|
||||
name: "Point of Sale",
|
||||
icon: <CIcon icon={cilNotes} customClassName="nav-icon" />,
|
||||
to: "/pos",
|
||||
group: "Point of Sale",
|
||||
},
|
||||
// {
|
||||
// component: CNavGroup,
|
||||
|
@ -1,17 +1,56 @@
|
||||
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 (
|
||||
<CContainer lg>
|
||||
<Suspense fallback={<CSpinner color="primary" />}>
|
||||
<Routes>
|
||||
{appRoutes.map((route, idx) => {
|
||||
if (
|
||||
userper?.role === "admin" ||
|
||||
route.navName?.trim() === "" ||
|
||||
(userper?.accessTo && userper?.accessTo[route?.navName] === true)
|
||||
) {
|
||||
return (
|
||||
route.element && (
|
||||
<Route
|
||||
@ -23,6 +62,7 @@ const AppContent = () => {
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
})}
|
||||
<Route path="/" element={<Navigate to="dashboard" replace />} />
|
||||
</Routes>
|
||||
|
@ -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 = () => {
|
||||
<AppFooter />
|
||||
</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 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;
|
||||
|
@ -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
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
@ -41,6 +41,8 @@ const AddProduct = () => {
|
||||
// sku: "",
|
||||
description: "",
|
||||
master_price: "",
|
||||
master_GST: "",
|
||||
|
||||
// discontinue_on: "",
|
||||
// hsn_code: "",
|
||||
product_Status: "",
|
||||
@ -215,6 +217,7 @@ const AddProduct = () => {
|
||||
<ProductDetails
|
||||
data={{ data, setData }}
|
||||
categories={categories}
|
||||
taxes={taxes}
|
||||
ProductId={{ productId, setProductId }}
|
||||
loading={{ loading, setLoading }}
|
||||
/>
|
||||
|
@ -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 = () => {
|
||||
<ProductDetails
|
||||
data={{ data, setData }}
|
||||
categories={categories}
|
||||
taxes={taxes}
|
||||
ProductId={{ productId, setProductId }}
|
||||
loading={{ loading, setLoading }}
|
||||
/>
|
||||
|
@ -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) => {
|
||||
/>
|
||||
</div>
|
||||
<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 ">
|
||||
<label htmlFor="product" className="form-label">
|
||||
Category *
|
||||
@ -139,18 +129,8 @@ const ProductDetails = (props) => {
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
Product Status *
|
||||
</label>{" "}
|
||||
@ -167,6 +147,44 @@ const ProductDetails = (props) => {
|
||||
</select>
|
||||
</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">
|
||||
<label htmlFor="product" className="form-label">
|
||||
Description*
|
||||
@ -174,6 +192,7 @@ const ProductDetails = (props) => {
|
||||
<textarea
|
||||
className="form-control"
|
||||
id="description"
|
||||
placeholder="Text..."
|
||||
value={data.description}
|
||||
onChange={(e) => handleChange(e)}
|
||||
/>
|
||||
@ -199,6 +218,7 @@ const ProductDetails = (props) => {
|
||||
</label>
|
||||
<textarea
|
||||
className="form-control"
|
||||
placeholder="Text..."
|
||||
style={{
|
||||
whiteSpace: "pre-wrap",
|
||||
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 { Link } from "react-router-dom";
|
||||
import axios from "axios";
|
||||
@ -755,8 +27,7 @@ const Products = () => {
|
||||
// } = checkPermission("Product Master");
|
||||
const getProductsData = async () => {
|
||||
setLoading(true);
|
||||
|
||||
axios
|
||||
await axios
|
||||
.get(`/api/product/getAll/admin/`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
@ -1067,21 +338,15 @@ const Products = () => {
|
||||
<th className="text-start">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{!loading && productsData?.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>
|
||||
) : (
|
||||
) : productsData?.length > 0 ? (
|
||||
productsData?.map((product, i) => {
|
||||
return (
|
||||
<tr key={i}>
|
||||
@ -1131,9 +396,9 @@ const Products = () => {
|
||||
</td>
|
||||
<th className="text-start">
|
||||
₹
|
||||
{product?.total_amount
|
||||
? product?.total_amount
|
||||
: product?.variants[0]?.price}
|
||||
{product?.variants?.length > 0
|
||||
? product?.variants[0]?.price
|
||||
: product?.master_price}
|
||||
</th>
|
||||
<td className="text-start">
|
||||
<span className=""></span>
|
||||
@ -1247,6 +512,15 @@ const Products = () => {
|
||||
</tr>
|
||||
);
|
||||
})
|
||||
) : (
|
||||
!loading &&
|
||||
productsData?.length === 0 && (
|
||||
<tr className="text-center">
|
||||
<td colSpan="6">
|
||||
<h5>No Product Available...</h5>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -76,7 +76,6 @@ const ViewProduct = () => {
|
||||
<th>Name</th>
|
||||
<td>{productData?.name}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Product Group</th>
|
||||
<td>{productData?.category?.categoryName}</td>
|
||||
@ -99,15 +98,50 @@ const ViewProduct = () => {
|
||||
</td>
|
||||
</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>
|
||||
<th>Description</th>
|
||||
<td>{productData?.description}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<th>Special Instructions</th>
|
||||
<td>
|
||||
|
@ -506,34 +506,64 @@ function ViewOrders() {
|
||||
<div className="row">
|
||||
<div className="col-sm-6">
|
||||
<div
|
||||
className="d-flex justify-content-center mt-3 me-3 "
|
||||
className="d-flex justify-content-center mt-2 me-3 "
|
||||
style={{
|
||||
width: "6rem",
|
||||
}}
|
||||
>
|
||||
<span
|
||||
className="px-2 mt-1"
|
||||
style={{}}
|
||||
>
|
||||
<span className=" mt-1" style={{}}>
|
||||
{" "}
|
||||
Quantity:{" "}
|
||||
{productDetails?.quantity}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p className="m-0 mt-3 ms-3">
|
||||
{productDetails?.variant_Name ? (
|
||||
<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> ₹
|
||||
{productDetails?.product_Subtotal}
|
||||
</p>
|
||||
</div>
|
||||
<div className="col-sm-6">
|
||||
<p className="m-0 mt-3">
|
||||
<stong> Price:</stong> ₹
|
||||
{productDetails?.price}
|
||||
<p className="m-0 mt-1">
|
||||
<stong>
|
||||
{productDetails?.variant_Name
|
||||
? "Price:"
|
||||
: "Master Price"}
|
||||
</stong>{" "}
|
||||
₹{productDetails?.price}
|
||||
</p>
|
||||
<p className="m-0 mt-3">
|
||||
<stong> GST:</stong> ₹
|
||||
{productDetails?.gst_amount}
|
||||
{productDetails?.gst_rate && (
|
||||
<p className="m-0 mt-1">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@ -547,8 +577,10 @@ function ViewOrders() {
|
||||
<small className="mb-4">Shipping Charge: </small> ₹
|
||||
{orderDetails?.shipping_charge}
|
||||
<br />
|
||||
<span className="mt-2"> Total Order Value: </span> ₹
|
||||
{orderDetails?.total_amount}
|
||||
<h6 className="mt-2">
|
||||
{" "}
|
||||
Total Order Value: ₹{orderDetails?.total_amount}
|
||||
</h6>{" "}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user