Refactor invoice, payment, tax record, and stock components to utilize getModelByName for master filters
Some checks failed
farmcontrol/farmcontrol-ui/pipeline/head There was a failure building this commit

- Updated multiple components including InvoiceInfo, PaymentInfo, TaxRecordInfo, and various stock-related components to use getModelByName for constructing master filters.
- Improved code consistency and readability by replacing hardcoded parent ID references with dynamic model prefixes.
- Cleaned up unnecessary whitespace and optimized component structure for better maintainability.
This commit is contained in:
Tom Butcher 2026-08-19 16:40:10 +01:00
parent ee038d08c3
commit f2ccec483f
73 changed files with 3063 additions and 2878 deletions

View File

@ -26,7 +26,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import OrderItemIcon from '../../../Icons/OrderItemIcon.jsx'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
@ -38,7 +38,6 @@ const InvoiceInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -82,7 +81,7 @@ const InvoiceInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
},
}
}
return (
@ -253,7 +252,7 @@ const InvoiceInfo = () => {
) : (
<ObjectTable
type='payment'
masterFilter={{ 'invoice._id': invoiceId }}
masterFilter={{ invoice: getModelByName('invoice').prefix + ':' + invoiceId }}
visibleColumns={{ invoice: false }}
/>
)}
@ -273,9 +272,7 @@ const InvoiceInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -283,8 +280,13 @@ const InvoiceInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': invoiceId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('invoice').prefix +
':' +
invoiceId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -23,6 +23,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('PaymentInfo')
@ -33,7 +34,6 @@ const PaymentInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -74,7 +74,7 @@ const PaymentInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
},
}
}
return (
@ -207,9 +207,7 @@ const PaymentInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -217,8 +215,13 @@ const PaymentInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': paymentId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('payment').prefix +
':' +
paymentId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('TaxRecordInfo')
@ -199,8 +200,13 @@ const TaxRecordInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': taxRecordId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('taxRecord').prefix +
':' +
taxRecordId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -22,6 +22,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder'
import DocumentPrintButton from '../../common/DocumentPrintButton'
import UserNotifierToggle from '../../common/UserNotifierToggle'
import ScrollBox from '../../common/ScrollBox'
import { getModelByName } from '../../../../database/ObjectModels.js'
import HistoryDisplay from '../../common/HistoryDisplay'
const FilamentStockInfo = () => {
@ -186,7 +187,7 @@ const FilamentStockInfo = () => {
) : (
<ObjectTable
type='stockEvent'
masterFilter={{ 'parent._id': filamentStockId }}
masterFilter={{ parent: getModelByName('filamentStock').prefix + ':' + filamentStockId }}
visibleColumns={{ parent: false }}
/>
)}
@ -234,8 +235,13 @@ const FilamentStockInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': filamentStockId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('filamentStock').prefix +
':' +
filamentStockId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectActions from '../../common/ObjectActions.jsx'
import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('OrderItemInfo')
@ -205,8 +206,13 @@ const OrderItemInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': orderItemId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('orderItem').prefix +
':' +
orderItemId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -25,6 +25,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import HistoryDisplay from '../../common/HistoryDisplay.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import PartStockIcon from '../../../Icons/PartStockIcon.jsx'
const log = loglevel.getLogger('PartStockInfo')
@ -204,7 +205,7 @@ const PartStockInfo = () => {
) : (
<ObjectTable
type='stockEvent'
masterFilter={{ 'parent._id': partStockId }}
masterFilter={{ parent: getModelByName('partStock').prefix + ':' + partStockId }}
visibleColumns={{ parent: false }}
/>
)}
@ -255,8 +256,13 @@ const PartStockInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': partStockId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('partStock').prefix +
':' +
partStockId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -10,7 +10,7 @@ import InfoCollapse from '../../common/InfoCollapse.jsx'
import ObjectInfo from '../../common/ObjectInfo.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx'
import ViewButton from '../../common/ViewButton.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import InfoCircleIcon from '../../../Icons/InfoCircleIcon.jsx'
import NoteIcon from '../../../Icons/NoteIcon.jsx'
import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx'
@ -39,7 +39,6 @@ const ProductStockInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -88,7 +87,7 @@ const ProductStockInfo = () => {
delete: () => {
objectFormRef?.current.handleDelete?.()
return true
},
}
}
return (
@ -240,7 +239,7 @@ const ProductStockInfo = () => {
) : (
<ObjectTable
type='stockEvent'
masterFilter={{ 'parent._id': productStockId }}
masterFilter={{ parent: getModelByName('productStock').prefix + ':' + productStockId }}
visibleColumns={{ parent: false }}
/>
)}
@ -281,9 +280,7 @@ const ProductStockInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -291,8 +288,13 @@ const ProductStockInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': productStockId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('productStock').prefix +
':' +
productStockId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -27,6 +27,7 @@ import ScrollBox from '../../common/ScrollBox.jsx'
import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
const log = loglevel.getLogger('PurchaseOrderInfo')
@ -39,7 +40,6 @@ const PurchaseOrderInfo = () => {
const shipmentsTableRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -92,7 +92,7 @@ const PurchaseOrderInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
},
}
}
return (
@ -225,7 +225,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable
type='orderItem'
masterFilter={{
'order._id': purchaseOrderId,
order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
orderType: 'purchaseOrder'
}}
visibleColumns={{ order: false }}
@ -244,7 +244,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable
type='shipment'
masterFilter={{
'order._id': purchaseOrderId,
order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
orderType: 'purchaseOrder'
}}
visibleColumns={{ order: false }}
@ -266,7 +266,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable
type='invoice'
masterFilter={{
'order._id': purchaseOrderId,
order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
orderType: 'purchaseOrder'
}}
visibleColumns={{ order: false }}
@ -288,7 +288,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable
type='stockEvent'
masterFilter={{
'owner._id': purchaseOrderId
owner: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId
}}
/>
)}
@ -312,9 +312,7 @@ const PurchaseOrderInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -322,8 +320,13 @@ const PurchaseOrderInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': purchaseOrderId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('purchaseOrder').prefix +
':' +
purchaseOrderId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -27,6 +27,7 @@ import NewOrderItem from '../OrderItems/NewOrderItem.jsx'
import NewShipment from './NewShipment.jsx'
import PostPurchaseOrder from '../PurchaseOrders/PostPurchaseOrder.jsx'
import AcknowledgePurchaseOrder from '../PurchaseOrders/AcknowledgePurchaseOrder.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
const log = loglevel.getLogger('PurchaseOrderInfo')
@ -227,7 +228,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable
type='orderItem'
masterFilter={{
'order._id': purchaseOrderId,
order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
orderType: 'purchaseOrder'
}}
visibleColumns={{ order: false }}
@ -246,7 +247,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable
type='shipment'
masterFilter={{
'order._id': purchaseOrderId,
order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
orderType: 'purchaseOrder'
}}
visibleColumns={{ order: false }}
@ -282,8 +283,13 @@ const PurchaseOrderInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': purchaseOrderId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('purchaseOrder').prefix +
':' +
purchaseOrderId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -24,6 +24,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import OrderItemIcon from '../../../Icons/OrderItemIcon.jsx'
const log = loglevel.getLogger('ShipmentInfo')
@ -34,7 +35,6 @@ const ShipmentInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -77,7 +77,7 @@ const ShipmentInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
},
}
}
return (
@ -205,7 +205,7 @@ const ShipmentInfo = () => {
>
<ObjectTable
type='orderItem'
masterFilter={{ 'shipment._id': shipmentId }}
masterFilter={{ shipment: getModelByName('shipment').prefix + ':' + shipmentId }}
visibleColumns={{
shipment: false,
order: false,
@ -232,9 +232,7 @@ const ShipmentInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -242,8 +240,13 @@ const ShipmentInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': shipmentId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('shipment').prefix +
':' +
shipmentId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('StockAuditInfo')
@ -211,8 +212,13 @@ const StockAuditInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': stockAuditId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('stockAudit').prefix +
':' +
stockAuditId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('StockLocationInfo')
@ -209,8 +210,13 @@ const StockLocationInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': stockLocationId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('stockLocation').prefix +
':' +
stockLocationId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -8,7 +8,7 @@ import InfoCollapse from '../../common/InfoCollapse.jsx'
import ObjectInfo from '../../common/ObjectInfo.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx'
import ViewButton from '../../common/ViewButton.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import InfoCircleIcon from '../../../Icons/InfoCircleIcon.jsx'
import NoteIcon from '../../../Icons/NoteIcon.jsx'
import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx'
@ -31,7 +31,6 @@ const StockTransferInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -78,7 +77,7 @@ const StockTransferInfo = () => {
delete: () => {
objectFormRef?.current.handleDelete?.()
return true
},
}
}
return (
@ -232,9 +231,7 @@ const StockTransferInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -242,8 +239,13 @@ const StockTransferInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': stockTransferId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('stockTransfer').prefix +
':' +
stockTransferId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const AppPasswordInfo = () => {
@ -26,7 +27,6 @@ const AppPasswordInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -178,9 +178,7 @@ const AppPasswordInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -188,8 +186,13 @@ const AppPasswordInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': appPasswordId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('appPassword').prefix +
':' +
appPasswordId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('CourierServiceInfo')
@ -201,8 +202,13 @@ const CourierServiceInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': courierServiceId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('courierService').prefix +
':' +
courierServiceId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -22,6 +22,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import CourierServiceIcon from '../../../Icons/CourierServiceIcon.jsx'
const log = loglevel.getLogger('CourierInfo')
@ -186,10 +187,10 @@ const CourierInfo = () => {
) : (
<ObjectTable
type='courierService'
masterFilter={{ 'courier._id': courierId }}
masterFilter={{ courier: getModelByName('courier').prefix + ':' + courierId }}
visibleColumns={{
courier: false,
'courier._id': false
courier: false
}}
/>
)}
@ -219,8 +220,13 @@ const CourierInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': courierId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('courier').prefix +
':' +
courierId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('DocumentJobInfo')
@ -199,8 +200,13 @@ const DocumentJobInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': documentJobId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('documentJob').prefix +
':' +
documentJobId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('DocumentPrinterInfo')
@ -213,8 +214,13 @@ const DocumentPrinterInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': documentPrinterId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('documentPrinter').prefix +
':' +
documentPrinterId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('DocumentSizeInfo')
@ -200,8 +201,13 @@ const DocumentSizeInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': documentSizeId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('documentSize').prefix +
':' +
documentSizeId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('DocumentTemplateInfo')
@ -214,8 +215,13 @@ const DocumentTemplateInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': documentTemplateId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('documentTemplate').prefix +
':' +
documentTemplateId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const FilamentSkuInfo = () => {
@ -196,8 +197,13 @@ const FilamentSkuInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': filamentSkuId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('filamentSku').prefix +
':' +
filamentSkuId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -25,6 +25,7 @@ import FilamentIcon from '../../../Icons/FilamentIcon.jsx'
import FilamentSkuIcon from '../../../Icons/FilamentSkuIcon.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
const log = loglevel.getLogger('FilamentInfo')
@ -214,7 +215,7 @@ const FilamentInfo = () => {
<ObjectTable
ref={filamentSkusTableRef}
type='filamentSku'
masterFilter={{ filament: filamentId }}
masterFilter={{ filament: getModelByName('filament').prefix + ':' + filamentId }}
visibleColumns={{ filament: false }}
/>
)}
@ -232,7 +233,7 @@ const FilamentInfo = () => {
) : (
<ObjectTable
type='filamentStock'
masterFilter={{ filament: filamentId }}
masterFilter={{ filament: getModelByName('filament').prefix + ':' + filamentId }}
visibleColumns={{
filament: false,
startingWeight: false
@ -265,8 +266,13 @@ const FilamentInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': filamentId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('filament').prefix +
':' +
filamentId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -28,7 +28,7 @@ import { ApiServerContext } from '../../context/ApiServerContext.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import JsonObjectIcon from '../../../Icons/JsonObjectIcon.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
const log = loglevel.getLogger('FileInfo')
log.setLevel(config.logLevel)
@ -250,8 +250,13 @@ const FileInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': fileId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('file').prefix +
':' +
fileId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -25,6 +25,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import PrinterIcon from '../../../Icons/PrinterIcon.jsx'
import DocumentPrinterIcon from '../../../Icons/DocumentPrinterIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('HostInfo')
@ -35,7 +36,6 @@ const HostInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -208,10 +208,10 @@ const HostInfo = () => {
) : (
<ObjectTable
type='printer'
masterFilter={{ 'host._id': hostId }}
masterFilter={{ host: getModelByName('host').prefix + ':' + hostId }}
visibleColumns={{
host: false,
'host._id': false
host: false
}}
/>
)}
@ -230,10 +230,10 @@ const HostInfo = () => {
) : (
<ObjectTable
type='documentPrinter'
masterFilter={{ 'host._id': hostId }}
masterFilter={{ host: getModelByName('host').prefix + ':' + hostId }}
visibleColumns={{
host: false,
'host._id': false
host: false
}}
/>
)}
@ -255,9 +255,7 @@ const HostInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -265,8 +263,13 @@ const HostInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': hostId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('host').prefix +
':' +
hostId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('MaterialInfo')
@ -199,8 +200,13 @@ const MaterialInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': materialId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('material').prefix +
':' +
materialId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -18,6 +18,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const NoteTypeInfo = () => {
@ -177,8 +178,13 @@ const NoteTypeInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': noteTypeId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('noteType').prefix +
':' +
noteTypeId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -15,7 +15,7 @@ const NewNote = ({ onOk, defaultValues = {} }) => {
<ObjectInfo
type='note'
column={1}
visibleProperties={{ 'parent._id': false }}
visibleProperties={{ parent: false }}
bordered={false}
isEditing={true}
required={true}

View File

@ -25,7 +25,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
const log = loglevel.getLogger('NoteInfo')
log.setLevel(config.logLevel)
@ -228,8 +228,13 @@ const NoteInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': noteId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('note').prefix +
':' +
noteId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const PartSkuInfo = () => {
@ -191,8 +192,13 @@ const PartSkuInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': partSkuId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('partSku').prefix +
':' +
partSkuId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,6 +21,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import PartSkuIcon from '../../../Icons/PartSkuIcon.jsx'
const PartInfo = () => {
@ -30,7 +31,6 @@ const PartInfo = () => {
const partId = new URLSearchParams(location.search).get('partId')
const partSkusTableRef = useRef()
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -162,9 +162,7 @@ const PartInfo = () => {
title='Part Information'
icon={<InfoCircleIcon />}
active={collapseState.info}
onToggle={(expanded) =>
updateCollapseState('info', expanded)
}
onToggle={(expanded) => updateCollapseState('info', expanded)}
collapseKey='info'
>
<ObjectInfo
@ -180,9 +178,7 @@ const PartInfo = () => {
title='Part SKUs'
icon={<PartSkuIcon />}
active={collapseState.partSkus}
onToggle={(expanded) =>
updateCollapseState('partSkus', expanded)
}
onToggle={(expanded) => updateCollapseState('partSkus', expanded)}
collapseKey='partSkus'
>
{objectFormState.loading ? (
@ -191,7 +187,7 @@ const PartInfo = () => {
<ObjectTable
ref={partSkusTableRef}
type='partSku'
masterFilter={{ part: partId }}
masterFilter={{ part: getModelByName('part').prefix + ':' + partId }}
visibleColumns={{ part: false }}
/>
)}
@ -212,9 +208,7 @@ const PartInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -222,8 +216,13 @@ const PartInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': partId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('part').prefix +
':' +
partId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const ProductCategoryInfo = () => {
@ -196,8 +197,13 @@ const ProductCategoryInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': productCategoryId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('productCategory').prefix +
':' +
productCategoryId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,7 +21,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import PartIcon from '../../../Icons/PartIcon.jsx'
const ProductSkuInfo = () => {
@ -224,8 +224,13 @@ const ProductSkuInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': productSkuId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('productSku').prefix +
':' +
productSkuId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,6 +21,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ProductSkuIcon from '../../../Icons/ProductSkuIcon.jsx'
const ProductInfo = () => {
@ -36,7 +37,6 @@ const ProductInfo = () => {
})
const productSkusTableRef = useRef()
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -190,7 +190,7 @@ const ProductInfo = () => {
<ObjectTable
ref={productSkusTableRef}
type='productSku'
masterFilter={{ product: productId }}
masterFilter={{ product: getModelByName('product').prefix + ':' + productId }}
visibleColumns={{ product: false }}
/>
)}
@ -215,9 +215,7 @@ const ProductInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -225,8 +223,13 @@ const ProductInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': productId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('product').prefix +
':' +
productId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('TaxRateInfo')
@ -196,8 +197,13 @@ const TaxRateInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': taxRateId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('taxRate').prefix +
':' +
taxRateId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -23,7 +23,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import { useMediaQuery } from 'react-responsive'
const UserInfo = () => {
@ -206,7 +206,7 @@ const UserInfo = () => {
) : (
<ObjectTable
type='appPassword'
masterFilter={{ user: userId }}
masterFilter={{ user: getModelByName('user').prefix + ':' + userId }}
visibleColumns={{ user: false }}
ref={appPasswordsTableRef}
/>
@ -227,9 +227,7 @@ const UserInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -237,8 +235,13 @@ const UserInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': userId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('user').prefix +
':' +
userId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('VendorInfo')
@ -196,8 +197,13 @@ const VendorInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': vendorId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('vendor').prefix +
':' +
vendorId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -27,6 +27,7 @@ import SettingsIcon from '../../../Icons/SettingsIcon'
import UserNotifierToggle from '../../common/UserNotifierToggle'
import ViewButton from '../../common/ViewButton'
import useCollapseState from '../../hooks/useCollapseState'
import { getModelByName } from '../../../../database/ObjectModels.js'
import {
FILAMENT_PROFILE_BED_TEMPERATURE_PROPERTIES,
FILAMENT_PROFILE_COMPATIBILITY_PROPERTIES,
@ -160,7 +161,9 @@ const FilamentProfileInfo = () => {
<Space>
<EditButtons
isEditing={objectFormState.isEditing}
handleUpdate={() => actionHandlerRef.current.callAction('finishEdit')}
handleUpdate={() =>
actionHandlerRef.current.callAction('finishEdit')
}
cancelEditing={() =>
actionHandlerRef.current.callAction('cancelEdit')
}
@ -533,8 +536,13 @@ const FilamentProfileInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': filamentProfileId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('filamentProfile').prefix +
':' +
filamentProfileId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -24,7 +24,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import PartIcon from '../../../Icons/PartIcon.jsx'
const log = loglevel.getLogger('GCodeFileInfo')
@ -235,8 +235,13 @@ const GCodeFileInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': gcodeFileId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('gcodeFile').prefix +
':' +
gcodeFileId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -4,6 +4,7 @@ import WizardView from '../../common/WizardView'
import { ApiServerContext } from '../../context/ApiServerContext'
import { Descriptions, Flex, Typography } from 'antd'
import ObjectTable from '../../common/ObjectTable'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ObjectProperty from '../../common/ObjectProperty'
const { Text } = Typography
const DeployJob = ({
@ -26,7 +27,7 @@ const DeployJob = ({
while (hasMore == true) {
const subJobsPage = await fetchObjects('subJob', {
page: currentPage,
filter: { 'job._id': job._id }
filter: { job: job._id }
})
subJobs = [...subJobs, ...subJobsPage.data]
if (subJobsPage.data.length >= 25) {
@ -150,7 +151,7 @@ const DeployJob = ({
printer: false,
job: false
}}
masterFilter={{ 'job._id': job?._id }}
masterFilter={{ job: getModelByName('job').prefix + ':' + job?._id }}
size={'small'}
showActions={!slicerIntegration}
/>

View File

@ -24,6 +24,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import JobIcon from '../../../Icons/JobIcon.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('JobInfo')
@ -34,7 +35,6 @@ const JobInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -74,7 +74,7 @@ const JobInfo = () => {
finishEdit: () => {
objectFormRef?.current.handleUpdate()
return true
},
}
}
return (
@ -198,8 +198,8 @@ const JobInfo = () => {
>
<ObjectTable
type='subJob'
masterFilter={{ 'job._id': jobId }}
visibleColumns={{ 'job._id': false }}
masterFilter={{ job: getModelByName('job').prefix + ':' + jobId }}
visibleColumns={{ job: false }}
/>
</InfoCollapse>
@ -219,9 +219,7 @@ const JobInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -229,8 +227,13 @@ const JobInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': jobId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('job').prefix +
':' +
jobId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -26,7 +26,7 @@ import UserNotifierToggle from '../../common/UserNotifierToggle'
import ViewButton from '../../common/ViewButton'
import useCollapseState from '../../hooks/useCollapseState'
import ObjectProperty from '../../common/ObjectProperty'
import { getModelProperty } from '../../../../database/ObjectModels'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels'
import GCodeFileIcon from '../../../Icons/GCodeFileIcon'
import SettingsIcon from '../../../Icons/SettingsIcon'
import ExclamationOctagonIcon from '../../../Icons/ExclamationOctagonIcon'
@ -133,7 +133,9 @@ const PrinterProfileInfo = () => {
<Space>
<EditButtons
isEditing={objectFormState.isEditing}
handleUpdate={() => actionHandlerRef.current.callAction('finishEdit')}
handleUpdate={() =>
actionHandlerRef.current.callAction('finishEdit')
}
cancelEditing={() =>
actionHandlerRef.current.callAction('cancelEdit')
}
@ -385,8 +387,13 @@ const PrinterProfileInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': printerProfileId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('printerProfile').prefix +
':' +
printerProfileId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -24,6 +24,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import PrinterProfileIcon from '../../../Icons/PrinterProfileIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ObjectTableNavigationButtons from '../../common/ObjectTableNavigationButtons.jsx'
const log = loglevel.getLogger('PrinterInfo')
log.setLevel(config.logLevel)
@ -34,7 +35,6 @@ const PrinterInfo = () => {
const profilesTableRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
const printerId = new URLSearchParams(location.search).get('printerId')
const [collapseState, updateCollapseState] = useCollapseState('PrinterInfo', {
@ -75,7 +75,7 @@ const PrinterInfo = () => {
finishEdit: () => {
objectFormRef?.current.handleUpdate()
return true
},
}
}
return (
@ -214,7 +214,7 @@ const PrinterInfo = () => {
<ObjectTable
ref={profilesTableRef}
type='printerProfile'
masterFilter={{ printer: printerId }}
masterFilter={{ printer: getModelByName('printer').prefix + ':' + printerId }}
visibleColumns={{
printer: false,
'printer._id': false
@ -239,9 +239,7 @@ const PrinterInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -249,8 +247,13 @@ const PrinterInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': printerId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('printer').prefix +
':' +
printerId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,6 +21,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
const SubJobInfo = () => {
@ -173,9 +174,9 @@ const SubJobInfo = () => {
) : (
<ObjectTable
type='stockEvent'
masterFilter={{ 'owner._id': subJobId }}
masterFilter={{ owner: getModelByName('subJob').prefix + ':' + subJobId }}
visibleColumns={{
'owner._id': false,
owner: false,
'owner.type': false,
owner: false
}}
@ -207,8 +208,13 @@ const SubJobInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': subJobId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('subJob').prefix +
':' +
subJobId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('ClientInfo')
@ -196,8 +197,13 @@ const ClientInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': clientId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('client').prefix +
':' +
clientId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -23,6 +23,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
const log = loglevel.getLogger('ListingVarientInfo')
log.setLevel(config.logLevel)
@ -32,7 +33,6 @@ const ListingVarientInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -77,7 +77,7 @@ const ListingVarientInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
},
}
}
return (
@ -204,9 +204,7 @@ const ListingVarientInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -214,8 +212,13 @@ const ListingVarientInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': listingVarientId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('listingVarient').prefix +
':' +
listingVarientId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -23,6 +23,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('ListingInfo')
@ -34,7 +35,6 @@ const ListingInfo = () => {
const listingVarientsTableRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -75,7 +75,7 @@ const ListingInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
},
}
}
return (
@ -197,7 +197,7 @@ const ListingInfo = () => {
<ObjectTable
type='listingVarient'
masterFilter={{
'listing._id': listingId
listing: getModelByName('listing').prefix + ':' + listingId
}}
visibleColumns={{ listing: false }}
ref={listingVarientsTableRef}
@ -222,9 +222,7 @@ const ListingInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -232,8 +230,13 @@ const ListingInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': listingId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('listing').prefix +
':' +
listingId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -25,6 +25,7 @@ import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { ApiServerContext } from '../../context/ApiServerContext.jsx'
import { ElectronContext } from '../../context/ElectronContext.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import {
buildMarketplaceAuthState,
storeMarketplaceAuthState
@ -38,7 +39,6 @@ const MarketplaceInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -268,9 +268,7 @@ const MarketplaceInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -278,8 +276,13 @@ const MarketplaceInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': marketplaceId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('marketplace').prefix +
':' +
marketplaceId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -27,6 +27,7 @@ import ScrollBox from '../../common/ScrollBox.jsx'
import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
const log = loglevel.getLogger('SalesOrderInfo')
@ -39,7 +40,6 @@ const SalesOrderInfo = () => {
const shipmentsTableRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -90,7 +90,7 @@ const SalesOrderInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
},
}
}
return (
@ -223,7 +223,7 @@ const SalesOrderInfo = () => {
<ObjectTable
type='orderItem'
masterFilter={{
'order._id': salesOrderId,
order: getModelByName('salesOrder').prefix + ':' + salesOrderId,
orderType: 'salesOrder'
}}
visibleColumns={{ order: false }}
@ -242,7 +242,7 @@ const SalesOrderInfo = () => {
<ObjectTable
type='shipment'
masterFilter={{
'order._id': salesOrderId,
order: getModelByName('salesOrder').prefix + ':' + salesOrderId,
orderType: 'salesOrder'
}}
visibleColumns={{ order: false }}
@ -264,7 +264,7 @@ const SalesOrderInfo = () => {
<ObjectTable
type='invoice'
masterFilter={{
'order._id': salesOrderId,
order: getModelByName('salesOrder').prefix + ':' + salesOrderId,
orderType: 'salesOrder'
}}
visibleColumns={{ order: false }}
@ -286,7 +286,7 @@ const SalesOrderInfo = () => {
<ObjectTable
type='stockEvent'
masterFilter={{
'owner._id': salesOrderId
owner: getModelByName('salesOrder').prefix + ':' + salesOrderId
}}
/>
)}
@ -310,9 +310,7 @@ const SalesOrderInfo = () => {
title='Audit Logs'
icon={<AuditLogIcon />}
active={collapseState.auditLogs}
onToggle={(expanded) =>
updateCollapseState('auditLogs', expanded)
}
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
collapseKey='auditLogs'
>
{objectFormState.loading ? (
@ -320,8 +318,13 @@ const SalesOrderInfo = () => {
) : (
<ObjectTable
type='auditLog'
masterFilter={{ 'parent._id': salesOrderId }}
visibleColumns={{ _id: false, 'parent._id': false }}
masterFilter={{
parent:
getModelByName('salesOrder').prefix +
':' +
salesOrderId
}}
visibleColumns={{ _id: false, parent: false }}
/>
)}
</InfoCollapse>

View File

@ -78,9 +78,7 @@ const ElipsisText = ({ children, style, className, title, code, ...rest }) => {
style={style}
>
<span
className={
showTruncated ? 'elipsis-text is-truncated' : 'elipsis-text'
}
className={showTruncated ? 'elipsis-text is-truncated' : 'elipsis-text'}
ref={containerRef}
>
<RootTag className='elipsis-text-measure' ref={measureRef}>

View File

@ -71,7 +71,9 @@ const NoteItem = ({
setChildNotesLoading(true)
try {
const childNotesData = await fetchObjects('note', {
filter: { 'parent._id': note._id }
filter: {
parent: getModelByName('note').prefix + ':' + note._id
}
})
setChildNotes(childNotesData.data)
} catch (error) {
@ -105,7 +107,7 @@ const NoteItem = ({
if (isExpanded == true) {
subscribeToObjectTypeUpdatesRef.current = subscribeToObjectTypeUpdates(
'note',
{ 'parent._id': note._id },
{ parent: getModelByName('note').prefix + ':' + note._id },
() => {
if (isExpanded == true) {
handleNoteExpand()

View File

@ -19,6 +19,7 @@ import InfoCircleIcon from '../../Icons/InfoCircleIcon'
import ReloadIcon from '../../Icons/ReloadIcon'
import NewNote from '../Management/Notes/NewNote'
import NoteItem from './NoteItem'
import { getModelByName } from '../../../database/ObjectModels.js'
const { Text } = Typography
@ -40,14 +41,14 @@ const NotesPanel = ({ _id, type }) => {
const fetchData = useCallback(
async (id) => {
try {
const newData = await fetchNotes(id)
const newData = await fetchNotes(id, type)
return newData
} catch (error) {
setError(error)
return null
}
},
[fetchNotes]
[fetchNotes, type]
)
const generateNotes = useCallback(
@ -98,7 +99,7 @@ const NotesPanel = ({ _id, type }) => {
if (connected == true && subscribeToObjectTypeUpdatesRef.current == null) {
subscribeToObjectTypeUpdatesRef.current = subscribeToObjectTypeUpdates(
'note',
{ 'parent._id': _id },
{ parent: getModelByName(type).prefix + ':' + _id },
() => handleReloadData()
)
}

View File

@ -1543,12 +1543,12 @@ const ApiServerProvider = ({ children }) => {
}
// Fetch notes for a specific parent
const fetchNotes = async (parentId) => {
logger.debug('Fetching notes for parent:', parentId)
const fetchNotes = async (parentId, parentType) => {
logger.debug('Fetching notes for parent:', parentId, parentType)
try {
const response = await axios.get(`${config.backendUrl}/notes`, {
params: {
'parent._id': parentId,
parent: getModelByName(parentType).prefix + ':' + parentId,
sort: 'createdAt',
order: 'ascend'
},
@ -1564,7 +1564,7 @@ const ApiServerProvider = ({ children }) => {
} catch (err) {
console.error(err)
showError(err, () => {
fetchNotes(parentId)
fetchNotes(parentId, parentType)
})
}
}

View File

@ -97,7 +97,6 @@ export const AppPassword = {
'name',
'user',
'active',
'user._id',
'createdAt',
'updatedAt',
'_reference'

View File

@ -17,8 +17,8 @@ export const AuditLog = {
'createdAt'
],
filters: [
'parent._id',
'owner._id',
'parent',
'owner',
'operation',
'createdAt',
'updatedAt',

View File

@ -89,7 +89,6 @@ export const CourierService = {
filters: [
'_id',
'courier',
'courier._id',
'name',
'active',
'tracked',

View File

@ -110,7 +110,6 @@ export const Filament = {
filters: [
'_id',
'material',
'material._id',
'diameter',
'name',
'cost',

View File

@ -90,7 +90,6 @@ export const FilamentSku = {
'_id',
'barcode',
'filament',
'filament._id',
'name',
'color',
'cost',

View File

@ -45,14 +45,11 @@ export const FilamentStock = {
],
filters: [
'filament',
'filament._id',
'filamentSku',
'state',
'startingWeight',
'currentWeight',
'filamentSku._id',
'stockLocation',
'stockLocation._id',
'createdAt',
'updatedAt',
'_reference'

View File

@ -101,9 +101,7 @@ export const GCodeFile = {
'_id',
'name',
'filament',
'filament._id',
'filamentSku',
'filamentSku._id',
'createdAt',
'updatedAt',
'_reference'

View File

@ -166,10 +166,7 @@ export const Invoice = {
'vendor',
'client',
'state',
'vendor._id',
'client._id',
'order',
'order._id',
'orderType',
'createdAt',
'updatedAt',

View File

@ -122,7 +122,6 @@ export const ListingVarient = {
],
filters: [
'listing',
'listing._id',
'product',
'productSku',
'state',

View File

@ -56,12 +56,10 @@ export const Note = {
filters: [
'_id',
'user',
'user._id',
'parentType',
'parent',
'parent._id',
'parent',
'noteType',
'noteType._id',
'createdAt',
'updatedAt',
'_reference'

View File

@ -87,12 +87,9 @@ export const OrderItem = {
'name',
'itemType',
'item',
'item._id',
'order',
'order._id',
'orderType',
'shipment',
'shipment._id',
'state',
'createdAt',
'updatedAt',

View File

@ -92,7 +92,6 @@ export const PartSku = {
'_id',
'barcode',
'part',
'part._id',
'name',
'cost',
'price',

View File

@ -36,9 +36,7 @@ export const PartStock = {
'state',
'startingQuantity',
'currentQuantity',
'partSku._id',
'stockLocation',
'stockLocation._id',
'createdAt',
'updatedAt',
'_reference'

View File

@ -163,10 +163,7 @@ export const Payment = {
'vendor',
'client',
'state',
'vendor._id',
'client._id',
'invoice',
'invoice._id',
'createdAt',
'updatedAt',
'_reference'

View File

@ -102,7 +102,6 @@ export const Product = {
'name',
'globalPrice',
'productCategory',
'productCategory._id',
'createdAt',
'updatedAt',
'_reference'

View File

@ -92,7 +92,6 @@ export const ProductSku = {
'_id',
'barcode',
'product',
'product._id',
'name',
'cost',
'price',

View File

@ -7,6 +7,7 @@ const PostProductStock = lazy(
() => import('../../components/Dashboard/Inventory/ProductStocks/PostProductStock')
)
import ProductStockIcon from '../../components/Icons/ProductStockIcon'
import { getModelByName } from '../ObjectModels.js'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
@ -103,9 +104,7 @@ export const ProductStock = {
'productSku',
'state',
'currentQuantity',
'productSku._id',
'stockLocation',
'stockLocation._id',
'createdAt',
'updatedAt',
'_reference'
@ -227,7 +226,9 @@ export const ProductStock = {
masterFilter: (objectData) => {
const partSkuId = objectData?.partSku?._id
if (partSkuId == null) return {}
return { 'partSku._id': partSkuId }
return {
partSku: getModelByName('partSku').prefix + ':' + partSkuId
}
}
},
{

View File

@ -231,7 +231,6 @@ export const PurchaseOrder = {
'vendor',
'state',
'value',
'vendor._id',
'totalAmount',
'totalAmountWithTax',
'totalTaxAmount',

View File

@ -238,7 +238,6 @@ export const SalesOrder = {
'client',
'state',
'value',
'client._id',
'createdAt',
'updatedAt',
'_reference'

View File

@ -147,7 +147,6 @@ export const Shipment = {
'order',
'state',
'courierService',
'order._id',
'taxRate',
'createdAt',
'updatedAt',

View File

@ -9,13 +9,7 @@ export const StockEvent = {
icon: StockEventIcon,
actions: [],
columns: ['_reference', 'owner', 'parent', 'value', 'createdAt', 'updatedAt'],
filters: [
'owner._id',
'parent._id',
'createdAt',
'updatedAt',
'_reference'
],
filters: ['owner', 'parent', 'createdAt', 'updatedAt', '_reference'],
sorters: ['createdAt', 'updatedAt'],
properties: [
{