diff --git a/src/components/Dashboard/Production/Printers/ControlPrinter.jsx b/src/components/Dashboard/Production/Printers/ControlPrinter.jsx index 76ad5ec..95f7c41 100644 --- a/src/components/Dashboard/Production/Printers/ControlPrinter.jsx +++ b/src/components/Dashboard/Production/Printers/ControlPrinter.jsx @@ -10,7 +10,6 @@ import ViewButton from '../../common/ViewButton.jsx' import NoteIcon from '../../../Icons/NoteIcon.jsx' import ObjectForm from '../../common/ObjectForm.jsx' import EditButtons from '../../common/EditButtons.jsx' -import LockIndicator from '../../common/LockIndicator.jsx' import ActionHandler from '../../common/ActionHandler.jsx' import ObjectActions from '../../common/ObjectActions.jsx' @@ -26,6 +25,7 @@ import SubJobIcon from '../../../Icons/SubJobIcon.jsx' import FilamentStockIcon from '../../../Icons/FilamentStockIcon.jsx' import MissingPlaceholder from '../../common/MissingPlaceholder.jsx' import { useMediaQuery } from 'react-responsive' +import AlertsDisplay from '../../common/AlertsDisplay.jsx' const log = loglevel.getLogger('ControlPrinter') log.setLevel(config.logLevel) @@ -68,7 +68,8 @@ const ControlPrinter = () => { editLoading: false, formValid: false, locked: false, - loading: false + loading: false, + objectData: {} }) const actions = { @@ -164,8 +165,8 @@ const ControlPrinter = () => { visibleState={collapseState} updateVisibleState={updateCollapseState} /> + - { + const getAlertType = (type, priority) => { + if (type === 'error' || priority === '9') return 'error' + if (type === 'warning' || priority === '8') return 'warning' + return 'info' + } + + const getAlertIcon = (type, priority) => { + if (type === 'error' || priority === '9') return + if (type === 'warning' || priority === '8') + return + return + } + + if (alerts.length == 0) { + return null + } + + return ( + + {alerts.map((alert, index) => ( + + ))} + + ) +} + +AlertsDisplay.propTypes = { + alerts: PropTypes.arrayOf( + PropTypes.shape({ + priority: PropTypes.string.isRequired, + type: PropTypes.string.isRequired, + createdAt: PropTypes.string.isRequired, + updatedAt: PropTypes.string.isRequired, + message: PropTypes.string.isRequired + }) + ).isRequired +} + +export default AlertsDisplay