From ca7ab55d1e9b0b4d2acca36aea33bb9751cada59 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sat, 27 Dec 2025 20:46:45 +0000 Subject: [PATCH] Add sales module with client and sales order management features - Introduced new SVG icons for client and sales order. - Implemented SalesRoutes for navigation. - Created components for managing clients and sales orders, including overview, client info, and order details. - Added functionality for creating, editing, and canceling sales orders. - Integrated sales statistics and actions within the dashboard layout. --- assets/icons/clienticon.svg | 13 + assets/icons/listingicon.svg | 16 + assets/icons/salesicon.svg | 7 + src/App.jsx | 2 + src/components/Dashboard/Layout.jsx | 4 + src/components/Dashboard/Sales/Clients.jsx | 95 ++++ .../Dashboard/Sales/Clients/ClientInfo.jsx | 194 ++++++++ .../Dashboard/Sales/Clients/NewClient.jsx | 87 ++++ .../Dashboard/Sales/SalesOrders.jsx | 99 ++++ .../Sales/SalesOrders/CancelSalesOrder.jsx | 47 ++ .../Sales/SalesOrders/ConfirmSalesOrder.jsx | 47 ++ .../Sales/SalesOrders/NewSalesOrder.jsx | 90 ++++ .../Sales/SalesOrders/PostSalesOrder.jsx | 47 ++ .../Sales/SalesOrders/SalesOrderInfo.jsx | 440 ++++++++++++++++++ .../Dashboard/Sales/SalesOverview.jsx | 61 +++ .../Dashboard/Sales/SalesSidebar.jsx | 54 +++ .../Dashboard/common/DashboardBreadcrumb.jsx | 1 + .../Dashboard/common/DashboardNavigation.jsx | 8 + src/components/Icons/ClientIcon.jsx | 6 + src/components/Icons/SalesIcon.jsx | 6 + src/components/Icons/SalesOrderIcon.jsx | 6 + src/database/ObjectModels.js | 10 +- src/database/models/Client.js | 215 +++++++++ src/database/models/SalesOrder.js | 337 ++++++++++++++ src/routes/SalesRoutes.jsx | 41 ++ src/routes/index.js | 1 + 26 files changed, 1932 insertions(+), 2 deletions(-) create mode 100644 assets/icons/clienticon.svg create mode 100644 assets/icons/listingicon.svg create mode 100644 assets/icons/salesicon.svg create mode 100644 src/components/Dashboard/Sales/Clients.jsx create mode 100644 src/components/Dashboard/Sales/Clients/ClientInfo.jsx create mode 100644 src/components/Dashboard/Sales/Clients/NewClient.jsx create mode 100644 src/components/Dashboard/Sales/SalesOrders.jsx create mode 100644 src/components/Dashboard/Sales/SalesOrders/CancelSalesOrder.jsx create mode 100644 src/components/Dashboard/Sales/SalesOrders/ConfirmSalesOrder.jsx create mode 100644 src/components/Dashboard/Sales/SalesOrders/NewSalesOrder.jsx create mode 100644 src/components/Dashboard/Sales/SalesOrders/PostSalesOrder.jsx create mode 100644 src/components/Dashboard/Sales/SalesOrders/SalesOrderInfo.jsx create mode 100644 src/components/Dashboard/Sales/SalesOverview.jsx create mode 100644 src/components/Dashboard/Sales/SalesSidebar.jsx create mode 100644 src/components/Icons/ClientIcon.jsx create mode 100644 src/components/Icons/SalesIcon.jsx create mode 100644 src/components/Icons/SalesOrderIcon.jsx create mode 100644 src/database/models/Client.js create mode 100644 src/database/models/SalesOrder.js create mode 100644 src/routes/SalesRoutes.jsx diff --git a/assets/icons/clienticon.svg b/assets/icons/clienticon.svg new file mode 100644 index 0000000..cbf4d00 --- /dev/null +++ b/assets/icons/clienticon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/icons/listingicon.svg b/assets/icons/listingicon.svg new file mode 100644 index 0000000..25fc30b --- /dev/null +++ b/assets/icons/listingicon.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/icons/salesicon.svg b/assets/icons/salesicon.svg new file mode 100644 index 0000000..01207be --- /dev/null +++ b/assets/icons/salesicon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/App.jsx b/src/App.jsx index fbee6a5..a4fcfc6 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -32,6 +32,7 @@ import { ProductionRoutes, InventoryRoutes, FinanceRoutes, + SalesRoutes, ManagementRoutes, DeveloperRoutes } from './routes' @@ -98,6 +99,7 @@ const AppContent = () => { {ProductionRoutes} {InventoryRoutes} {FinanceRoutes} + {SalesRoutes} {ManagementRoutes} {DeveloperRoutes} diff --git a/src/components/Dashboard/Layout.jsx b/src/components/Dashboard/Layout.jsx index 54f1d8f..56160aa 100644 --- a/src/components/Dashboard/Layout.jsx +++ b/src/components/Dashboard/Layout.jsx @@ -5,6 +5,7 @@ import { useLocation } from 'react-router-dom' import ProductionSidebar from './Production/ProductionSidebar' import InventorySidebar from './Inventory/InventorySidebar' import FinanceSidebar from './Finance/FinanceSidebar' +import SalesSidebar from './Sales/SalesSidebar' import ManagementSidebar from './Management/ManagementSidebar' import DashboardNavigation from './common/DashboardNavigation' import DashboardBreadcrumb from './common/DashboardBreadcrumb' @@ -19,6 +20,7 @@ const DashboardLayout = ({ children }) => { const isProduction = location.pathname.startsWith('/dashboard/production') const isInventory = location.pathname.startsWith('/dashboard/inventory') const isFinance = location.pathname.startsWith('/dashboard/finance') + const isSales = location.pathname.startsWith('/dashboard/sales') const isManagement = location.pathname.startsWith('/dashboard/management') const isDeveloper = location.pathname.startsWith('/dashboard/developer') @@ -38,6 +40,8 @@ const DashboardLayout = ({ children }) => { ) : isFinance ? ( + ) : isSales ? ( + ) : isManagement ? ( ) : isDeveloper ? ( diff --git a/src/components/Dashboard/Sales/Clients.jsx b/src/components/Dashboard/Sales/Clients.jsx new file mode 100644 index 0000000..49c799f --- /dev/null +++ b/src/components/Dashboard/Sales/Clients.jsx @@ -0,0 +1,95 @@ +import { useState, useRef } from 'react' +import { Button, Flex, Space, Modal, Dropdown } from 'antd' +import NewClient from './Clients/NewClient' +import ObjectTable from '../common/ObjectTable' +import PlusIcon from '../../Icons/PlusIcon' +import ReloadIcon from '../../Icons/ReloadIcon' +import useColumnVisibility from '../hooks/useColumnVisibility' +import GridIcon from '../../Icons/GridIcon' +import ListIcon from '../../Icons/ListIcon' +import useViewMode from '../hooks/useViewMode' +import ColumnViewButton from '../common/ColumnViewButton' + +const Clients = () => { + const [newClientOpen, setNewClientOpen] = useState(false) + const tableRef = useRef() + + const [viewMode, setViewMode] = useViewMode('client') + + const [columnVisibility, setColumnVisibility] = useColumnVisibility('client') + + const actionItems = { + items: [ + { + label: 'New Client', + key: 'newClient', + icon: + }, + { type: 'divider' }, + { + label: 'Reload List', + key: 'reloadList', + icon: + } + ], + onClick: ({ key }) => { + if (key === 'reloadList') { + tableRef.current?.reload() + } else if (key === 'newClient') { + setNewClientOpen(true) + } + } + } + + return ( + <> + + + + + + + + + + + + + + +