From 64c4d25982fb2fffde311113fae4df1b7cd9c398 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Mon, 24 Nov 2025 03:33:44 +0000 Subject: [PATCH] Add New Document Printer functionality to DocumentPrinters component, including modal integration and success message upon creation. Enhance dropdown menu with new action item for creating document printers. --- .../Dashboard/Management/DocumentPrinters.jsx | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/components/Dashboard/Management/DocumentPrinters.jsx b/src/components/Dashboard/Management/DocumentPrinters.jsx index 86c0b94..2bcf780 100644 --- a/src/components/Dashboard/Management/DocumentPrinters.jsx +++ b/src/components/Dashboard/Management/DocumentPrinters.jsx @@ -1,5 +1,6 @@ -import { useRef } from 'react' -import { Button, Flex, Space, Dropdown } from 'antd' +import { useRef, useState } from 'react' +import { Button, Flex, Space, Dropdown, message, Modal } from 'antd' +import PlusIcon from '../../Icons/PlusIcon' import ObjectTable from '../common/ObjectTable' import ReloadIcon from '../../Icons/ReloadIcon' import useColumnVisibility from '../hooks/useColumnVisibility' @@ -7,10 +8,12 @@ import GridIcon from '../../Icons/GridIcon' import ListIcon from '../../Icons/ListIcon' import useViewMode from '../hooks/useViewMode' import ColumnViewButton from '../common/ColumnViewButton' +import NewDocumentPrinter from './DocumentPrinters/NewDocumentPrinter' const DocumentPrinters = () => { + const [messageApi, contextHolder] = message.useMessage() const tableRef = useRef() - + const [newDocumentPrinterOpen, setNewDocumentPrinterOpen] = useState(false) const [viewMode, setViewMode] = useViewMode('documentPrinter') const [columnVisibility, setColumnVisibility] = @@ -18,6 +21,12 @@ const DocumentPrinters = () => { const actionItems = { items: [ + { + label: 'New Document Printer', + key: 'newDocumentPrinter', + icon: + }, + { type: 'divider' }, { label: 'Reload List', key: 'reloadList', @@ -27,6 +36,8 @@ const DocumentPrinters = () => { onClick: ({ key }) => { if (key === 'reloadList') { tableRef.current?.reload() + } else if (key === 'newDocumentPrinter') { + setNewDocumentPrinterOpen(true) } } } @@ -34,6 +45,7 @@ const DocumentPrinters = () => { return ( <> + {contextHolder} @@ -62,6 +74,22 @@ const DocumentPrinters = () => { cards={viewMode === 'cards'} /> + setNewDocumentPrinterOpen(false)} + footer={null} + destroyOnHidden={true} + width={700} + > + { + setNewDocumentPrinterOpen(false) + messageApi.success('New note type created successfully.') + tableRef.current?.reload() + }} + reset={!newDocumentPrinterOpen} + /> + ) }