diff --git a/assets/icons/couriericon.svg b/assets/icons/couriericon.svg new file mode 100644 index 0000000..26bfd21 --- /dev/null +++ b/assets/icons/couriericon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/icons/courierserviceicon.svg b/assets/icons/courierserviceicon.svg new file mode 100644 index 0000000..0047f95 --- /dev/null +++ b/assets/icons/courierserviceicon.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/icons/orderitemsicon.svg b/assets/icons/orderitemsicon.svg new file mode 100644 index 0000000..bcb55f4 --- /dev/null +++ b/assets/icons/orderitemsicon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/icons/purchaseordericon.svg b/assets/icons/purchaseordericon.svg index 237395f..db04b34 100644 --- a/assets/icons/purchaseordericon.svg +++ b/assets/icons/purchaseordericon.svg @@ -1,11 +1,13 @@ - + + + diff --git a/assets/icons/salesordericon.svg b/assets/icons/salesordericon.svg new file mode 100644 index 0000000..c1bea56 --- /dev/null +++ b/assets/icons/salesordericon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/components/Dashboard/Developer/DeveloperSidebar.jsx b/src/components/Dashboard/Developer/DeveloperSidebar.jsx index 244af1b..5c7fe04 100644 --- a/src/components/Dashboard/Developer/DeveloperSidebar.jsx +++ b/src/components/Dashboard/Developer/DeveloperSidebar.jsx @@ -34,9 +34,15 @@ const routeKeyMap = { const DeveloperSidebar = (props) => { const location = useLocation() const selectedKey = (() => { - const match = Object.keys(routeKeyMap).find((path) => - location.pathname.startsWith(path) - ) + const match = Object.keys(routeKeyMap).find((path) => { + const pathSplit = path.split('/') + const locationPathSplit = location.pathname.split('/') + if (pathSplit.length > locationPathSplit.length) return false + for (let i = 0; i < pathSplit.length; i++) { + if (pathSplit[i] !== locationPathSplit[i]) return false + } + return true + }) return match ? routeKeyMap[match] : 'sessionstorage' })() diff --git a/src/components/Dashboard/Inventory/InventorySidebar.jsx b/src/components/Dashboard/Inventory/InventorySidebar.jsx index db8ea3c..f222a65 100644 --- a/src/components/Dashboard/Inventory/InventorySidebar.jsx +++ b/src/components/Dashboard/Inventory/InventorySidebar.jsx @@ -6,6 +6,7 @@ import PartStockIcon from '../../Icons/PartStockIcon' import ProductStockIcon from '../../Icons/ProductStockIcon' import StockEventIcon from '../../Icons/StockEventIcon' import StockAuditIcon from '../../Icons/StockAuditIcon' +import PurchaseOrderIcon from '../../Icons/PurchaseOrderIcon' const items = [ { @@ -34,6 +35,13 @@ const items = [ path: '/dashboard/inventory/productstocks' }, { type: 'divider' }, + { + key: 'purchaseorders', + label: 'Purchase Orders', + icon: , + path: '/dashboard/inventory/purchaseorders' + }, + { type: 'divider' }, { key: 'stockevents', label: 'Stock Events', @@ -54,16 +62,23 @@ const routeKeyMap = { '/dashboard/inventory/partstocks': 'partstocks', '/dashboard/inventory/productstocks': 'productstocks', '/dashboard/inventory/stockevents': 'stockevents', - '/dashboard/inventory/stockaudits': 'stockaudits' + '/dashboard/inventory/stockaudits': 'stockaudits', + '/dashboard/inventory/purchaseorders': 'purchaseorders' } const InventorySidebar = (props) => { const location = useLocation() const selectedKey = (() => { - const match = Object.keys(routeKeyMap).find((path) => - location.pathname.startsWith(path) - ) - return match ? routeKeyMap[match] : 'filaments' + const match = Object.keys(routeKeyMap).find((path) => { + const pathSplit = path.split('/') + const locationPathSplit = location.pathname.split('/') + if (pathSplit.length > locationPathSplit.length) return false + for (let i = 0; i < pathSplit.length; i++) { + if (pathSplit[i] !== locationPathSplit[i]) return false + } + return true + }) + return match ? routeKeyMap[match] : 'overview' })() return diff --git a/src/components/Dashboard/Inventory/PurchaseOrders.jsx b/src/components/Dashboard/Inventory/PurchaseOrders.jsx new file mode 100644 index 0000000..25e5977 --- /dev/null +++ b/src/components/Dashboard/Inventory/PurchaseOrders.jsx @@ -0,0 +1,101 @@ +import { useState, useRef } from 'react' +import { Button, Flex, Space, Modal, Dropdown, message } from 'antd' +import NewPurchaseOrder from './PurchaseOrders/NewPurchaseOrder' +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 PurchaseOrders = () => { + const [messageApi, contextHolder] = message.useMessage() + const [newPurchaseOrderOpen, setNewPurchaseOrderOpen] = useState(false) + const tableRef = useRef() + + const [viewMode, setViewMode] = useViewMode('purchaseOrders') + + const [columnVisibility, setColumnVisibility] = + useColumnVisibility('purchaseOrders') + + const actionItems = { + items: [ + { + label: 'New Purchase Order', + key: 'newPurchaseOrder', + icon: + }, + { type: 'divider' }, + { + label: 'Reload List', + key: 'reloadList', + icon: + } + ], + onClick: ({ key }) => { + if (key === 'reloadList') { + tableRef.current?.reload() + } else if (key === 'newPurchaseOrder') { + setNewPurchaseOrderOpen(true) + } + } + } + + return ( + <> + + {contextHolder} + + + + + + + + + + + + + + + + + + +