Implemented new message context.
This commit is contained in:
parent
c6088361cd
commit
d7827ecb6d
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
|
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
|
|
||||||
import NewFilamentStock from './FilamentStocks/NewFilamentStock'
|
import NewFilamentStock from './FilamentStocks/NewFilamentStock'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -15,7 +15,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const FilamentStocks = () => {
|
const FilamentStocks = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
const [newFilamentStockOpen, setNewFilamentStockOpen] = useState(false)
|
const [newFilamentStockOpen, setNewFilamentStockOpen] = useState(false)
|
||||||
@ -51,7 +50,6 @@ const FilamentStocks = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -94,7 +92,6 @@ const FilamentStocks = () => {
|
|||||||
<NewFilamentStock
|
<NewFilamentStock
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewFilamentStockOpen(false)
|
setNewFilamentStockOpen(false)
|
||||||
messageApi.success('New filament stock created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newFilamentStockOpen}
|
reset={newFilamentStockOpen}
|
||||||
|
|||||||
@ -51,9 +51,11 @@ const NewFilamentStock = ({ onOk, reset, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Filament Stock'
|
title='New Filament Stock'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewOrderItem from './OrderItems/NewOrderItem'
|
import NewOrderItem from './OrderItems/NewOrderItem'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const OrderItems = () => {
|
const OrderItems = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newOrderItemOpen, setNewOrderItemOpen] = useState(false)
|
const [newOrderItemOpen, setNewOrderItemOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ const OrderItems = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -88,7 +86,6 @@ const OrderItems = () => {
|
|||||||
<NewOrderItem
|
<NewOrderItem
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewOrderItemOpen(false)
|
setNewOrderItemOpen(false)
|
||||||
messageApi.success('New order item created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newOrderItemOpen}
|
reset={newOrderItemOpen}
|
||||||
|
|||||||
@ -79,9 +79,11 @@ const NewOrderItem = ({ onOk, reset, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Order Item'
|
title='New Order Item'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
|
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
|
|
||||||
import NewPartStock from './PartStocks/NewPartStock'
|
import NewPartStock from './PartStocks/NewPartStock'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -15,7 +15,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const PartStocks = () => {
|
const PartStocks = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
const [newPartStockOpen, setNewPartStockOpen] = useState(false)
|
const [newPartStockOpen, setNewPartStockOpen] = useState(false)
|
||||||
@ -51,7 +50,6 @@ const PartStocks = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -94,7 +92,6 @@ const PartStocks = () => {
|
|||||||
<NewPartStock
|
<NewPartStock
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewPartStockOpen(false)
|
setNewPartStockOpen(false)
|
||||||
messageApi.success('New part stock created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newPartStockOpen}
|
reset={newPartStockOpen}
|
||||||
|
|||||||
@ -51,9 +51,11 @@ const NewPartStock = ({ onOk, reset, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Part Stock'
|
title='New Part Stock'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewPurchaseOrder from './PurchaseOrders/NewPurchaseOrder'
|
import NewPurchaseOrder from './PurchaseOrders/NewPurchaseOrder'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const PurchaseOrders = () => {
|
const PurchaseOrders = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newPurchaseOrderOpen, setNewPurchaseOrderOpen] = useState(false)
|
const [newPurchaseOrderOpen, setNewPurchaseOrderOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ const PurchaseOrders = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -88,7 +86,6 @@ const PurchaseOrders = () => {
|
|||||||
<NewPurchaseOrder
|
<NewPurchaseOrder
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewPurchaseOrderOpen(false)
|
setNewPurchaseOrderOpen(false)
|
||||||
messageApi.success('New purchase order created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newPurchaseOrderOpen}
|
reset={newPurchaseOrderOpen}
|
||||||
|
|||||||
@ -70,9 +70,11 @@ const NewPurchaseOrder = ({ onOk, reset, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Purchase Order'
|
title='New Purchase Order'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewShipment from './Shipments/NewShipment'
|
import NewShipment from './Shipments/NewShipment'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const Shipments = () => {
|
const Shipments = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newShipmentOpen, setNewShipmentOpen] = useState(false)
|
const [newShipmentOpen, setNewShipmentOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ const Shipments = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -88,7 +86,6 @@ const Shipments = () => {
|
|||||||
<NewShipment
|
<NewShipment
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewShipmentOpen(false)
|
setNewShipmentOpen(false)
|
||||||
messageApi.success('New shipment created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newShipmentOpen}
|
reset={newShipmentOpen}
|
||||||
|
|||||||
@ -74,9 +74,11 @@ const NewShipment = ({ onOk, reset, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Shipment'
|
title='New Shipment'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
|
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
|
|
||||||
import NewStockAudit from './StockAudits/NewStockAudit'
|
import NewStockAudit from './StockAudits/NewStockAudit'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -15,7 +15,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const StockAudits = () => {
|
const StockAudits = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
const [newStockAuditOpen, setNewStockAuditOpen] = useState(false)
|
const [newStockAuditOpen, setNewStockAuditOpen] = useState(false)
|
||||||
@ -51,7 +50,6 @@ const StockAudits = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -94,7 +92,6 @@ const StockAudits = () => {
|
|||||||
<NewStockAudit
|
<NewStockAudit
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewStockAuditOpen(false)
|
setNewStockAuditOpen(false)
|
||||||
messageApi.success('New stock audit created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newStockAuditOpen}
|
reset={newStockAuditOpen}
|
||||||
|
|||||||
@ -51,9 +51,11 @@ const NewStockAudit = ({ onOk, reset, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Stock Audit'
|
title='New Stock Audit'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import DashboardNavigation from './common/DashboardNavigation'
|
|||||||
import DashboardBreadcrumb from './common/DashboardBreadcrumb'
|
import DashboardBreadcrumb from './common/DashboardBreadcrumb'
|
||||||
import DeveloperSidebar from './Developer/DeveloperSidebar'
|
import DeveloperSidebar from './Developer/DeveloperSidebar'
|
||||||
import { useThemeContext } from './context/ThemeContext'
|
import { useThemeContext } from './context/ThemeContext'
|
||||||
|
import { MessageProvider } from './context/MessageContext'
|
||||||
|
|
||||||
const { Content } = Layout
|
const { Content } = Layout
|
||||||
|
|
||||||
@ -22,36 +23,38 @@ const DashboardLayout = ({ children }) => {
|
|||||||
const { isDarkMode } = useThemeContext()
|
const { isDarkMode } = useThemeContext()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout
|
<MessageProvider>
|
||||||
style={{ height: 'var(--unit-100vh)' }}
|
<Layout
|
||||||
className={isDarkMode ? 'dark-mode' : 'light-mode'}
|
style={{ height: 'var(--unit-100vh)' }}
|
||||||
>
|
className={isDarkMode ? 'dark-mode' : 'light-mode'}
|
||||||
<DashboardNavigation />
|
>
|
||||||
<Layout>
|
<DashboardNavigation />
|
||||||
{isProduction ? (
|
<Layout>
|
||||||
<ProductionSidebar />
|
{isProduction ? (
|
||||||
) : isInventory ? (
|
<ProductionSidebar />
|
||||||
<InventorySidebar />
|
) : isInventory ? (
|
||||||
) : isManagement ? (
|
<InventorySidebar />
|
||||||
<ManagementSidebar />
|
) : isManagement ? (
|
||||||
) : isDeveloper ? (
|
<ManagementSidebar />
|
||||||
<DeveloperSidebar />
|
) : isDeveloper ? (
|
||||||
) : (
|
<DeveloperSidebar />
|
||||||
<ProductionSidebar /> // Default to production sidebar
|
) : (
|
||||||
)}
|
<ProductionSidebar /> // Default to production sidebar
|
||||||
<Layout style={{ padding: '24px' }}>
|
)}
|
||||||
<Content>
|
<Layout style={{ padding: '24px' }}>
|
||||||
<Flex vertical style={{ height: '100%' }} gap='20px'>
|
<Content>
|
||||||
<Flex justify='space-between'>
|
<Flex vertical style={{ height: '100%' }} gap='20px'>
|
||||||
<DashboardBreadcrumb style={{ margin: '16px 0' }} />
|
<Flex justify='space-between'>
|
||||||
</Flex>
|
<DashboardBreadcrumb style={{ margin: '16px 0' }} />
|
||||||
|
</Flex>
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Content>
|
</Content>
|
||||||
|
</Layout>
|
||||||
</Layout>
|
</Layout>
|
||||||
</Layout>
|
</Layout>
|
||||||
</Layout>
|
</MessageProvider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewCourierService from './CourierServices/NewCourierService'
|
import NewCourierService from './CourierServices/NewCourierService'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const CourierServices = () => {
|
const CourierServices = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newCourierServiceOpen, setNewCourierServiceOpen] = useState(false)
|
const [newCourierServiceOpen, setNewCourierServiceOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ const CourierServices = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -85,7 +83,6 @@ const CourierServices = () => {
|
|||||||
<NewCourierService
|
<NewCourierService
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewCourierServiceOpen(false)
|
setNewCourierServiceOpen(false)
|
||||||
messageApi.success('New courier service created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={!newCourierServiceOpen}
|
reset={!newCourierServiceOpen}
|
||||||
|
|||||||
@ -68,9 +68,11 @@ const NewCourierService = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Courier Service'
|
title='New Courier Service'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewCourier from './Couriers/NewCourier'
|
import NewCourier from './Couriers/NewCourier'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const Couriers = () => {
|
const Couriers = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newCourierOpen, setNewCourierOpen] = useState(false)
|
const [newCourierOpen, setNewCourierOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -45,7 +44,6 @@ const Couriers = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -84,7 +82,6 @@ const Couriers = () => {
|
|||||||
<NewCourier
|
<NewCourier
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewCourierOpen(false)
|
setNewCourierOpen(false)
|
||||||
messageApi.success('New courier created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={!newCourierOpen}
|
reset={!newCourierOpen}
|
||||||
|
|||||||
@ -61,9 +61,11 @@ const NewCourier = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Courier'
|
title='New Courier'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewDocumentJob from './DocumentJobs/NewDocumentJob'
|
import NewDocumentJob from './DocumentJobs/NewDocumentJob'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const DocumentJobs = () => {
|
const DocumentJobs = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newDocumentJobOpen, setNewDocumentJobOpen] = useState(false)
|
const [newDocumentJobOpen, setNewDocumentJobOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ const DocumentJobs = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -85,7 +83,6 @@ const DocumentJobs = () => {
|
|||||||
<NewDocumentJob
|
<NewDocumentJob
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewDocumentJobOpen(false)
|
setNewDocumentJobOpen(false)
|
||||||
messageApi.success('New note type created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={!newDocumentJobOpen}
|
reset={!newDocumentJobOpen}
|
||||||
|
|||||||
@ -68,16 +68,18 @@ const NewDocumentJob = ({ onOk, defaultValues = {} }) => {
|
|||||||
}
|
}
|
||||||
onSubmit={async () => {
|
onSubmit={async () => {
|
||||||
const newDocumentJob = await handleSubmit()
|
const newDocumentJob = await handleSubmit()
|
||||||
await sendObjectAction(
|
if (newDocumentJob) {
|
||||||
newDocumentJob.documentPrinter._id,
|
await sendObjectAction(
|
||||||
'documentPrinter',
|
newDocumentJob.documentPrinter._id,
|
||||||
{
|
'documentPrinter',
|
||||||
type: 'deploy',
|
{
|
||||||
data: newDocumentJob
|
type: 'deploy',
|
||||||
|
data: newDocumentJob
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (onOk) {
|
||||||
|
onOk()
|
||||||
}
|
}
|
||||||
)
|
|
||||||
if (onOk) {
|
|
||||||
onOk()
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
actions={[
|
actions={[
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useRef, useState } from 'react'
|
import { useRef, useState } from 'react'
|
||||||
import { Button, Flex, Space, Dropdown, message, Modal } from 'antd'
|
import { Button, Flex, Space, Dropdown, Modal } from 'antd'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import ReloadIcon from '../../Icons/ReloadIcon'
|
import ReloadIcon from '../../Icons/ReloadIcon'
|
||||||
@ -11,7 +11,6 @@ import ColumnViewButton from '../common/ColumnViewButton'
|
|||||||
import NewDocumentPrinter from './DocumentPrinters/NewDocumentPrinter'
|
import NewDocumentPrinter from './DocumentPrinters/NewDocumentPrinter'
|
||||||
|
|
||||||
const DocumentPrinters = () => {
|
const DocumentPrinters = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
const [newDocumentPrinterOpen, setNewDocumentPrinterOpen] = useState(false)
|
const [newDocumentPrinterOpen, setNewDocumentPrinterOpen] = useState(false)
|
||||||
const [viewMode, setViewMode] = useViewMode('documentPrinter')
|
const [viewMode, setViewMode] = useViewMode('documentPrinter')
|
||||||
@ -45,7 +44,6 @@ const DocumentPrinters = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -84,7 +82,6 @@ const DocumentPrinters = () => {
|
|||||||
<NewDocumentPrinter
|
<NewDocumentPrinter
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewDocumentPrinterOpen(false)
|
setNewDocumentPrinterOpen(false)
|
||||||
messageApi.success('New note type created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={!newDocumentPrinterOpen}
|
reset={!newDocumentPrinterOpen}
|
||||||
|
|||||||
@ -66,9 +66,11 @@ const NewDocumentPrinter = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Document Printer'
|
title='New Document Printer'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewDocumentSize from './DocumentSizes/NewDocumentSize'
|
import NewDocumentSize from './DocumentSizes/NewDocumentSize'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const DocumentSizes = () => {
|
const DocumentSizes = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newDocumentSizeOpen, setNewDocumentSizeOpen] = useState(false)
|
const [newDocumentSizeOpen, setNewDocumentSizeOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
const [viewMode, setViewMode] = useViewMode('documentSize')
|
const [viewMode, setViewMode] = useViewMode('documentSize')
|
||||||
@ -44,7 +43,6 @@ const DocumentSizes = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -83,7 +81,6 @@ const DocumentSizes = () => {
|
|||||||
<NewDocumentSize
|
<NewDocumentSize
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewDocumentSizeOpen(false)
|
setNewDocumentSizeOpen(false)
|
||||||
messageApi.success('New document size created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={!newDocumentSizeOpen}
|
reset={!newDocumentSizeOpen}
|
||||||
|
|||||||
@ -47,9 +47,11 @@ const NewDocumentSize = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Document Size'
|
title='New Document Size'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewDocumentTemplate from './DocumentTemplates/NewDocumentTemplate'
|
import NewDocumentTemplate from './DocumentTemplates/NewDocumentTemplate'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const DocumentTemplates = () => {
|
const DocumentTemplates = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newDocumentTemplateOpen, setNewDocumentTemplateOpen] = useState(false)
|
const [newDocumentTemplateOpen, setNewDocumentTemplateOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ const DocumentTemplates = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -85,7 +83,6 @@ const DocumentTemplates = () => {
|
|||||||
<NewDocumentTemplate
|
<NewDocumentTemplate
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewDocumentTemplateOpen(false)
|
setNewDocumentTemplateOpen(false)
|
||||||
messageApi.success('New note type created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={!newDocumentTemplateOpen}
|
reset={!newDocumentTemplateOpen}
|
||||||
|
|||||||
@ -66,9 +66,11 @@ const NewDocumentTemplate = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Document Template'
|
title='New Document Template'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// src/filaments.js
|
// src/filaments.js
|
||||||
|
|
||||||
import { useRef, useState } from 'react'
|
import { useRef, useState } from 'react'
|
||||||
import { Button, Flex, Space, Modal, message, Dropdown } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
|
|
||||||
import NewFilament from './Filaments/NewFilament'
|
import NewFilament from './Filaments/NewFilament'
|
||||||
|
|
||||||
@ -15,7 +15,6 @@ import GridIcon from '../../Icons/GridIcon'
|
|||||||
import useViewMode from '../hooks/useViewMode'
|
import useViewMode from '../hooks/useViewMode'
|
||||||
|
|
||||||
const Filaments = () => {
|
const Filaments = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newFilamentOpen, setNewFilamentOpen] = useState(false)
|
const [newFilamentOpen, setNewFilamentOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -51,7 +50,6 @@ const Filaments = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space>
|
<Space>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -92,7 +90,6 @@ const Filaments = () => {
|
|||||||
<NewFilament
|
<NewFilament
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewFilamentOpen(false)
|
setNewFilamentOpen(false)
|
||||||
messageApi.success('New filament added successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newFilamentOpen}
|
reset={newFilamentOpen}
|
||||||
|
|||||||
@ -61,9 +61,11 @@ const NewFilament = ({ onOk }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Filament'
|
title='New Filament'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// src/hosts.js
|
// src/hosts.js
|
||||||
|
|
||||||
import { useRef, useState } from 'react'
|
import { useRef, useState } from 'react'
|
||||||
import { Button, Flex, Space, Modal, message, Dropdown } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
|
|
||||||
import NewHost from './Hosts/NewHost'
|
import NewHost from './Hosts/NewHost'
|
||||||
|
|
||||||
@ -15,7 +15,6 @@ import GridIcon from '../../Icons/GridIcon'
|
|||||||
import useViewMode from '../hooks/useViewMode'
|
import useViewMode from '../hooks/useViewMode'
|
||||||
|
|
||||||
const Hosts = () => {
|
const Hosts = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newHostOpen, setNewHostOpen] = useState(false)
|
const [newHostOpen, setNewHostOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -50,7 +49,6 @@ const Hosts = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space>
|
<Space>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -91,7 +89,6 @@ const Hosts = () => {
|
|||||||
<NewHost
|
<NewHost
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewHostOpen(false)
|
setNewHostOpen(false)
|
||||||
messageApi.success('New host added successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newHostOpen}
|
reset={newHostOpen}
|
||||||
|
|||||||
@ -94,9 +94,11 @@ const NewHost = ({ onOk }) => {
|
|||||||
totalSteps={steps.length}
|
totalSteps={steps.length}
|
||||||
onPrevious={() => setCurrentStep((prev) => prev - 1)}
|
onPrevious={() => setCurrentStep((prev) => prev - 1)}
|
||||||
onNext={() => setCurrentStep((prev) => prev + 1)}
|
onNext={() => setCurrentStep((prev) => prev + 1)}
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
submitLoading={submitLoading}
|
submitLoading={submitLoading}
|
||||||
|
|||||||
@ -9,12 +9,12 @@ import {
|
|||||||
Flex,
|
Flex,
|
||||||
Space,
|
Space,
|
||||||
Modal,
|
Modal,
|
||||||
message,
|
|
||||||
Dropdown,
|
Dropdown,
|
||||||
Spin
|
Spin
|
||||||
} from 'antd'
|
} from 'antd'
|
||||||
import { createStyles } from 'antd-style'
|
import { createStyles } from 'antd-style'
|
||||||
import { LoadingOutlined } from '@ant-design/icons'
|
import { LoadingOutlined } from '@ant-design/icons'
|
||||||
|
import { useMessageContext } from '../context/MessageContext'
|
||||||
|
|
||||||
import { AuthContext } from '../context/AuthContext'
|
import { AuthContext } from '../context/AuthContext'
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ const useStyle = createStyles(({ css, token }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const Materials = () => {
|
const Materials = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
const { showError } = useMessageContext()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const { styles } = useStyle()
|
const { styles } = useStyle()
|
||||||
|
|
||||||
@ -87,12 +87,11 @@ const Materials = () => {
|
|||||||
setLazyLoading(false)
|
setLazyLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
messageApi.error(
|
showError(
|
||||||
'Error updating material details:',
|
`Error updating material details: ${error.response.status}`
|
||||||
error.response.status
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
messageApi.error(
|
showError(
|
||||||
'An unexpected error occurred. Please try again later.'
|
'An unexpected error occurred. Please try again later.'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -100,7 +99,7 @@ const Materials = () => {
|
|||||||
setLazyLoading(false)
|
setLazyLoading(false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[messageApi]
|
[showError]
|
||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -241,7 +240,6 @@ const Materials = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Space>
|
<Space>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
<Button>Actions</Button>
|
<Button>Actions</Button>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewNoteType from './NoteTypes/NewNoteType'
|
import NewNoteType from './NoteTypes/NewNoteType'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const NoteTypes = () => {
|
const NoteTypes = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newNoteTypeOpen, setNewNoteTypeOpen] = useState(false)
|
const [newNoteTypeOpen, setNewNoteTypeOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ const NoteTypes = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -85,7 +83,6 @@ const NoteTypes = () => {
|
|||||||
<NewNoteType
|
<NewNoteType
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewNoteTypeOpen(false)
|
setNewNoteTypeOpen(false)
|
||||||
messageApi.success('New note type created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={!newNoteTypeOpen}
|
reset={!newNoteTypeOpen}
|
||||||
|
|||||||
@ -66,9 +66,11 @@ const NewNoteType = ({ onOk }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Note Type'
|
title='New Note Type'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -31,9 +31,11 @@ const NewNote = ({ onOk, defaultValues = {} }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Note'
|
title='New Note'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
|
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import NewPart from './Parts/NewPart'
|
import NewPart from './Parts/NewPart'
|
||||||
|
|
||||||
@ -18,8 +18,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const Parts = (filter) => {
|
const Parts = (filter) => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
|
|
||||||
const [newPartOpen, setNewPartOpen] = useState(false)
|
const [newPartOpen, setNewPartOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
const [viewMode, setViewMode] = useViewMode('part')
|
const [viewMode, setViewMode] = useViewMode('part')
|
||||||
@ -51,7 +49,6 @@ const Parts = (filter) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -93,7 +90,6 @@ const Parts = (filter) => {
|
|||||||
<NewPart
|
<NewPart
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewPartOpen(false)
|
setNewPartOpen(false)
|
||||||
messageApi.success('Part created successfully!')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newPartOpen}
|
reset={newPartOpen}
|
||||||
|
|||||||
@ -103,9 +103,11 @@ const NewPart = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Part'
|
title='New Part'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import {
|
|||||||
Space,
|
Space,
|
||||||
Modal,
|
Modal,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
message,
|
|
||||||
Tag,
|
Tag,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Popover,
|
Popover,
|
||||||
@ -31,7 +30,6 @@ import ListIcon from '../../Icons/ListIcon'
|
|||||||
import useViewMode from '../hooks/useViewMode'
|
import useViewMode from '../hooks/useViewMode'
|
||||||
|
|
||||||
const Products = () => {
|
const Products = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const [newProductOpen, setNewProductOpen] = useState(false)
|
const [newProductOpen, setNewProductOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
@ -322,7 +320,6 @@ const Products = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -363,7 +360,6 @@ const Products = () => {
|
|||||||
<NewProduct
|
<NewProduct
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewProductOpen(false)
|
setNewProductOpen(false)
|
||||||
messageApi.success('Product created successfully!')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newProductOpen}
|
reset={newProductOpen}
|
||||||
|
|||||||
@ -88,9 +88,11 @@ const NewProduct = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Product'
|
title='New Product'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewTaxRate from './TaxRates/NewTaxRate'
|
import NewTaxRate from './TaxRates/NewTaxRate'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const TaxRates = () => {
|
const TaxRates = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newTaxRateOpen, setNewTaxRateOpen] = useState(false)
|
const [newTaxRateOpen, setNewTaxRateOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -45,7 +44,6 @@ const TaxRates = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -84,7 +82,6 @@ const TaxRates = () => {
|
|||||||
<NewTaxRate
|
<NewTaxRate
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewTaxRateOpen(false)
|
setNewTaxRateOpen(false)
|
||||||
messageApi.success('New tax rate created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={!newTaxRateOpen}
|
reset={!newTaxRateOpen}
|
||||||
|
|||||||
@ -61,9 +61,11 @@ const NewTaxRate = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Tax Rate'
|
title='New Tax Rate'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewTaxRecord from './TaxRecords/NewTaxRecord'
|
import NewTaxRecord from './TaxRecords/NewTaxRecord'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const TaxRecords = () => {
|
const TaxRecords = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newTaxRecordOpen, setNewTaxRecordOpen] = useState(false)
|
const [newTaxRecordOpen, setNewTaxRecordOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ const TaxRecords = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -85,7 +83,6 @@ const TaxRecords = () => {
|
|||||||
<NewTaxRecord
|
<NewTaxRecord
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewTaxRecordOpen(false)
|
setNewTaxRecordOpen(false)
|
||||||
messageApi.success('New tax record created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={!newTaxRecordOpen}
|
reset={!newTaxRecordOpen}
|
||||||
|
|||||||
@ -61,9 +61,11 @@ const NewTaxRecord = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Tax Record'
|
title='New Tax Record'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,18 +1,18 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { useState } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { useMediaQuery } from 'react-responsive'
|
import { useMediaQuery } from 'react-responsive'
|
||||||
import {
|
import {
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
Button,
|
Button,
|
||||||
message,
|
|
||||||
Typography,
|
Typography,
|
||||||
Flex,
|
Flex,
|
||||||
Steps,
|
Steps,
|
||||||
Descriptions,
|
Descriptions,
|
||||||
Divider
|
Divider
|
||||||
} from 'antd'
|
} from 'antd'
|
||||||
|
import { useMessageContext } from '../../context/MessageContext'
|
||||||
|
|
||||||
import config from '../../../../config'
|
import config from '../../../../config'
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ const initialNewUserForm = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const NewUser = ({ onOk, reset }) => {
|
const NewUser = ({ onOk, reset }) => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
const { showError } = useMessageContext()
|
||||||
const [newUserLoading, setNewUserLoading] = useState(false)
|
const [newUserLoading, setNewUserLoading] = useState(false)
|
||||||
const [currentStep, setCurrentStep] = useState(0)
|
const [currentStep, setCurrentStep] = useState(0)
|
||||||
const [nextEnabled, setNextEnabled] = useState(false)
|
const [nextEnabled, setNextEnabled] = useState(false)
|
||||||
@ -88,7 +88,7 @@ const NewUser = ({ onOk, reset }) => {
|
|||||||
})
|
})
|
||||||
onOk()
|
onOk()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
messageApi.error('Error creating new user: ' + error.message)
|
showError('Error creating new user: ' + error.message)
|
||||||
} finally {
|
} finally {
|
||||||
setNewUserLoading(false)
|
setNewUserLoading(false)
|
||||||
}
|
}
|
||||||
@ -181,8 +181,6 @@ const NewUser = ({ onOk, reset }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex gap='middle'>
|
<Flex gap='middle'>
|
||||||
{contextHolder}
|
|
||||||
|
|
||||||
{!isMobile && (
|
{!isMobile && (
|
||||||
<div style={{ minWidth: '160px' }}>
|
<div style={{ minWidth: '160px' }}>
|
||||||
<Steps
|
<Steps
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewVendor from './Vendors/NewVendor'
|
import NewVendor from './Vendors/NewVendor'
|
||||||
import ObjectTable from '../common/ObjectTable'
|
import ObjectTable from '../common/ObjectTable'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const Vendors = () => {
|
const Vendors = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newVendorOpen, setNewVendorOpen] = useState(false)
|
const [newVendorOpen, setNewVendorOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -45,7 +44,6 @@ const Vendors = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -84,7 +82,6 @@ const Vendors = () => {
|
|||||||
<NewVendor
|
<NewVendor
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewVendorOpen(false)
|
setNewVendorOpen(false)
|
||||||
messageApi.success('New vendor created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={!newVendorOpen}
|
reset={!newVendorOpen}
|
||||||
|
|||||||
@ -64,9 +64,11 @@ const NewVendor = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Vendor'
|
title='New Vendor'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// src/gcodefiles.js
|
// src/gcodefiles.js
|
||||||
|
|
||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewGCodeFile from './GCodeFiles/NewGCodeFile'
|
import NewGCodeFile from './GCodeFiles/NewGCodeFile'
|
||||||
import useColumnVisibility from '../hooks/useColumnVisibility'
|
import useColumnVisibility from '../hooks/useColumnVisibility'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
@ -14,7 +14,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton'
|
import ColumnViewButton from '../common/ColumnViewButton'
|
||||||
|
|
||||||
const GCodeFiles = () => {
|
const GCodeFiles = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newGCodeFileOpen, setNewGCodeFileOpen] = useState(false)
|
const [newGCodeFileOpen, setNewGCodeFileOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
const [viewMode, setViewMode] = useViewMode('gcodeFile')
|
const [viewMode, setViewMode] = useViewMode('gcodeFile')
|
||||||
@ -48,7 +47,6 @@ const GCodeFiles = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space>
|
<Space>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -89,7 +87,6 @@ const GCodeFiles = () => {
|
|||||||
<NewGCodeFile
|
<NewGCodeFile
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewGCodeFileOpen(false)
|
setNewGCodeFileOpen(false)
|
||||||
messageApi.success('Finished uploading GCode file!')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newGCodeFileOpen}
|
reset={newGCodeFileOpen}
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
import { useMessageContext } from '../../context/MessageContext'
|
||||||
import ObjectInfo from '../../common/ObjectInfo'
|
import ObjectInfo from '../../common/ObjectInfo'
|
||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewGCodeFile = ({ onOk, defaultValues }) => {
|
const NewGCodeFile = ({ onOk, defaultValues }) => {
|
||||||
|
const { showSuccess } = useMessageContext()
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'gcodeFile'}
|
type={'gcodeFile'}
|
||||||
@ -71,9 +73,12 @@ const NewGCodeFile = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New GCode File'
|
title='New GCode File'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
showSuccess('Finished uploading GCode file!')
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// src/Jobs.js
|
// src/Jobs.js
|
||||||
|
|
||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||||
import NewJob from './Jobs/NewJob.jsx'
|
import NewJob from './Jobs/NewJob.jsx'
|
||||||
import useColumnVisibility from '../hooks/useColumnVisibility.js'
|
import useColumnVisibility from '../hooks/useColumnVisibility.js'
|
||||||
import PlusIcon from '../../Icons/PlusIcon.jsx'
|
import PlusIcon from '../../Icons/PlusIcon.jsx'
|
||||||
@ -13,7 +13,6 @@ import useViewMode from '../hooks/useViewMode.js'
|
|||||||
import ColumnViewButton from '../common/ColumnViewButton.jsx'
|
import ColumnViewButton from '../common/ColumnViewButton.jsx'
|
||||||
|
|
||||||
const Jobs = () => {
|
const Jobs = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newJobOpen, setNewJobOpen] = useState(false)
|
const [newJobOpen, setNewJobOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
const [viewMode, setViewMode] = useViewMode('job')
|
const [viewMode, setViewMode] = useViewMode('job')
|
||||||
@ -50,7 +49,6 @@ const Jobs = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large' style={{ height: '100%' }}>
|
<Flex vertical={'true'} gap='large' style={{ height: '100%' }}>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -93,7 +91,6 @@ const Jobs = () => {
|
|||||||
<NewJob
|
<NewJob
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewJobOpen(false)
|
setNewJobOpen(false)
|
||||||
messageApi.success('New print job created successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newJobOpen}
|
reset={newJobOpen}
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
import { useMessageContext } from '../../context/MessageContext'
|
||||||
import ObjectInfo from '../../common/ObjectInfo'
|
import ObjectInfo from '../../common/ObjectInfo'
|
||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewJob = ({ onOk, defaultValues }) => {
|
const NewJob = ({ onOk, defaultValues }) => {
|
||||||
|
const { showSuccess } = useMessageContext()
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'job'}
|
type={'job'}
|
||||||
@ -58,9 +60,12 @@ const NewJob = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Job'
|
title='New Job'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
showSuccess('New job created successfully.')
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// src/Printers.js
|
// src/Printers.js
|
||||||
|
|
||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { Button, message, Dropdown, Space, Flex, Modal } from 'antd'
|
import { Button, Dropdown, Space, Flex, Modal } from 'antd'
|
||||||
import NewPrinter from './Printers/NewPrinter'
|
import NewPrinter from './Printers/NewPrinter'
|
||||||
import PlusIcon from '../../Icons/PlusIcon'
|
import PlusIcon from '../../Icons/PlusIcon'
|
||||||
import ReloadIcon from '../../Icons/ReloadIcon'
|
import ReloadIcon from '../../Icons/ReloadIcon'
|
||||||
@ -14,7 +14,6 @@ import useViewMode from '../hooks/useViewMode'
|
|||||||
import useColumnVisibility from '../hooks/useColumnVisibility'
|
import useColumnVisibility from '../hooks/useColumnVisibility'
|
||||||
|
|
||||||
const Printers = () => {
|
const Printers = () => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newPrinterOpen, setNewPrinterOpen] = useState(false)
|
const [newPrinterOpen, setNewPrinterOpen] = useState(false)
|
||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
@ -50,7 +49,6 @@ const Printers = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex vertical={'true'} gap='large'>
|
<Flex vertical={'true'} gap='large'>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
<Space>
|
<Space>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
@ -92,7 +90,6 @@ const Printers = () => {
|
|||||||
<NewPrinter
|
<NewPrinter
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewPrinterOpen(false)
|
setNewPrinterOpen(false)
|
||||||
messageApi.success('New printer added successfully.')
|
|
||||||
tableRef.current?.reload()
|
tableRef.current?.reload()
|
||||||
}}
|
}}
|
||||||
reset={newPrinterOpen}
|
reset={newPrinterOpen}
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
import { useMessageContext } from '../../context/MessageContext'
|
||||||
import ObjectInfo from '../../common/ObjectInfo'
|
import ObjectInfo from '../../common/ObjectInfo'
|
||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewPrinter = ({ onOk, defaultValues }) => {
|
const NewPrinter = ({ onOk, defaultValues }) => {
|
||||||
|
const { showSuccess } = useMessageContext()
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'printer'}
|
type={'printer'}
|
||||||
@ -93,9 +95,12 @@ const NewPrinter = ({ onOk, defaultValues }) => {
|
|||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
formValid={formValid}
|
formValid={formValid}
|
||||||
title='New Printer'
|
title='New Printer'
|
||||||
onSubmit={() => {
|
onSubmit={async () => {
|
||||||
handleSubmit()
|
const result = await handleSubmit()
|
||||||
onOk()
|
if (result) {
|
||||||
|
showSuccess('New printer added successfully.')
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Button, Tooltip, message } from 'antd'
|
import { Button, Tooltip } from 'antd'
|
||||||
|
import { useMessageContext } from '../context/MessageContext'
|
||||||
import CopyIcon from '../../Icons/CopyIcon'
|
import CopyIcon from '../../Icons/CopyIcon'
|
||||||
|
|
||||||
const CopyButton = ({
|
const CopyButton = ({
|
||||||
@ -8,17 +9,17 @@ const CopyButton = ({
|
|||||||
size = 'small',
|
size = 'small',
|
||||||
type = 'text'
|
type = 'text'
|
||||||
}) => {
|
}) => {
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
const { showSuccess, showError } = useMessageContext()
|
||||||
|
|
||||||
const doCopy = (copyText) => {
|
const doCopy = (copyText) => {
|
||||||
if (navigator && navigator.clipboard && navigator.clipboard.writeText) {
|
if (navigator && navigator.clipboard && navigator.clipboard.writeText) {
|
||||||
navigator.clipboard
|
navigator.clipboard
|
||||||
.writeText(copyText)
|
.writeText(copyText)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
messageApi.success('Copied to clipboard')
|
showSuccess('Copied to clipboard')
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
messageApi.error('Failed to copy')
|
showError('Failed to copy')
|
||||||
})
|
})
|
||||||
} else if (
|
} else if (
|
||||||
document.queryCommandSupported &&
|
document.queryCommandSupported &&
|
||||||
@ -34,21 +35,20 @@ const CopyButton = ({
|
|||||||
textarea.select()
|
textarea.select()
|
||||||
try {
|
try {
|
||||||
document.execCommand('copy')
|
document.execCommand('copy')
|
||||||
messageApi.success('Copied to clipboard')
|
showSuccess('Copied to clipboard')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
console.error(err)
|
console.error(err)
|
||||||
messageApi.error('Failed to copy')
|
showError('Failed to copy')
|
||||||
}
|
}
|
||||||
document.body.removeChild(textarea)
|
document.body.removeChild(textarea)
|
||||||
} else {
|
} else {
|
||||||
messageApi.error('Copy not supported in this browser')
|
showError('Copy not supported in this browser')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{contextHolder}
|
|
||||||
<Tooltip title={tooltip} arrow={false}>
|
<Tooltip title={tooltip} arrow={false}>
|
||||||
<Button
|
<Button
|
||||||
icon={<CopyIcon />}
|
icon={<CopyIcon />}
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import { Button, Dropdown, Modal } from 'antd'
|
|||||||
import { ApiServerContext } from '../context/ApiServerContext'
|
import { ApiServerContext } from '../context/ApiServerContext'
|
||||||
import DocumentTemplateIcon from '../../Icons/DocumentTemplateIcon'
|
import DocumentTemplateIcon from '../../Icons/DocumentTemplateIcon'
|
||||||
import NewDocumentJob from '../Management/DocumentJobs/NewDocumentJob'
|
import NewDocumentJob from '../Management/DocumentJobs/NewDocumentJob'
|
||||||
import { message } from 'antd'
|
|
||||||
import { AuthContext } from '../context/AuthContext'
|
import { AuthContext } from '../context/AuthContext'
|
||||||
|
|
||||||
const DocumentPrintButton = ({
|
const DocumentPrintButton = ({
|
||||||
@ -19,7 +18,6 @@ const DocumentPrintButton = ({
|
|||||||
const [documentTemplates, setDocumentTemplates] = useState([])
|
const [documentTemplates, setDocumentTemplates] = useState([])
|
||||||
const [currentDocumentTemplate, setCurrentDocumentTemplate] = useState(null)
|
const [currentDocumentTemplate, setCurrentDocumentTemplate] = useState(null)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [newDocumentJobOpen, setNewDocumentJobOpen] = useState(false)
|
const [newDocumentJobOpen, setNewDocumentJobOpen] = useState(false)
|
||||||
|
|
||||||
const { token } = useContext(AuthContext)
|
const { token } = useContext(AuthContext)
|
||||||
@ -86,7 +84,6 @@ const DocumentPrintButton = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{contextHolder}
|
|
||||||
<Dropdown
|
<Dropdown
|
||||||
menu={{
|
menu={{
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
@ -120,7 +117,6 @@ const DocumentPrintButton = ({
|
|||||||
<NewDocumentJob
|
<NewDocumentJob
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewDocumentJobOpen(false)
|
setNewDocumentJobOpen(false)
|
||||||
messageApi.success('New document job created successfully.')
|
|
||||||
}}
|
}}
|
||||||
reset={!newDocumentJobOpen}
|
reset={!newDocumentJobOpen}
|
||||||
defaultValues={{
|
defaultValues={{
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { useState, useEffect, useContext, useCallback } from 'react'
|
import { useState, useEffect, useContext, useCallback } from 'react'
|
||||||
import { Form, message } from 'antd'
|
import { Form } from 'antd'
|
||||||
import { ApiServerContext } from '../context/ApiServerContext'
|
import { ApiServerContext } from '../context/ApiServerContext'
|
||||||
|
import { useMessageContext } from '../context/MessageContext'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import merge from 'lodash/merge'
|
import merge from 'lodash/merge'
|
||||||
import set from 'lodash/set'
|
import set from 'lodash/set'
|
||||||
@ -35,7 +36,7 @@ const NewObjectForm = ({ type, style, defaultValues = {}, children }) => {
|
|||||||
const [formValid, setFormValid] = useState(false)
|
const [formValid, setFormValid] = useState(false)
|
||||||
const [form] = Form.useForm()
|
const [form] = Form.useForm()
|
||||||
const formUpdateValues = Form.useWatch([], form)
|
const formUpdateValues = Form.useWatch([], form)
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
const { showSuccess, showError: showMessageError } = useMessageContext()
|
||||||
const { createObject, showError } = useContext(ApiServerContext)
|
const { createObject, showError } = useContext(ApiServerContext)
|
||||||
|
|
||||||
// Get the model definition for this object type
|
// Get the model definition for this object type
|
||||||
@ -156,14 +157,14 @@ const NewObjectForm = ({ type, style, defaultValues = {}, children }) => {
|
|||||||
const computedValuesObject = buildObjectFromEntries(computedEntries)
|
const computedValuesObject = buildObjectFromEntries(computedEntries)
|
||||||
const computedObjectData = merge({}, objectData, computedValuesObject)
|
const computedObjectData = merge({}, objectData, computedValuesObject)
|
||||||
const newObject = await createObject(type, computedObjectData)
|
const newObject = await createObject(type, computedObjectData)
|
||||||
messageApi.success('Object created successfully')
|
showSuccess('Object created successfully')
|
||||||
return newObject
|
return newObject
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
if (err.errorFields) {
|
if (err.errorFields) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
messageApi.error('Failed to create object')
|
showMessageError('Failed to create object')
|
||||||
showError(
|
showError(
|
||||||
`Failed to create object. Message: ${err.message}. Code: ${err.code}`,
|
`Failed to create object. Message: ${err.message}. Code: ${err.code}`,
|
||||||
() => handleSubmit()
|
() => handleSubmit()
|
||||||
@ -208,7 +209,6 @@ const NewObjectForm = ({ type, style, defaultValues = {}, children }) => {
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{contextHolder}
|
|
||||||
{children({
|
{children({
|
||||||
submitLoading: submitLoading,
|
submitLoading: submitLoading,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
Modal,
|
Modal,
|
||||||
Spin,
|
Spin,
|
||||||
Alert,
|
Alert,
|
||||||
message,
|
|
||||||
Dropdown
|
Dropdown
|
||||||
} from 'antd'
|
} from 'antd'
|
||||||
import { LoadingOutlined } from '@ant-design/icons'
|
import { LoadingOutlined } from '@ant-design/icons'
|
||||||
@ -27,7 +26,6 @@ const NotesPanel = ({ _id, type }) => {
|
|||||||
const [newNoteOpen, setNewNoteOpen] = useState(false)
|
const [newNoteOpen, setNewNoteOpen] = useState(false)
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [initialized, setInitialized] = useState(false)
|
const [initialized, setInitialized] = useState(false)
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
|
||||||
const [error, setError] = useState(null)
|
const [error, setError] = useState(null)
|
||||||
const [notes, setNotes] = useState(null)
|
const [notes, setNotes] = useState(null)
|
||||||
const [expandedNotes, setExpandedNotes] = useState({})
|
const [expandedNotes, setExpandedNotes] = useState({})
|
||||||
@ -145,7 +143,6 @@ const NotesPanel = ({ _id, type }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex vertical gap='large' style={{ width: '100%' }}>
|
<Flex vertical gap='large' style={{ width: '100%' }}>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify='space-between'>
|
<Flex justify='space-between'>
|
||||||
<Space size={'small'}>
|
<Space size={'small'}>
|
||||||
<Dropdown menu={actionItems} disabled={loading}>
|
<Dropdown menu={actionItems} disabled={loading}>
|
||||||
@ -188,7 +185,6 @@ const NotesPanel = ({ _id, type }) => {
|
|||||||
<NewNote
|
<NewNote
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
setNewNoteOpen(false)
|
setNewNoteOpen(false)
|
||||||
messageApi.success('New note added.')
|
|
||||||
}}
|
}}
|
||||||
reset={newNoteOpen}
|
reset={newNoteOpen}
|
||||||
defaultValues={{
|
defaultValues={{
|
||||||
|
|||||||
@ -5,12 +5,12 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Empty,
|
Empty,
|
||||||
Spin,
|
Spin,
|
||||||
message,
|
|
||||||
Popconfirm,
|
Popconfirm,
|
||||||
Flex,
|
Flex,
|
||||||
Badge,
|
Badge,
|
||||||
Dropdown
|
Dropdown
|
||||||
} from 'antd'
|
} from 'antd'
|
||||||
|
import { useMessageContext } from '../context/MessageContext'
|
||||||
import {
|
import {
|
||||||
BellOutlined,
|
BellOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
@ -29,7 +29,7 @@ const NotificationCenter = ({ visible }) => {
|
|||||||
const [notifications, setNotifications] = useState([])
|
const [notifications, setNotifications] = useState([])
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
const { showSuccess, showError } = useMessageContext()
|
||||||
|
|
||||||
const { authenticated } = useContext(AuthContext)
|
const { authenticated } = useContext(AuthContext)
|
||||||
|
|
||||||
@ -47,11 +47,11 @@ const NotificationCenter = ({ visible }) => {
|
|||||||
setNotifications(response.data)
|
setNotifications(response.data)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching notifications:', error)
|
console.error('Error fetching notifications:', error)
|
||||||
messageApi.error('Failed to fetch notifications')
|
showError('Failed to fetch notifications')
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}, [authenticated, messageApi])
|
}, [authenticated, showError])
|
||||||
|
|
||||||
const markAsRead = useCallback(
|
const markAsRead = useCallback(
|
||||||
async (notificationId) => {
|
async (notificationId) => {
|
||||||
@ -77,13 +77,13 @@ const NotificationCenter = ({ visible }) => {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
messageApi.success('Notification marked as read')
|
showSuccess('Notification marked as read')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error marking notification as read:', error)
|
console.error('Error marking notification as read:', error)
|
||||||
messageApi.error('Failed to mark notification as read')
|
showError('Failed to mark notification as read')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[messageApi]
|
[showSuccess, showError]
|
||||||
)
|
)
|
||||||
|
|
||||||
const markAllAsRead = useCallback(async () => {
|
const markAllAsRead = useCallback(async () => {
|
||||||
@ -104,12 +104,12 @@ const NotificationCenter = ({ visible }) => {
|
|||||||
prev.map((notification) => ({ ...notification, read: true }))
|
prev.map((notification) => ({ ...notification, read: true }))
|
||||||
)
|
)
|
||||||
|
|
||||||
messageApi.success('All notifications marked as read')
|
showSuccess('All notifications marked as read')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error marking all notifications as read:', error)
|
console.error('Error marking all notifications as read:', error)
|
||||||
messageApi.error('Failed to mark all notifications as read')
|
showError('Failed to mark all notifications as read')
|
||||||
}
|
}
|
||||||
}, [messageApi])
|
}, [showSuccess, showError])
|
||||||
|
|
||||||
const deleteAllNotifications = useCallback(async () => {
|
const deleteAllNotifications = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
@ -121,14 +121,14 @@ const NotificationCenter = ({ visible }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
setNotifications([])
|
setNotifications([])
|
||||||
messageApi.success('All notifications deleted')
|
showSuccess('All notifications deleted')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error deleting all notifications:', error)
|
console.error('Error deleting all notifications:', error)
|
||||||
messageApi.error('Failed to delete all notifications')
|
showError('Failed to delete all notifications')
|
||||||
} finally {
|
} finally {
|
||||||
setShowDeleteConfirm(false)
|
setShowDeleteConfirm(false)
|
||||||
}
|
}
|
||||||
}, [messageApi])
|
}, [showSuccess, showError])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible && authenticated) {
|
if (visible && authenticated) {
|
||||||
@ -179,7 +179,6 @@ const NotificationCenter = ({ visible }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{contextHolder}
|
|
||||||
<Flex justify='space-between' align='center'>
|
<Flex justify='space-between' align='center'>
|
||||||
<Space size='middle'>
|
<Space size='middle'>
|
||||||
<Dropdown menu={actionItems}>
|
<Dropdown menu={actionItems}>
|
||||||
|
|||||||
@ -7,9 +7,10 @@ import {
|
|||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
useRef
|
useRef
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { Form, message } from 'antd'
|
import { Form } from 'antd'
|
||||||
import { ApiServerContext } from '../context/ApiServerContext'
|
import { ApiServerContext } from '../context/ApiServerContext'
|
||||||
import { AuthContext } from '../context/AuthContext'
|
import { AuthContext } from '../context/AuthContext'
|
||||||
|
import { useMessageContext } from '../context/MessageContext'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import DeleteObjectModal from './DeleteObjectModal'
|
import DeleteObjectModal from './DeleteObjectModal'
|
||||||
import merge from 'lodash/merge'
|
import merge from 'lodash/merge'
|
||||||
@ -54,7 +55,7 @@ const ObjectForm = forwardRef(
|
|||||||
|
|
||||||
const [form] = Form.useForm()
|
const [form] = Form.useForm()
|
||||||
const formUpdateValues = Form.useWatch([], form)
|
const formUpdateValues = Form.useWatch([], form)
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
const { showSuccess, showError: showMessageError } = useMessageContext()
|
||||||
const [deleteModalOpen, setDeleteModalOpen] = useState(false)
|
const [deleteModalOpen, setDeleteModalOpen] = useState(false)
|
||||||
const [deleteLoading, setDeleteLoading] = useState(false)
|
const [deleteLoading, setDeleteLoading] = useState(false)
|
||||||
const {
|
const {
|
||||||
@ -296,7 +297,7 @@ const ObjectForm = forwardRef(
|
|||||||
onStateChangeRef.current({ loading: false })
|
onStateChangeRef.current({ loading: false })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
messageApi.error('Failed to fetch object info')
|
showMessageError('Failed to fetch object info')
|
||||||
showError(
|
showError(
|
||||||
`Failed to fetch object information. Message: ${err.message}. Code: ${err.code}`,
|
`Failed to fetch object information. Message: ${err.message}. Code: ${err.code}`,
|
||||||
fetchObject
|
fetchObject
|
||||||
@ -308,7 +309,7 @@ const ObjectForm = forwardRef(
|
|||||||
id,
|
id,
|
||||||
type,
|
type,
|
||||||
form,
|
form,
|
||||||
messageApi,
|
showMessageError,
|
||||||
showError,
|
showError,
|
||||||
calculateComputedValues,
|
calculateComputedValues,
|
||||||
model
|
model
|
||||||
@ -433,13 +434,13 @@ const ObjectForm = forwardRef(
|
|||||||
...currentFormData,
|
...currentFormData,
|
||||||
_isEditing: isEditingRef.current
|
_isEditing: isEditingRef.current
|
||||||
})
|
})
|
||||||
messageApi.success('Information updated successfully')
|
showSuccess('Information updated successfully')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
if (err.errorFields) {
|
if (err.errorFields) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
messageApi.error('Failed to update information')
|
showMessageError('Failed to update information')
|
||||||
showError(
|
showError(
|
||||||
`Failed to update information. Message: ${err.message}. Code: ${err.code}`,
|
`Failed to update information. Message: ${err.message}. Code: ${err.code}`,
|
||||||
() => handleUpdate()
|
() => handleUpdate()
|
||||||
@ -460,11 +461,11 @@ const ObjectForm = forwardRef(
|
|||||||
try {
|
try {
|
||||||
await deleteObject(id, type)
|
await deleteObject(id, type)
|
||||||
setDeleteModalOpen(false)
|
setDeleteModalOpen(false)
|
||||||
messageApi.success('Deleted successfully')
|
showSuccess('Deleted successfully')
|
||||||
// Optionally: trigger a callback to parent to remove this object from view
|
// Optionally: trigger a callback to parent to remove this object from view
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
messageApi.error('Failed to delete')
|
showMessageError('Failed to delete')
|
||||||
showError(
|
showError(
|
||||||
`Failed to delete. Message: ${err.message}. Code: ${err.code}`,
|
`Failed to delete. Message: ${err.message}. Code: ${err.code}`,
|
||||||
confirmDelete
|
confirmDelete
|
||||||
@ -550,7 +551,6 @@ const ObjectForm = forwardRef(
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{contextHolder}
|
|
||||||
{children({
|
{children({
|
||||||
loading: fetchLoading,
|
loading: fetchLoading,
|
||||||
isEditing,
|
isEditing,
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
} from 'react'
|
} from 'react'
|
||||||
import {
|
import {
|
||||||
Table,
|
Table,
|
||||||
message,
|
|
||||||
Skeleton,
|
Skeleton,
|
||||||
Card,
|
Card,
|
||||||
Row,
|
Row,
|
||||||
@ -85,7 +84,6 @@ const ObjectTable = forwardRef(
|
|||||||
if (cards && isElectron) {
|
if (cards && isElectron) {
|
||||||
adjustedScrollHeight = 'calc(var(--unit-100vh) - 260px)'
|
adjustedScrollHeight = 'calc(var(--unit-100vh) - 260px)'
|
||||||
}
|
}
|
||||||
const [, contextHolder] = message.useMessage()
|
|
||||||
const tableRef = useRef(null)
|
const tableRef = useRef(null)
|
||||||
const model = getModelByName(type)
|
const model = getModelByName(type)
|
||||||
const tableFilterRef = useRef({})
|
const tableFilterRef = useRef({})
|
||||||
@ -781,7 +779,6 @@ const ObjectTable = forwardRef(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{contextHolder}
|
|
||||||
<Flex gap={'middle'} vertical>
|
<Flex gap={'middle'} vertical>
|
||||||
<Table
|
<Table
|
||||||
ref={tableRef}
|
ref={tableRef}
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Card, Tree, Spin, Space, Button, message } from 'antd'
|
import { Card, Tree, Spin, Space, Button } from 'antd'
|
||||||
import { LoadingOutlined } from '@ant-design/icons'
|
import { LoadingOutlined } from '@ant-design/icons'
|
||||||
import { useState, useEffect, useContext } from 'react'
|
import { useState, useEffect, useContext } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
import { useMessageContext } from '../context/MessageContext'
|
||||||
import { PrintServerContext } from '../context/PrintServerContext'
|
import { PrintServerContext } from '../context/PrintServerContext'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import JobIcon from '../../Icons/JobIcon'
|
import JobIcon from '../../Icons/JobIcon'
|
||||||
@ -20,7 +21,7 @@ const PrinterJobsTree = ({
|
|||||||
const [treeLoading, setTreeLoading] = useState(initialLoading)
|
const [treeLoading, setTreeLoading] = useState(initialLoading)
|
||||||
const [error, setError] = useState(null)
|
const [error, setError] = useState(null)
|
||||||
const { printServer } = useContext(PrintServerContext)
|
const { printServer } = useContext(PrintServerContext)
|
||||||
const [messageApi] = message.useMessage()
|
const { showError } = useMessageContext()
|
||||||
const [expandedKeys, setExpandedKeys] = useState([])
|
const [expandedKeys, setExpandedKeys] = useState([])
|
||||||
const [treeData, setTreeData] = useState([])
|
const [treeData, setTreeData] = useState([])
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
@ -105,7 +106,7 @@ const PrinterJobsTree = ({
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
setError('Failed to fetch sub jobs')
|
setError('Failed to fetch sub jobs')
|
||||||
messageApi.error('Failed to fetch sub jobs')
|
showError('Failed to fetch sub jobs')
|
||||||
} finally {
|
} finally {
|
||||||
setTreeLoading(false)
|
setTreeLoading(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
// PrinterSelect.js
|
// PrinterSelect.js
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Tree, Card, Spin, Space, Button, message, Typography } from 'antd'
|
import { Tree, Card, Spin, Space, Button, Typography } from 'antd'
|
||||||
import { LoadingOutlined } from '@ant-design/icons'
|
import { LoadingOutlined } from '@ant-design/icons'
|
||||||
import { useState, useEffect, useContext, useCallback } from 'react'
|
import { useState, useEffect, useContext, useCallback } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
import { useMessageContext } from '../context/MessageContext'
|
||||||
import PrinterState from './PrinterState'
|
import PrinterState from './PrinterState'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { PrintServerContext } from '../context/PrintServerContext'
|
import { PrintServerContext } from '../context/PrintServerContext'
|
||||||
@ -22,7 +23,7 @@ const SubJobsTree = ({ jobData, loading }) => {
|
|||||||
const [treeLoading, setTreeLoading] = useState(loading)
|
const [treeLoading, setTreeLoading] = useState(loading)
|
||||||
const [error, setError] = useState(null)
|
const [error, setError] = useState(null)
|
||||||
const { printServer } = useContext(PrintServerContext)
|
const { printServer } = useContext(PrintServerContext)
|
||||||
const [messageApi] = message.useMessage()
|
const { showError } = useMessageContext()
|
||||||
const [expandedKeys, setExpandedKeys] = useState([])
|
const [expandedKeys, setExpandedKeys] = useState([])
|
||||||
const [currentJobData, setCurrentJobData] = useState(null)
|
const [currentJobData, setCurrentJobData] = useState(null)
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
@ -104,7 +105,7 @@ const SubJobsTree = ({ jobData, loading }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
setError('Failed to fetch print job details')
|
setError('Failed to fetch print job details')
|
||||||
messageApi.error('Failed to fetch print job details')
|
showError('Failed to fetch print job details')
|
||||||
} finally {
|
} finally {
|
||||||
setTreeLoading(false)
|
setTreeLoading(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import PauseCircleIcon from '../../components/Icons/PauseCircleIcon'
|
|||||||
import StopCircleIcon from '../../components/Icons/StopCircleIcon'
|
import StopCircleIcon from '../../components/Icons/StopCircleIcon'
|
||||||
import FilamentStockIcon from '../../components/Icons/FilamentStockIcon'
|
import FilamentStockIcon from '../../components/Icons/FilamentStockIcon'
|
||||||
import ControlIcon from '../../components/Icons/ControlIcon'
|
import ControlIcon from '../../components/Icons/ControlIcon'
|
||||||
|
import JobIcon from '../../components/Icons/JobIcon'
|
||||||
|
|
||||||
export const Printer = {
|
export const Printer = {
|
||||||
name: 'printer',
|
name: 'printer',
|
||||||
@ -114,9 +115,9 @@ export const Printer = {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'queue',
|
name: 'job',
|
||||||
label: 'Queue',
|
label: 'Job',
|
||||||
icon: PlayCircleIcon,
|
icon: JobIcon,
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.online == false
|
return objectData?.online == false
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user