Add invoices and stock events sections to PurchaseOrderInfo component

- Introduced new icons for invoices and stock events.
- Added collapsible sections for displaying invoices and stock events related to purchase orders.
- Updated state management to handle the visibility of the new sections.
This commit is contained in:
Tom Butcher 2025-12-27 20:52:02 +00:00
parent 0dfb22b5cf
commit ceaf4715dc

View File

@ -28,6 +28,8 @@ import PostPurchaseOrder from './PostPurchaseOrder.jsx'
import AcknowledgePurchaseOrder from './AcknowledgePurchaseOrder.jsx' import AcknowledgePurchaseOrder from './AcknowledgePurchaseOrder.jsx'
import CancelPurchaseOrder from './CancelPurchaseOrder.jsx' import CancelPurchaseOrder from './CancelPurchaseOrder.jsx'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx' import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js' import { getModelByName } from '../../../../database/ObjectModels.js'
const log = loglevel.getLogger('PurchaseOrderInfo') const log = loglevel.getLogger('PurchaseOrderInfo')
@ -53,7 +55,9 @@ const PurchaseOrderInfo = () => {
{ {
info: true, info: true,
notes: true, notes: true,
auditLogs: true auditLogs: true,
invoices: true,
stockEvents: true
} }
) )
@ -141,6 +145,8 @@ const PurchaseOrderInfo = () => {
{ key: 'info', label: 'Purchase Order Information' }, { key: 'info', label: 'Purchase Order Information' },
{ key: 'orderItems', label: 'Order Items' }, { key: 'orderItems', label: 'Order Items' },
{ key: 'shipments', label: 'Shipments' }, { key: 'shipments', label: 'Shipments' },
{ key: 'invoices', label: 'Invoices' },
{ key: 'stockEvents', label: 'Stock Events' },
{ key: 'notes', label: 'Notes' }, { key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' } { key: 'auditLogs', label: 'Audit Logs' }
]} ]}
@ -256,6 +262,48 @@ const PurchaseOrderInfo = () => {
ref={shipmentsTableRef} ref={shipmentsTableRef}
/> />
</InfoCollapse> </InfoCollapse>
<InfoCollapse
title='Invoices'
icon={<InvoiceIcon />}
active={collapseState.invoices}
onToggle={(expanded) =>
updateCollapseState('invoices', expanded)
}
collapseKey='invoices'
>
{objectFormState.loading ? (
<InfoCollapsePlaceholder />
) : (
<ObjectTable
type='invoice'
masterFilter={{
'order._id': purchaseOrderId,
orderType: 'purchaseOrder'
}}
visibleColumns={{ order: false }}
/>
)}
</InfoCollapse>
<InfoCollapse
title='Stock Events'
icon={<StockEventIcon />}
active={collapseState.stockEvents}
onToggle={(expanded) =>
updateCollapseState('stockEvents', expanded)
}
collapseKey='stockEvents'
>
{objectFormState.loading ? (
<InfoCollapsePlaceholder />
) : (
<ObjectTable
type='stockEvent'
masterFilter={{
'owner._id': purchaseOrderId
}}
/>
)}
</InfoCollapse>
</Flex> </Flex>
)} )}
</ObjectForm> </ObjectForm>