diff --git a/src/components/Dashboard/Production/Printers/ControlPrinter.jsx b/src/components/Dashboard/Production/Printers/ControlPrinter.jsx
index 08c18fb..7d2cef5 100644
--- a/src/components/Dashboard/Production/Printers/ControlPrinter.jsx
+++ b/src/components/Dashboard/Production/Printers/ControlPrinter.jsx
@@ -1,6 +1,6 @@
import { useState, useRef, useEffect, useContext } from 'react'
import { useLocation } from 'react-router-dom'
-import { Space, Flex, Card, Splitter, Divider } from 'antd'
+import { Space, Flex, Card, Splitter, Divider, Modal } from 'antd'
import loglevel from 'loglevel'
import config from '../../../../config.js'
import useCollapseState from '../../hooks/useCollapseState.js'
@@ -28,6 +28,9 @@ import { useMediaQuery } from 'react-responsive'
import AlertsDisplay from '../../common/AlertsDisplay.jsx'
import { ApiServerContext } from '../../context/ApiServerContext.jsx'
+import LoadFilamentStock from '../../Inventory/FilamentStocks/LoadFilamentStock.jsx'
+import UnloadFilamentStock from '../../Inventory/FilamentStocks/UnloadFilamentStock.jsx'
+
const log = loglevel.getLogger('ControlPrinter')
log.setLevel(config.logLevel)
@@ -57,6 +60,9 @@ const ControlPrinter = () => {
collapseState.movement
)
+ const [loadFilamentStockOpen, setLoadFilamentStockOpen] = useState(false)
+ const [unloadFilamentStockOpen, setUnloadFilamentStockOpen] = useState(false)
+
useEffect(() => {
setSideBarVisible(
collapseState.temperature ||
@@ -122,6 +128,39 @@ const ControlPrinter = () => {
})
}
return true
+ },
+ pauseJob: () => {
+ if (connected == true) {
+ sendObjectAction(printerId, 'printer', {
+ type: 'pauseJob'
+ })
+ }
+ return true
+ },
+
+ resumeJob: () => {
+ if (connected == true) {
+ sendObjectAction(printerId, 'printer', {
+ type: 'resumeJob'
+ })
+ }
+ return true
+ },
+ cancelJob: () => {
+ if (connected == true) {
+ sendObjectAction(printerId, 'printer', {
+ type: 'cancelJob'
+ })
+ }
+ return true
+ },
+ loadFilamentStock: () => {
+ setLoadFilamentStockOpen(true)
+ return true
+ },
+ unloadFilamentStock: () => {
+ setUnloadFilamentStockOpen(true)
+ return true
}
}
@@ -146,298 +185,338 @@ const ControlPrinter = () => {
)
return (
-
-
-
-
-
-
-
+ <>
+
+
+
+
+
+
+
+
+
+
+ {
+ actionHandlerRef.current.callAction('finishEdit')
+ }}
+ cancelEditing={() => {
+ actionHandlerRef.current.callAction('cancelEdit')
+ }}
+ startEditing={() => {
+ actionHandlerRef.current.callAction('edit')
+ }}
+ editLoading={objectFormState.editLoading}
+ formValid={objectFormState.formValid}
+ disabled={objectFormState.lock?.locked || objectFormState.loading}
+ loading={objectFormState.editLoading}
+ />
-
-
- {
- actionHandlerRef.current.callAction('finishEdit')
- }}
- cancelEditing={() => {
- actionHandlerRef.current.callAction('cancelEdit')
- }}
- startEditing={() => {
- actionHandlerRef.current.callAction('edit')
- }}
- editLoading={objectFormState.editLoading}
- formValid={objectFormState.formValid}
- disabled={objectFormState.lock?.locked || objectFormState.loading}
- loading={objectFormState.editLoading}
- />
-
-
-
-
-
-
-
-
-
-
- }
- collapseKey='printer'
- active={collapseState.printer}
- onToggle={(expanded) =>
- updateCollapseState('printer', expanded)
- }
- >
- {
- console.log('Got edit form state change', state)
- setEditFormState((prev) => ({ ...prev, ...state }))
- }}
- >
- {({
- loading: printerObjectLoading,
- objectData: printerObjectData
- }) => {
- return (
-
- )
- }}
-
-
- }
- collapseKey='job'
- active={collapseState.job}
- onToggle={(expanded) =>
- updateCollapseState('job', expanded)
- }
- >
- {objectFormState.objectData?.currentJob?._id ? (
- {}}
- >
- {({
- loading: jobObjectLoading,
- objectData: jobObjectData
- }) => {
- return (
-
- )
- }}
-
- ) : (
-
- )}
-
- }
- collapseKey='subJob'
- active={collapseState.subJob}
- onToggle={(expanded) =>
- updateCollapseState('subJob', expanded)
- }
- >
- {objectFormState.objectData?.currentSubJob?._id ? (
- {}}
- >
- {({
- loading: subJobObjectLoading,
- objectData: subJobObjectData
- }) => {
- return (
-
- )
- }}
-
- ) : (
-
- )}
-
- }
- collapseKey='filamentStock'
- active={collapseState.filamentStock}
- onToggle={(expanded) =>
- updateCollapseState('filamentStock', expanded)
- }
- >
- {objectFormState.objectData?.currentFilamentStock?._id ? (
- {}}
- >
- {({
- loading: filamentStockObjectLoading,
- objectData: filamentStockObjectData
- }) => {
- return (
-
- )
- }}
-
- ) : (
-
- )}
-
-
-
- {sideBarVisible && !isMobile ? (
-
- {sideBarItems}
-
- ) : null}
-
- {isMobile ? (
- <>
-
- {sideBarItems}
- >
- ) : null}
-
-
- }
- active={collapseState.notes}
- onToggle={(expanded) => updateCollapseState('notes', expanded)}
- collapseKey='notes'
- >
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ }
+ collapseKey='printer'
+ active={collapseState.printer}
+ onToggle={(expanded) =>
+ updateCollapseState('printer', expanded)
+ }
+ >
+ {
+ console.log('Got edit form state change', state)
+ setEditFormState((prev) => ({ ...prev, ...state }))
+ }}
+ >
+ {({
+ loading: printerObjectLoading,
+ objectData: printerObjectData
+ }) => {
+ return (
+
+ )
+ }}
+
+
+ }
+ collapseKey='job'
+ active={collapseState.job}
+ onToggle={(expanded) =>
+ updateCollapseState('job', expanded)
+ }
+ >
+ {objectFormState.objectData?.currentJob?._id ? (
+ {}}
+ >
+ {({
+ loading: jobObjectLoading,
+ objectData: jobObjectData
+ }) => {
+ return (
+
+ )
+ }}
+
+ ) : (
+
+ )}
+
+ }
+ collapseKey='subJob'
+ active={collapseState.subJob}
+ onToggle={(expanded) =>
+ updateCollapseState('subJob', expanded)
+ }
+ >
+ {objectFormState.objectData?.currentSubJob?._id ? (
+ {}}
+ >
+ {({
+ loading: subJobObjectLoading,
+ objectData: subJobObjectData
+ }) => {
+ return (
+
+ )
+ }}
+
+ ) : (
+
+ )}
+
+ }
+ collapseKey='filamentStock'
+ active={collapseState.filamentStock}
+ onToggle={(expanded) =>
+ updateCollapseState('filamentStock', expanded)
+ }
+ >
+ {objectFormState.objectData?.currentFilamentStock
+ ?._id ? (
+ {}}
+ >
+ {({
+ loading: filamentStockObjectLoading,
+ objectData: filamentStockObjectData
+ }) => {
+ return (
+
+ )
+ }}
+
+ ) : (
+
+ )}
+
+
+
+ {sideBarVisible && !isMobile ? (
+
+ {sideBarItems}
+
+ ) : null}
+
+ {isMobile ? (
+ <>
+
+ {sideBarItems}
+ >
+ ) : null}
+
+
+ }
+ active={collapseState.notes}
+ onToggle={(expanded) => updateCollapseState('notes', expanded)}
+ collapseKey='notes'
+ >
+
+
+
+
+
+
+
+ setLoadFilamentStockOpen(false)}
+ footer={null}
+ width='700px'
+ destroyOnHidden={true}
+ >
+ setLoadFilamentStockOpen(false)}
+ reset={false}
+ filamentStockLoaded={false}
+ />
+
+ setUnloadFilamentStockOpen(false)}
+ footer={null}
+ width='700px'
+ destroyOnHidden={true}
+ >
+ setUnloadFilamentStockOpen(false)}
+ reset={false}
+ filamentStockLoaded={false}
+ />
+
+ >
)
}