Tom Butcher eb61700248
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
Enhance Dashboard Components with Additional Statistics and History Displays
- Expanded FinanceOverview, InventoryOverview, and SalesOverview components to include new statistics and history displays for various object types, improving data visibility.
- Added support for tax record statistics, payment history, and invoice history in FinanceOverview.
- Introduced stock transfer, shipment, and part stock history statistics in InventoryOverview.
- Enhanced SalesOverview with order item statistics and shipment history, providing a more comprehensive view of sales data.
- Updated ModelHistoryDisplay to support dynamic history groups, improving flexibility in data representation.
- Refactored various model definitions to include new statistical measures, enhancing the overall data model structure.
2026-08-30 14:56:46 +01:00

375 lines
8.5 KiB
JavaScript

import DashboardOverviewPage from '../common/DashboardOverviewPage'
import StatsDisplay from '../common/StatsDisplay'
import ModelHistoryDisplay from '../common/ModelHistoryDisplay'
import ObjectTable from '../common/ObjectTable'
const collapseDefaults = {
partStockStats: true,
filamentStockStats: true,
productStockStats: true,
purchaseOrderStats: true,
stockEventStats: true,
stockTransferStats: true,
stockLocationStats: true,
shipmentStats: true,
partStockCountHistory: true,
partStockValueHistory: true,
newPartStocks: true,
filamentStockCountHistory: true,
filamentStockValueHistory: true,
unconsumedFilamentStocks: true,
productStockCountHistory: true,
productStockValueHistory: true,
draftProductStocks: true,
purchaseOrderCountHistory: true,
purchaseOrderAmountHistory: true,
draftPurchaseOrders: true,
stockEventHistory: true,
stockTransferHistory: true,
draftStockTransfers: true,
sentPurchaseOrders: true,
usedPartStocks: true,
plannedShipments: true,
shippedInboundShipments: true
}
const sections = [
{
key: 'partStockStats',
title: 'Part Stock Statistics',
className: 'no-t-padding-collapse',
content: <StatsDisplay objectType='partStock' />
},
{
key: 'filamentStockStats',
title: 'Filament Stock Statistics',
className: 'no-t-padding-collapse',
content: <StatsDisplay objectType='filamentStock' />
},
{
key: 'productStockStats',
title: 'Product Stock Statistics',
className: 'no-t-padding-collapse',
content: <StatsDisplay objectType='productStock' />
},
{
key: 'purchaseOrderStats',
title: 'Purchase Order Statistics',
className: 'no-t-padding-collapse',
content: <StatsDisplay objectType='purchaseOrder' />
},
{
key: 'stockEventStats',
title: 'Stock Event Statistics',
className: 'no-t-padding-collapse',
content: <StatsDisplay objectType='stockEvent' />
},
{
key: 'stockTransferStats',
title: 'Stock Transfer Statistics',
className: 'no-t-padding-collapse',
content: <StatsDisplay objectType='stockTransfer' />
},
{
key: 'stockLocationStats',
title: 'Stock Location Statistics',
className: 'no-t-padding-collapse',
content: <StatsDisplay objectType='stockLocation' />
},
{
key: 'shipmentStats',
title: 'Shipment Statistics',
className: 'no-t-padding-collapse',
content: <StatsDisplay objectType='shipment' />
},
{
key: 'partStockHistoryRow',
type: 'row',
columns: [
[
{
key: 'partStockCountHistory',
title: 'Part Stock Count History',
content: (
<ModelHistoryDisplay
objectType='partStock'
historyGroup='count'
chartType='line'
/>
)
}
],
[
{
key: 'partStockValueHistory',
title: 'Part Stock Quantity History',
content: (
<ModelHistoryDisplay
objectType='partStock'
historyGroup='value'
chartType='line'
/>
)
}
]
]
},
{
key: 'filamentStockHistoryRow',
type: 'row',
columns: [
[
{
key: 'filamentStockCountHistory',
title: 'Filament Stock Count History',
content: (
<ModelHistoryDisplay
objectType='filamentStock'
historyGroup='count'
chartType='line'
/>
)
}
],
[
{
key: 'filamentStockValueHistory',
title: 'Filament Stock Weight History',
content: (
<ModelHistoryDisplay
objectType='filamentStock'
historyGroup='value'
chartType='line'
/>
)
}
]
]
},
{
key: 'newPartAndUnconsumedFilamentRow',
type: 'row',
columns: [
[
{
key: 'newPartStocks',
title: 'New Part Stocks',
content: (
<ObjectTable type='partStock' masterFilter={{ state: 'new' }} />
)
}
],
[
{
key: 'unconsumedFilamentStocks',
title: 'Unconsumed Filament Stocks',
content: (
<ObjectTable
type='filamentStock'
masterFilter={{ state: 'unconsumed' }}
/>
)
}
]
]
},
{
key: 'productStockHistoryRow',
type: 'row',
columns: [
[
{
key: 'productStockCountHistory',
title: 'Product Stock Count History',
content: (
<ModelHistoryDisplay
objectType='productStock'
historyGroup='count'
chartType='line'
/>
)
}
],
[
{
key: 'productStockValueHistory',
title: 'Product Stock Quantity History',
content: (
<ModelHistoryDisplay
objectType='productStock'
historyGroup='value'
chartType='line'
/>
)
}
]
]
},
{
key: 'purchaseOrderHistoryRow',
type: 'row',
columns: [
[
{
key: 'purchaseOrderCountHistory',
title: 'Purchase Order Count History',
content: (
<ModelHistoryDisplay
objectType='purchaseOrder'
historyGroup='count'
/>
)
}
],
[
{
key: 'purchaseOrderAmountHistory',
title: 'Purchase Order Amount History',
content: (
<ModelHistoryDisplay
objectType='purchaseOrder'
historyGroup='amount'
/>
)
}
]
]
},
{
key: 'draftProductAndPurchaseOrderRow',
type: 'row',
columns: [
[
{
key: 'draftProductStocks',
title: 'Draft Product Stocks',
content: (
<ObjectTable
type='productStock'
masterFilter={{ state: 'draft' }}
/>
)
}
],
[
{
key: 'draftPurchaseOrders',
title: 'Draft Purchase Orders',
content: (
<ObjectTable
type='purchaseOrder'
masterFilter={{ state: 'draft' }}
/>
)
}
]
]
},
{
key: 'stockEventAndTransferHistoryRow',
type: 'row',
columns: [
[
{
key: 'stockEventHistory',
title: 'Stock Event History',
content: (
<ModelHistoryDisplay objectType='stockEvent' chartType='line' />
)
}
],
[
{
key: 'stockTransferHistory',
title: 'Stock Transfer History',
content: <ModelHistoryDisplay objectType='stockTransfer' />
}
]
]
},
{
key: 'draftTransfersAndSentPurchaseOrdersRow',
type: 'row',
columns: [
[
{
key: 'draftStockTransfers',
title: 'Draft Stock Transfers',
content: (
<ObjectTable
type='stockTransfer'
masterFilter={{ state: 'draft' }}
/>
)
}
],
[
{
key: 'sentPurchaseOrders',
title: 'Sent Purchase Orders',
content: (
<ObjectTable
type='purchaseOrder'
masterFilter={{ state: 'sent' }}
/>
)
}
]
]
},
{
key: 'usedPartsAndPlannedShipmentsRow',
type: 'row',
columns: [
[
{
key: 'usedPartStocks',
title: 'Used Part Stocks',
content: (
<ObjectTable type='partStock' masterFilter={{ state: 'used' }} />
)
}
],
[
{
key: 'plannedShipments',
title: 'Planned Shipments',
content: (
<ObjectTable type='shipment' masterFilter={{ state: 'planned' }} />
)
}
]
]
},
{
key: 'shippedInboundShipmentsRow',
type: 'row',
columns: [
[
{
key: 'shippedInboundShipments',
title: 'Inbound Shipments In Transit',
content: (
<ObjectTable
type='shipment'
masterFilter={{ orderType: 'purchaseOrder', state: 'shipped' }}
/>
)
}
]
]
}
]
const InventoryOverview = () => {
return (
<DashboardOverviewPage
pageName='InventoryOverview'
collapseDefaults={collapseDefaults}
sections={sections}
/>
)
}
export default InventoryOverview