diff --git a/src/_nav.js b/src/_nav.js
index bcd0619..275b9d4 100644
--- a/src/_nav.js
+++ b/src/_nav.js
@@ -8,6 +8,7 @@ import {
cilCursor,
cilDescription,
cilDrop,
+ cilFile,
cilNotes,
cilPaperPlane,
cilPencil,
@@ -43,6 +44,12 @@ const _nav = [
to: '/orders-placed',
icon: ,
},
+ {
+ component: CNavItem,
+ name: 'Product manual',
+ to: '/product-manual',
+ icon: ,
+ },
// {
// component: CNavItem,
diff --git a/src/routes.js b/src/routes.js
index 9ed04ac..9b69e9f 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -3,6 +3,8 @@ import React from 'react'
import Cart from './views/pages/cart/cart'
import OrderDetails from './views/orders/OrderDetails'
+import ProductManual from './views/pages/productManual/productManual'
+import ViewProductManual from './views/pages/productManual/viewProductManual'
const Dashboard = React.lazy(() => import('./views/dashboard/Dashboard'))
const Shop = React.lazy(() => import('./views/shops/Shop'))
@@ -18,9 +20,13 @@ const routes = [
{ path: '/shop', name: 'Shop', element: Shop },
{ path: '/orders-placed', name: 'Order', element: Order },
{ path: '/orders-placed/:id', name: 'Order', element: OrderDetails },
+
// KYC
{ path: '/kyc', name: 'KYC', element: Kyc },
{ path: '/kyc/details/:id', name: 'Kyc details', element: KycDetails },
+ // Product manual
+ { path: '/product-manual', name: 'Product Manual ', element: ProductManual },
+ { path: '/product-manual/:id', name: 'Product Manual ', element: ViewProductManual },
{ path: '/my-profile', name: 'Profile', element: MyProfile },
{ path: '/change-password', name: 'Change password', element: ChangePassword },
diff --git a/src/views/dashboard/Dashboard.js b/src/views/dashboard/Dashboard.js
index a194772..2f886f1 100644
--- a/src/views/dashboard/Dashboard.js
+++ b/src/views/dashboard/Dashboard.js
@@ -1,10 +1,80 @@
-import React from 'react'
-
+import { Box, Typography, Card, CardContent, Grid } from '@mui/material'
+import React, { useState, useEffect } from 'react'
+import Axios from '../../axios'
+import AddShoppingCartIcon from '@mui/icons-material/AddShoppingCart'
+import LocalShippingIcon from '@mui/icons-material/LocalShipping'
+import CancelIcon from '@mui/icons-material/Cancel'
+import HourglassEmptyIcon from '@mui/icons-material/HourglassEmpty'
+import CheckCircleIcon from '@mui/icons-material/CheckCircle'
const Dashboard = () => {
+ const [counts, setCounts] = useState({
+ new: 0,
+ dispatched: 0,
+ cancelled: 0,
+ processing: 0,
+ delivered: 0,
+ })
+
+ // Fetch counts on component mount
+ useEffect(() => {
+ const getCounts = async () => {
+ try {
+ const res = await Axios.get('/api/get-counts-pdOrders') // Updated API endpoint
+ if (res.status === 200) {
+ console.log('res', res)
+ setCounts(res.data.counts) // Assuming the response is in the format { new, dispatched, cancelled, processing, delivered }
+ }
+ } catch (error) {
+ console.error('Failed to fetch status counts:', error)
+ }
+ }
+ getCounts()
+ }, [])
+
+ // Define colors for different statuses
+ const statusColors = {
+ new: '#4caf50', // Green
+ dispatched: '#2196f3', // Blue
+ cancelled: '#f44336', // Red
+ processing: '#ff9800', // Orange
+ delivered: '#9c27b0', // Purple
+ }
+ const statusIcons = {
+ new: ,
+ dispatched: ,
+ cancelled: ,
+ processing: ,
+ delivered: ,
+ }
+
return (
- <>
-
Dashboard
- >
+
+
+ Orders Status Summary
+
+
+
+ {Object.keys(counts).map((status) => (
+
+
+
+
+
+ {status.charAt(0).toUpperCase() + status.slice(1)}
+
+
+ {counts[status]}
+
+
+ {statusIcons[status]} {/* Display the corresponding icon */}
+
+
+
+ ))}
+
+
)
}
diff --git a/src/views/orders/Order.js b/src/views/orders/Order.js
index 612160c..c75f44a 100644
--- a/src/views/orders/Order.js
+++ b/src/views/orders/Order.js
@@ -37,6 +37,11 @@ const Order = () => {
return strTime
}
+ // Helper function to capitalize the first letter of a string
+ const capitalizeFirstLetter = (string) => {
+ return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase()
+ }
+
useEffect(() => {
// Fetch orders from the API with pagination
const fetchOrders = async () => {
@@ -81,13 +86,13 @@ const Order = () => {
-
- Order ID
- Order Date
- Items
- Order Value
- Status
- Action
+
+ Order ID
+ Order Date
+ Items
+ Order Value
+ Status
+ Action
@@ -104,12 +109,18 @@ const Order = () => {
{order.uniqueId}
- {new Date(`${order?.createdAt}`).toDateString()}
- , {`${formatAMPM(order?.createdAt)}`}
+ {new Date(order?.createdAt)
+ .toLocaleDateString('en-US', {
+ year: 'numeric',
+ month: 'short',
+ day: 'numeric',
+ })
+ .replace(',', '')}{' '}
+ , {`${formatAMPM(order?.createdAt)}`}
{order.orderItem.length}
{order.grandTotal.toFixed(2)}
- {order.status}
+ {capitalizeFirstLetter(order.status)}