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
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:
parent
ee038d08c3
commit
f2ccec483f
@ -26,7 +26,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
|||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.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 OrderItemIcon from '../../../Icons/OrderItemIcon.jsx'
|
||||||
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
|
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
|
||||||
|
|
||||||
@ -38,7 +38,6 @@ const InvoiceInfo = () => {
|
|||||||
const objectFormRef = useRef(null)
|
const objectFormRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -82,215 +81,218 @@ const InvoiceInfo = () => {
|
|||||||
delete: () => {
|
delete: () => {
|
||||||
objectFormRef?.current?.handleDelete?.()
|
objectFormRef?.current?.handleDelete?.()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
minHeight: 0
|
minHeight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='invoice'
|
||||||
type='invoice'
|
id={invoiceId}
|
||||||
id={invoiceId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Invoice Information' },
|
||||||
{ key: 'info', label: 'Invoice Information' },
|
{ key: 'invoiceOrderItems', label: 'Invoice Order Items' },
|
||||||
{ key: 'invoiceOrderItems', label: 'Invoice Order Items' },
|
{ key: 'invoiceShipments', label: 'Invoice Shipments' },
|
||||||
{ key: 'invoiceShipments', label: 'Invoice Shipments' },
|
{ key: 'payments', label: 'Payments' },
|
||||||
{ key: 'payments', label: 'Payments' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='invoice'
|
||||||
type='invoice'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='invoice'
|
||||||
type='invoice'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={invoiceId}
|
}
|
||||||
objectType='invoice'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={invoiceId}
|
||||||
|
objectType='invoice'
|
||||||
<ScrollBox>
|
showEndingDivider={true}
|
||||||
<Flex vertical gap={'large'}>
|
/>
|
||||||
<ActionHandler
|
</Space>
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={invoiceId}
|
|
||||||
type='invoice'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Invoice Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='invoice'
|
|
||||||
labelWidth='225px'
|
|
||||||
objectData={objectData}
|
|
||||||
visibleProperties={{
|
|
||||||
invoiceOrderItems: false,
|
|
||||||
invoiceShipments: false
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Invoice Order Items'
|
|
||||||
icon={<OrderItemIcon />}
|
|
||||||
active={collapseState.invoiceOrderItems}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('invoiceOrderItems', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='invoiceOrderItems'
|
|
||||||
>
|
|
||||||
<ObjectProperty
|
|
||||||
{...getModelProperty('invoice', 'invoiceOrderItems')}
|
|
||||||
isEditing={isEditing}
|
|
||||||
objectData={objectData}
|
|
||||||
loading={loading}
|
|
||||||
size='medium'
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Invoice Shipments'
|
|
||||||
icon={<ShipmentIcon />}
|
|
||||||
active={collapseState.invoiceShipments}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('invoiceShipments', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='invoiceShipments'
|
|
||||||
>
|
|
||||||
<ObjectProperty
|
|
||||||
{...getModelProperty('invoice', 'invoiceShipments')}
|
|
||||||
isEditing={isEditing}
|
|
||||||
objectData={objectData}
|
|
||||||
loading={loading}
|
|
||||||
size='medium'
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</ActionHandler>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Payments'
|
|
||||||
icon={<PaymentIcon />}
|
|
||||||
active={collapseState.payments}
|
|
||||||
onToggle={(expanded) => updateCollapseState('payments', expanded)}
|
|
||||||
collapseKey='payments'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='payment'
|
|
||||||
masterFilter={{ 'invoice._id': invoiceId }}
|
|
||||||
visibleColumns={{ invoice: false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={invoiceId} type='invoice' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': invoiceId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={invoiceId}
|
||||||
|
type='invoice'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Invoice Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('info', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='invoice'
|
||||||
|
labelWidth='225px'
|
||||||
|
objectData={objectData}
|
||||||
|
visibleProperties={{
|
||||||
|
invoiceOrderItems: false,
|
||||||
|
invoiceShipments: false
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Invoice Order Items'
|
||||||
|
icon={<OrderItemIcon />}
|
||||||
|
active={collapseState.invoiceOrderItems}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('invoiceOrderItems', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='invoiceOrderItems'
|
||||||
|
>
|
||||||
|
<ObjectProperty
|
||||||
|
{...getModelProperty('invoice', 'invoiceOrderItems')}
|
||||||
|
isEditing={isEditing}
|
||||||
|
objectData={objectData}
|
||||||
|
loading={loading}
|
||||||
|
size='medium'
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Invoice Shipments'
|
||||||
|
icon={<ShipmentIcon />}
|
||||||
|
active={collapseState.invoiceShipments}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('invoiceShipments', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='invoiceShipments'
|
||||||
|
>
|
||||||
|
<ObjectProperty
|
||||||
|
{...getModelProperty('invoice', 'invoiceShipments')}
|
||||||
|
isEditing={isEditing}
|
||||||
|
objectData={objectData}
|
||||||
|
loading={loading}
|
||||||
|
size='medium'
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</ActionHandler>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Payments'
|
||||||
|
icon={<PaymentIcon />}
|
||||||
|
active={collapseState.payments}
|
||||||
|
onToggle={(expanded) => updateCollapseState('payments', expanded)}
|
||||||
|
collapseKey='payments'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='payment'
|
||||||
|
masterFilter={{ invoice: getModelByName('invoice').prefix + ':' + invoiceId }}
|
||||||
|
visibleColumns={{ invoice: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={invoiceId} type='invoice' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('invoice').prefix +
|
||||||
|
':' +
|
||||||
|
invoiceId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('PaymentInfo')
|
const log = loglevel.getLogger('PaymentInfo')
|
||||||
@ -33,7 +34,6 @@ const PaymentInfo = () => {
|
|||||||
const objectFormRef = useRef(null)
|
const objectFormRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -74,157 +74,160 @@ const PaymentInfo = () => {
|
|||||||
delete: () => {
|
delete: () => {
|
||||||
objectFormRef?.current?.handleDelete?.()
|
objectFormRef?.current?.handleDelete?.()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
minHeight: 0
|
minHeight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='payment'
|
||||||
type='payment'
|
id={paymentId}
|
||||||
id={paymentId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Payment Information' },
|
||||||
{ key: 'info', label: 'Payment Information' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='payment'
|
||||||
type='payment'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='payment'
|
||||||
type='payment'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={paymentId}
|
}
|
||||||
objectType='payment'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={paymentId}
|
||||||
|
objectType='payment'
|
||||||
<ScrollBox>
|
showEndingDivider={true}
|
||||||
<Flex vertical gap={'large'}>
|
/>
|
||||||
<ActionHandler
|
</Space>
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={paymentId}
|
|
||||||
type='payment'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Payment Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='payment'
|
|
||||||
labelWidth='225px'
|
|
||||||
objectData={objectData}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</ActionHandler>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={paymentId} type='payment' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': paymentId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={paymentId}
|
||||||
|
type='payment'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Payment Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('info', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='payment'
|
||||||
|
labelWidth='225px'
|
||||||
|
objectData={objectData}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</ActionHandler>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={paymentId} type='payment' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('payment').prefix +
|
||||||
|
':' +
|
||||||
|
paymentId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('TaxRecordInfo')
|
const log = loglevel.getLogger('TaxRecordInfo')
|
||||||
@ -199,8 +200,13 @@ const TaxRecordInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': taxRecordId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('taxRecord').prefix +
|
||||||
|
':' +
|
||||||
|
taxRecordId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder'
|
|||||||
import DocumentPrintButton from '../../common/DocumentPrintButton'
|
import DocumentPrintButton from '../../common/DocumentPrintButton'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle'
|
import UserNotifierToggle from '../../common/UserNotifierToggle'
|
||||||
import ScrollBox from '../../common/ScrollBox'
|
import ScrollBox from '../../common/ScrollBox'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import HistoryDisplay from '../../common/HistoryDisplay'
|
import HistoryDisplay from '../../common/HistoryDisplay'
|
||||||
|
|
||||||
const FilamentStockInfo = () => {
|
const FilamentStockInfo = () => {
|
||||||
@ -186,7 +187,7 @@ const FilamentStockInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='stockEvent'
|
type='stockEvent'
|
||||||
masterFilter={{ 'parent._id': filamentStockId }}
|
masterFilter={{ parent: getModelByName('filamentStock').prefix + ':' + filamentStockId }}
|
||||||
visibleColumns={{ parent: false }}
|
visibleColumns={{ parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -234,8 +235,13 @@ const FilamentStockInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': filamentStockId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('filamentStock').prefix +
|
||||||
|
':' +
|
||||||
|
filamentStockId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import ObjectActions from '../../common/ObjectActions.jsx'
|
|||||||
import ObjectTable from '../../common/ObjectTable.jsx'
|
import ObjectTable from '../../common/ObjectTable.jsx'
|
||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('OrderItemInfo')
|
const log = loglevel.getLogger('OrderItemInfo')
|
||||||
@ -205,8 +206,13 @@ const OrderItemInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': orderItemId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('orderItem').prefix +
|
||||||
|
':' +
|
||||||
|
orderItemId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
|||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
import HistoryDisplay from '../../common/HistoryDisplay.jsx'
|
import HistoryDisplay from '../../common/HistoryDisplay.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import PartStockIcon from '../../../Icons/PartStockIcon.jsx'
|
import PartStockIcon from '../../../Icons/PartStockIcon.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('PartStockInfo')
|
const log = loglevel.getLogger('PartStockInfo')
|
||||||
@ -204,7 +205,7 @@ const PartStockInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='stockEvent'
|
type='stockEvent'
|
||||||
masterFilter={{ 'parent._id': partStockId }}
|
masterFilter={{ parent: getModelByName('partStock').prefix + ':' + partStockId }}
|
||||||
visibleColumns={{ parent: false }}
|
visibleColumns={{ parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -255,8 +256,13 @@ const PartStockInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': partStockId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('partStock').prefix +
|
||||||
|
':' +
|
||||||
|
partStockId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import InfoCollapse from '../../common/InfoCollapse.jsx'
|
|||||||
import ObjectInfo from '../../common/ObjectInfo.jsx'
|
import ObjectInfo from '../../common/ObjectInfo.jsx'
|
||||||
import ObjectProperty from '../../common/ObjectProperty.jsx'
|
import ObjectProperty from '../../common/ObjectProperty.jsx'
|
||||||
import ViewButton from '../../common/ViewButton.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 InfoCircleIcon from '../../../Icons/InfoCircleIcon.jsx'
|
||||||
import NoteIcon from '../../../Icons/NoteIcon.jsx'
|
import NoteIcon from '../../../Icons/NoteIcon.jsx'
|
||||||
import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx'
|
import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx'
|
||||||
@ -39,7 +39,6 @@ const ProductStockInfo = () => {
|
|||||||
const objectFormRef = useRef(null)
|
const objectFormRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -88,217 +87,220 @@ const ProductStockInfo = () => {
|
|||||||
delete: () => {
|
delete: () => {
|
||||||
objectFormRef?.current.handleDelete?.()
|
objectFormRef?.current.handleDelete?.()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
minHeight: 0
|
minHeight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='productStock'
|
||||||
type='productStock'
|
id={productStockId}
|
||||||
id={productStockId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Product Stock Information' },
|
||||||
{ key: 'info', label: 'Product Stock Information' },
|
{ key: 'partStocks', label: 'Part Stocks' },
|
||||||
{ key: 'partStocks', label: 'Part Stocks' },
|
{ key: 'events', label: 'Product Stock Events' },
|
||||||
{ key: 'events', label: 'Product Stock Events' },
|
{ key: 'history', label: 'Product Stock History' },
|
||||||
{ key: 'history', label: 'Product Stock History' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='productStock'
|
||||||
type='productStock'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='productStock'
|
||||||
type='productStock'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={productStockId}
|
}
|
||||||
objectType='productStock'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={productStockId}
|
||||||
|
objectType='productStock'
|
||||||
<ScrollBox>
|
showEndingDivider={true}
|
||||||
<Flex vertical gap={'large'}>
|
/>
|
||||||
<ActionHandler
|
</Space>
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={productStockId}
|
|
||||||
type='productStock'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Product Stock Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='productStock'
|
|
||||||
objectData={objectData}
|
|
||||||
labelWidth='175px'
|
|
||||||
visibleProperties={{ partStocks: false }}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Part Stocks'
|
|
||||||
icon={<PartStockIcon />}
|
|
||||||
active={collapseState.partStocks}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('partStocks', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='partStocks'
|
|
||||||
>
|
|
||||||
<ObjectProperty
|
|
||||||
{...getModelProperty('productStock', 'partStocks')}
|
|
||||||
isEditing={isEditing}
|
|
||||||
objectData={objectData}
|
|
||||||
loading={loading}
|
|
||||||
size='medium'
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</ActionHandler>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Product Stock Events'
|
|
||||||
icon={<ProductStockIcon />}
|
|
||||||
active={collapseState.events}
|
|
||||||
onToggle={(expanded) => updateCollapseState('events', expanded)}
|
|
||||||
collapseKey='events'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='stockEvent'
|
|
||||||
masterFilter={{ 'parent._id': productStockId }}
|
|
||||||
visibleColumns={{ parent: false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Product Stock History'
|
|
||||||
icon={<GraphIcon />}
|
|
||||||
active={collapseState.history}
|
|
||||||
onToggle={(expanded) => updateCollapseState('history', expanded)}
|
|
||||||
collapseKey='history'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<HistoryDisplay
|
|
||||||
history={objectFormState.objectData?.history || []}
|
|
||||||
objectType='productStock'
|
|
||||||
chartType='line'
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={productStockId} type='productStock' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': productStockId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={productStockId}
|
||||||
|
type='productStock'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Product Stock Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('info', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='productStock'
|
||||||
|
objectData={objectData}
|
||||||
|
labelWidth='175px'
|
||||||
|
visibleProperties={{ partStocks: false }}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Part Stocks'
|
||||||
|
icon={<PartStockIcon />}
|
||||||
|
active={collapseState.partStocks}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('partStocks', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='partStocks'
|
||||||
|
>
|
||||||
|
<ObjectProperty
|
||||||
|
{...getModelProperty('productStock', 'partStocks')}
|
||||||
|
isEditing={isEditing}
|
||||||
|
objectData={objectData}
|
||||||
|
loading={loading}
|
||||||
|
size='medium'
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</ActionHandler>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Product Stock Events'
|
||||||
|
icon={<ProductStockIcon />}
|
||||||
|
active={collapseState.events}
|
||||||
|
onToggle={(expanded) => updateCollapseState('events', expanded)}
|
||||||
|
collapseKey='events'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='stockEvent'
|
||||||
|
masterFilter={{ parent: getModelByName('productStock').prefix + ':' + productStockId }}
|
||||||
|
visibleColumns={{ parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Product Stock History'
|
||||||
|
icon={<GraphIcon />}
|
||||||
|
active={collapseState.history}
|
||||||
|
onToggle={(expanded) => updateCollapseState('history', expanded)}
|
||||||
|
collapseKey='history'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<HistoryDisplay
|
||||||
|
history={objectFormState.objectData?.history || []}
|
||||||
|
objectType='productStock'
|
||||||
|
chartType='line'
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={productStockId} type='productStock' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('productStock').prefix +
|
||||||
|
':' +
|
||||||
|
productStockId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import ScrollBox from '../../common/ScrollBox.jsx'
|
|||||||
import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx'
|
import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx'
|
||||||
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
|
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
|
||||||
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
|
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
|
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('PurchaseOrderInfo')
|
const log = loglevel.getLogger('PurchaseOrderInfo')
|
||||||
@ -39,7 +40,6 @@ const PurchaseOrderInfo = () => {
|
|||||||
const shipmentsTableRef = useRef(null)
|
const shipmentsTableRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -92,244 +92,247 @@ const PurchaseOrderInfo = () => {
|
|||||||
delete: () => {
|
delete: () => {
|
||||||
objectFormRef?.current?.handleDelete?.()
|
objectFormRef?.current?.handleDelete?.()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
minHeight: 0
|
minHeight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='purchaseOrder'
|
||||||
type='purchaseOrder'
|
id={purchaseOrderId}
|
||||||
id={purchaseOrderId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ 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: 'invoices', label: 'Invoices' },
|
{ key: 'stockEvents', label: 'Stock Events' },
|
||||||
{ key: 'stockEvents', label: 'Stock Events' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='purchaseOrder'
|
||||||
type='purchaseOrder'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='purchaseOrder'
|
||||||
type='purchaseOrder'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={purchaseOrderId}
|
}
|
||||||
objectType='purchaseOrder'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={purchaseOrderId}
|
||||||
|
objectType='purchaseOrder'
|
||||||
<ScrollBox>
|
showEndingDivider={true}
|
||||||
<Flex vertical gap={'large'}>
|
/>
|
||||||
<ActionHandler
|
</Space>
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={purchaseOrderId}
|
|
||||||
type='purchaseOrder'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Purchase Order Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='purchaseOrder'
|
|
||||||
labelWidth='225px'
|
|
||||||
objectData={objectData}
|
|
||||||
visibleProperties={{
|
|
||||||
items: false
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Purchase Order Items'
|
|
||||||
icon={<OrderItemsIcon />}
|
|
||||||
active={collapseState.orderItems}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('orderItems', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='orderItems'
|
|
||||||
>
|
|
||||||
<ObjectTable
|
|
||||||
type='orderItem'
|
|
||||||
masterFilter={{
|
|
||||||
'order._id': purchaseOrderId,
|
|
||||||
orderType: 'purchaseOrder'
|
|
||||||
}}
|
|
||||||
visibleColumns={{ order: false }}
|
|
||||||
ref={orderItemsTableRef}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Shipments'
|
|
||||||
icon={<ShipmentIcon />}
|
|
||||||
active={collapseState.shipments}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('shipments', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='shipments'
|
|
||||||
>
|
|
||||||
<ObjectTable
|
|
||||||
type='shipment'
|
|
||||||
masterFilter={{
|
|
||||||
'order._id': purchaseOrderId,
|
|
||||||
orderType: 'purchaseOrder'
|
|
||||||
}}
|
|
||||||
visibleColumns={{ order: false }}
|
|
||||||
ref={shipmentsTableRef}
|
|
||||||
/>
|
|
||||||
</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>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</ActionHandler>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={purchaseOrderId} type='purchaseOrder' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': purchaseOrderId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={purchaseOrderId}
|
||||||
|
type='purchaseOrder'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Purchase Order Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('info', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='purchaseOrder'
|
||||||
|
labelWidth='225px'
|
||||||
|
objectData={objectData}
|
||||||
|
visibleProperties={{
|
||||||
|
items: false
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Purchase Order Items'
|
||||||
|
icon={<OrderItemsIcon />}
|
||||||
|
active={collapseState.orderItems}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('orderItems', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='orderItems'
|
||||||
|
>
|
||||||
|
<ObjectTable
|
||||||
|
type='orderItem'
|
||||||
|
masterFilter={{
|
||||||
|
order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
|
||||||
|
orderType: 'purchaseOrder'
|
||||||
|
}}
|
||||||
|
visibleColumns={{ order: false }}
|
||||||
|
ref={orderItemsTableRef}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Shipments'
|
||||||
|
icon={<ShipmentIcon />}
|
||||||
|
active={collapseState.shipments}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('shipments', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='shipments'
|
||||||
|
>
|
||||||
|
<ObjectTable
|
||||||
|
type='shipment'
|
||||||
|
masterFilter={{
|
||||||
|
order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
|
||||||
|
orderType: 'purchaseOrder'
|
||||||
|
}}
|
||||||
|
visibleColumns={{ order: false }}
|
||||||
|
ref={shipmentsTableRef}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Invoices'
|
||||||
|
icon={<InvoiceIcon />}
|
||||||
|
active={collapseState.invoices}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('invoices', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='invoices'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='invoice'
|
||||||
|
masterFilter={{
|
||||||
|
order: getModelByName('purchaseOrder').prefix + ':' + 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: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</ActionHandler>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={purchaseOrderId} type='purchaseOrder' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('purchaseOrder').prefix +
|
||||||
|
':' +
|
||||||
|
purchaseOrderId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import NewOrderItem from '../OrderItems/NewOrderItem.jsx'
|
|||||||
import NewShipment from './NewShipment.jsx'
|
import NewShipment from './NewShipment.jsx'
|
||||||
import PostPurchaseOrder from '../PurchaseOrders/PostPurchaseOrder.jsx'
|
import PostPurchaseOrder from '../PurchaseOrders/PostPurchaseOrder.jsx'
|
||||||
import AcknowledgePurchaseOrder from '../PurchaseOrders/AcknowledgePurchaseOrder.jsx'
|
import AcknowledgePurchaseOrder from '../PurchaseOrders/AcknowledgePurchaseOrder.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
|
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('PurchaseOrderInfo')
|
const log = loglevel.getLogger('PurchaseOrderInfo')
|
||||||
@ -227,7 +228,7 @@ const PurchaseOrderInfo = () => {
|
|||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='orderItem'
|
type='orderItem'
|
||||||
masterFilter={{
|
masterFilter={{
|
||||||
'order._id': purchaseOrderId,
|
order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
|
||||||
orderType: 'purchaseOrder'
|
orderType: 'purchaseOrder'
|
||||||
}}
|
}}
|
||||||
visibleColumns={{ order: false }}
|
visibleColumns={{ order: false }}
|
||||||
@ -246,7 +247,7 @@ const PurchaseOrderInfo = () => {
|
|||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='shipment'
|
type='shipment'
|
||||||
masterFilter={{
|
masterFilter={{
|
||||||
'order._id': purchaseOrderId,
|
order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
|
||||||
orderType: 'purchaseOrder'
|
orderType: 'purchaseOrder'
|
||||||
}}
|
}}
|
||||||
visibleColumns={{ order: false }}
|
visibleColumns={{ order: false }}
|
||||||
@ -282,8 +283,13 @@ const PurchaseOrderInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': purchaseOrderId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('purchaseOrder').prefix +
|
||||||
|
':' +
|
||||||
|
purchaseOrderId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
|||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import OrderItemIcon from '../../../Icons/OrderItemIcon.jsx'
|
import OrderItemIcon from '../../../Icons/OrderItemIcon.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('ShipmentInfo')
|
const log = loglevel.getLogger('ShipmentInfo')
|
||||||
@ -34,7 +35,6 @@ const ShipmentInfo = () => {
|
|||||||
const objectFormRef = useRef(null)
|
const objectFormRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -77,179 +77,182 @@ const ShipmentInfo = () => {
|
|||||||
delete: () => {
|
delete: () => {
|
||||||
objectFormRef?.current?.handleDelete?.()
|
objectFormRef?.current?.handleDelete?.()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
minHeight: 0
|
minHeight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='shipment'
|
||||||
type='shipment'
|
id={shipmentId}
|
||||||
id={shipmentId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Shipment Information' },
|
||||||
{ key: 'info', label: 'Shipment Information' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='shipment'
|
||||||
type='shipment'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='shipment'
|
||||||
type='shipment'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={shipmentId}
|
}
|
||||||
objectType='shipment'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={shipmentId}
|
||||||
|
objectType='shipment'
|
||||||
<ScrollBox>
|
showEndingDivider={true}
|
||||||
<Flex vertical gap={'large'}>
|
/>
|
||||||
<ActionHandler
|
</Space>
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={shipmentId}
|
|
||||||
type='shipment'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Shipment Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='shipment'
|
|
||||||
objectData={objectData}
|
|
||||||
visibleProperties={{
|
|
||||||
items: false
|
|
||||||
}}
|
|
||||||
labelWidth='175px'
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Shipment Order Items'
|
|
||||||
icon={<OrderItemIcon />}
|
|
||||||
active={collapseState.orderItems}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('orderItems', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='orderItems'
|
|
||||||
>
|
|
||||||
<ObjectTable
|
|
||||||
type='orderItem'
|
|
||||||
masterFilter={{ 'shipment._id': shipmentId }}
|
|
||||||
visibleColumns={{
|
|
||||||
shipment: false,
|
|
||||||
order: false,
|
|
||||||
orderType: false
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</ActionHandler>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={shipmentId} type='shipment' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': shipmentId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={shipmentId}
|
||||||
|
type='shipment'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Shipment Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('info', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='shipment'
|
||||||
|
objectData={objectData}
|
||||||
|
visibleProperties={{
|
||||||
|
items: false
|
||||||
|
}}
|
||||||
|
labelWidth='175px'
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Shipment Order Items'
|
||||||
|
icon={<OrderItemIcon />}
|
||||||
|
active={collapseState.orderItems}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('orderItems', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='orderItems'
|
||||||
|
>
|
||||||
|
<ObjectTable
|
||||||
|
type='orderItem'
|
||||||
|
masterFilter={{ shipment: getModelByName('shipment').prefix + ':' + shipmentId }}
|
||||||
|
visibleColumns={{
|
||||||
|
shipment: false,
|
||||||
|
order: false,
|
||||||
|
orderType: false
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</ActionHandler>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={shipmentId} type='shipment' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('shipment').prefix +
|
||||||
|
':' +
|
||||||
|
shipmentId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('StockAuditInfo')
|
const log = loglevel.getLogger('StockAuditInfo')
|
||||||
@ -211,8 +212,13 @@ const StockAuditInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': stockAuditId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('stockAudit').prefix +
|
||||||
|
':' +
|
||||||
|
stockAuditId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('StockLocationInfo')
|
const log = loglevel.getLogger('StockLocationInfo')
|
||||||
@ -209,8 +210,13 @@ const StockLocationInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': stockLocationId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('stockLocation').prefix +
|
||||||
|
':' +
|
||||||
|
stockLocationId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import InfoCollapse from '../../common/InfoCollapse.jsx'
|
|||||||
import ObjectInfo from '../../common/ObjectInfo.jsx'
|
import ObjectInfo from '../../common/ObjectInfo.jsx'
|
||||||
import ObjectProperty from '../../common/ObjectProperty.jsx'
|
import ObjectProperty from '../../common/ObjectProperty.jsx'
|
||||||
import ViewButton from '../../common/ViewButton.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 InfoCircleIcon from '../../../Icons/InfoCircleIcon.jsx'
|
||||||
import NoteIcon from '../../../Icons/NoteIcon.jsx'
|
import NoteIcon from '../../../Icons/NoteIcon.jsx'
|
||||||
import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx'
|
import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx'
|
||||||
@ -31,7 +31,6 @@ const StockTransferInfo = () => {
|
|||||||
const objectFormRef = useRef(null)
|
const objectFormRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -78,178 +77,181 @@ const StockTransferInfo = () => {
|
|||||||
delete: () => {
|
delete: () => {
|
||||||
objectFormRef?.current.handleDelete?.()
|
objectFormRef?.current.handleDelete?.()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
minHeight: 0
|
minHeight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='stockTransfer'
|
||||||
type='stockTransfer'
|
id={stockTransferId}
|
||||||
id={stockTransferId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Transfer' },
|
||||||
{ key: 'info', label: 'Transfer' },
|
{ key: 'lines', label: 'Lines' },
|
||||||
{ key: 'lines', label: 'Lines' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='stockTransfer'
|
||||||
type='stockTransfer'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='stockTransfer'
|
||||||
type='stockTransfer'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={stockTransferId}
|
}
|
||||||
objectType='stockTransfer'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={stockTransferId}
|
||||||
|
objectType='stockTransfer'
|
||||||
<ScrollBox>
|
showEndingDivider={true}
|
||||||
<Flex vertical gap={'large'}>
|
/>
|
||||||
<ActionHandler
|
</Space>
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={stockTransferId}
|
|
||||||
type='stockTransfer'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Stock transfer'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='stockTransfer'
|
|
||||||
objectData={objectData}
|
|
||||||
labelWidth='175px'
|
|
||||||
visibleProperties={{ lines: false }}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Lines'
|
|
||||||
icon={<StockTransferIcon />}
|
|
||||||
active={collapseState.lines}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('lines', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='lines'
|
|
||||||
>
|
|
||||||
<ObjectProperty
|
|
||||||
{...getModelProperty('stockTransfer', 'lines')}
|
|
||||||
isEditing={isEditing}
|
|
||||||
objectData={objectData}
|
|
||||||
loading={loading}
|
|
||||||
size='medium'
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</ActionHandler>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={stockTransferId} type='stockTransfer' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': stockTransferId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={stockTransferId}
|
||||||
|
type='stockTransfer'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Stock transfer'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('info', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='stockTransfer'
|
||||||
|
objectData={objectData}
|
||||||
|
labelWidth='175px'
|
||||||
|
visibleProperties={{ lines: false }}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Lines'
|
||||||
|
icon={<StockTransferIcon />}
|
||||||
|
active={collapseState.lines}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('lines', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='lines'
|
||||||
|
>
|
||||||
|
<ObjectProperty
|
||||||
|
{...getModelProperty('stockTransfer', 'lines')}
|
||||||
|
isEditing={isEditing}
|
||||||
|
objectData={objectData}
|
||||||
|
loading={loading}
|
||||||
|
size='medium'
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</ActionHandler>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={stockTransferId} type='stockTransfer' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('stockTransfer').prefix +
|
||||||
|
':' +
|
||||||
|
stockTransferId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const AppPasswordInfo = () => {
|
const AppPasswordInfo = () => {
|
||||||
@ -26,7 +27,6 @@ const AppPasswordInfo = () => {
|
|||||||
const objectFormRef = useRef(null)
|
const objectFormRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -70,132 +70,135 @@ const AppPasswordInfo = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{ maxHeight: '100%', minHeight: 0 }}
|
style={{ maxHeight: '100%', minHeight: 0 }}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='appPassword'
|
||||||
type='appPassword'
|
id={appPasswordId}
|
||||||
id={appPasswordId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'App Password Information' },
|
||||||
{ key: 'info', label: 'App Password Information' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='appPassword'
|
||||||
type='appPassword'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='appPassword'
|
||||||
type='appPassword'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={appPasswordId}
|
}
|
||||||
objectType='appPassword'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={appPasswordId}
|
||||||
<ScrollBox>
|
objectType='appPassword'
|
||||||
<Flex vertical gap={'large'}>
|
showEndingDivider={true}
|
||||||
<ActionHandler
|
/>
|
||||||
actions={actions}
|
</Space>
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<InfoCollapse
|
|
||||||
title='App Password Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={appPasswordId}
|
|
||||||
type='appPassword'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='appPassword'
|
|
||||||
objectData={objectData}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</InfoCollapse>
|
|
||||||
</ActionHandler>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': appPasswordId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<InfoCollapse
|
||||||
|
title='App Password Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={appPasswordId}
|
||||||
|
type='appPassword'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='appPassword'
|
||||||
|
objectData={objectData}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</InfoCollapse>
|
||||||
|
</ActionHandler>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('appPassword').prefix +
|
||||||
|
':' +
|
||||||
|
appPasswordId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('CourierServiceInfo')
|
const log = loglevel.getLogger('CourierServiceInfo')
|
||||||
@ -201,8 +202,13 @@ const CourierServiceInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': courierServiceId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('courierService').prefix +
|
||||||
|
':' +
|
||||||
|
courierServiceId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
|||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import CourierServiceIcon from '../../../Icons/CourierServiceIcon.jsx'
|
import CourierServiceIcon from '../../../Icons/CourierServiceIcon.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('CourierInfo')
|
const log = loglevel.getLogger('CourierInfo')
|
||||||
@ -186,10 +187,10 @@ const CourierInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='courierService'
|
type='courierService'
|
||||||
masterFilter={{ 'courier._id': courierId }}
|
masterFilter={{ courier: getModelByName('courier').prefix + ':' + courierId }}
|
||||||
visibleColumns={{
|
visibleColumns={{
|
||||||
courier: false,
|
courier: false,
|
||||||
'courier._id': false
|
courier: false
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -219,8 +220,13 @@ const CourierInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': courierId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('courier').prefix +
|
||||||
|
':' +
|
||||||
|
courierId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('DocumentJobInfo')
|
const log = loglevel.getLogger('DocumentJobInfo')
|
||||||
@ -199,8 +200,13 @@ const DocumentJobInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': documentJobId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('documentJob').prefix +
|
||||||
|
':' +
|
||||||
|
documentJobId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('DocumentPrinterInfo')
|
const log = loglevel.getLogger('DocumentPrinterInfo')
|
||||||
@ -213,8 +214,13 @@ const DocumentPrinterInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': documentPrinterId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('documentPrinter').prefix +
|
||||||
|
':' +
|
||||||
|
documentPrinterId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('DocumentSizeInfo')
|
const log = loglevel.getLogger('DocumentSizeInfo')
|
||||||
@ -200,8 +201,13 @@ const DocumentSizeInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': documentSizeId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('documentSize').prefix +
|
||||||
|
':' +
|
||||||
|
documentSizeId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('DocumentTemplateInfo')
|
const log = loglevel.getLogger('DocumentTemplateInfo')
|
||||||
@ -214,8 +215,13 @@ const DocumentTemplateInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': documentTemplateId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('documentTemplate').prefix +
|
||||||
|
':' +
|
||||||
|
documentTemplateId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const FilamentSkuInfo = () => {
|
const FilamentSkuInfo = () => {
|
||||||
@ -196,8 +197,13 @@ const FilamentSkuInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': filamentSkuId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('filamentSku').prefix +
|
||||||
|
':' +
|
||||||
|
filamentSkuId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import FilamentIcon from '../../../Icons/FilamentIcon.jsx'
|
|||||||
import FilamentSkuIcon from '../../../Icons/FilamentSkuIcon.jsx'
|
import FilamentSkuIcon from '../../../Icons/FilamentSkuIcon.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('FilamentInfo')
|
const log = loglevel.getLogger('FilamentInfo')
|
||||||
@ -214,7 +215,7 @@ const FilamentInfo = () => {
|
|||||||
<ObjectTable
|
<ObjectTable
|
||||||
ref={filamentSkusTableRef}
|
ref={filamentSkusTableRef}
|
||||||
type='filamentSku'
|
type='filamentSku'
|
||||||
masterFilter={{ filament: filamentId }}
|
masterFilter={{ filament: getModelByName('filament').prefix + ':' + filamentId }}
|
||||||
visibleColumns={{ filament: false }}
|
visibleColumns={{ filament: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -232,7 +233,7 @@ const FilamentInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='filamentStock'
|
type='filamentStock'
|
||||||
masterFilter={{ filament: filamentId }}
|
masterFilter={{ filament: getModelByName('filament').prefix + ':' + filamentId }}
|
||||||
visibleColumns={{
|
visibleColumns={{
|
||||||
filament: false,
|
filament: false,
|
||||||
startingWeight: false
|
startingWeight: false
|
||||||
@ -265,8 +266,13 @@ const FilamentInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': filamentId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('filament').prefix +
|
||||||
|
':' +
|
||||||
|
filamentId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -28,7 +28,7 @@ import { ApiServerContext } from '../../context/ApiServerContext.jsx'
|
|||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
import JsonObjectIcon from '../../../Icons/JsonObjectIcon.jsx'
|
import JsonObjectIcon from '../../../Icons/JsonObjectIcon.jsx'
|
||||||
import ObjectProperty from '../../common/ObjectProperty.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')
|
const log = loglevel.getLogger('FileInfo')
|
||||||
log.setLevel(config.logLevel)
|
log.setLevel(config.logLevel)
|
||||||
@ -250,8 +250,13 @@ const FileInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': fileId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('file').prefix +
|
||||||
|
':' +
|
||||||
|
fileId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
|||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import PrinterIcon from '../../../Icons/PrinterIcon.jsx'
|
import PrinterIcon from '../../../Icons/PrinterIcon.jsx'
|
||||||
import DocumentPrinterIcon from '../../../Icons/DocumentPrinterIcon.jsx'
|
import DocumentPrinterIcon from '../../../Icons/DocumentPrinterIcon.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('HostInfo')
|
const log = loglevel.getLogger('HostInfo')
|
||||||
@ -35,7 +36,6 @@ const HostInfo = () => {
|
|||||||
const objectFormRef = useRef(null)
|
const objectFormRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -81,198 +81,201 @@ const HostInfo = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
minHeight: 0
|
minHeight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='host'
|
||||||
type='host'
|
id={hostId}
|
||||||
id={hostId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Host Information' },
|
||||||
{ key: 'info', label: 'Host Information' },
|
{ key: 'printers', label: 'Printers' },
|
||||||
{ key: 'printers', label: 'Printers' },
|
{ key: 'documentPrinters', label: 'Document Printers' },
|
||||||
{ key: 'documentPrinters', label: 'Document Printers' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='host'
|
||||||
type='host'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='host'
|
||||||
type='host'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={hostId}
|
}
|
||||||
objectType='host'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={hostId}
|
||||||
|
objectType='host'
|
||||||
<ScrollBox>
|
showEndingDivider={true}
|
||||||
<Flex vertical gap={'large'}>
|
/>
|
||||||
<ActionHandler
|
</Space>
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Host Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={hostId}
|
|
||||||
type='host'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => {
|
|
||||||
return (
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='host'
|
|
||||||
objectData={objectData}
|
|
||||||
labelWidth='175px'
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</ObjectForm>
|
|
||||||
</InfoCollapse>
|
|
||||||
</ActionHandler>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Printers'
|
|
||||||
icon={<PrinterIcon />}
|
|
||||||
active={collapseState.printers}
|
|
||||||
onToggle={(expanded) => updateCollapseState('printers', expanded)}
|
|
||||||
collapseKey='printers'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='printer'
|
|
||||||
masterFilter={{ 'host._id': hostId }}
|
|
||||||
visibleColumns={{
|
|
||||||
host: false,
|
|
||||||
'host._id': false
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Document Printers'
|
|
||||||
icon={<DocumentPrinterIcon />}
|
|
||||||
active={collapseState.documentPrinters}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('documentPrinters', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='documentPrinters'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='documentPrinter'
|
|
||||||
masterFilter={{ 'host._id': hostId }}
|
|
||||||
visibleColumns={{
|
|
||||||
host: false,
|
|
||||||
'host._id': false
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={hostId} type='host' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': hostId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Host Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={hostId}
|
||||||
|
type='host'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => {
|
||||||
|
return (
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='host'
|
||||||
|
objectData={objectData}
|
||||||
|
labelWidth='175px'
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</ObjectForm>
|
||||||
|
</InfoCollapse>
|
||||||
|
</ActionHandler>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Printers'
|
||||||
|
icon={<PrinterIcon />}
|
||||||
|
active={collapseState.printers}
|
||||||
|
onToggle={(expanded) => updateCollapseState('printers', expanded)}
|
||||||
|
collapseKey='printers'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='printer'
|
||||||
|
masterFilter={{ host: getModelByName('host').prefix + ':' + hostId }}
|
||||||
|
visibleColumns={{
|
||||||
|
host: false,
|
||||||
|
host: false
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Document Printers'
|
||||||
|
icon={<DocumentPrinterIcon />}
|
||||||
|
active={collapseState.documentPrinters}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('documentPrinters', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='documentPrinters'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='documentPrinter'
|
||||||
|
masterFilter={{ host: getModelByName('host').prefix + ':' + hostId }}
|
||||||
|
visibleColumns={{
|
||||||
|
host: false,
|
||||||
|
host: false
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={hostId} type='host' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('host').prefix +
|
||||||
|
':' +
|
||||||
|
hostId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('MaterialInfo')
|
const log = loglevel.getLogger('MaterialInfo')
|
||||||
@ -199,8 +200,13 @@ const MaterialInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': materialId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('material').prefix +
|
||||||
|
':' +
|
||||||
|
materialId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const NoteTypeInfo = () => {
|
const NoteTypeInfo = () => {
|
||||||
@ -177,8 +178,13 @@ const NoteTypeInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': noteTypeId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('noteType').prefix +
|
||||||
|
':' +
|
||||||
|
noteTypeId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const NewNote = ({ onOk, defaultValues = {} }) => {
|
|||||||
<ObjectInfo
|
<ObjectInfo
|
||||||
type='note'
|
type='note'
|
||||||
column={1}
|
column={1}
|
||||||
visibleProperties={{ 'parent._id': false }}
|
visibleProperties={{ parent: false }}
|
||||||
bordered={false}
|
bordered={false}
|
||||||
isEditing={true}
|
isEditing={true}
|
||||||
required={true}
|
required={true}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
|||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.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')
|
const log = loglevel.getLogger('NoteInfo')
|
||||||
log.setLevel(config.logLevel)
|
log.setLevel(config.logLevel)
|
||||||
@ -228,8 +228,13 @@ const NoteInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': noteId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('note').prefix +
|
||||||
|
':' +
|
||||||
|
noteId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const PartSkuInfo = () => {
|
const PartSkuInfo = () => {
|
||||||
@ -191,8 +192,13 @@ const PartSkuInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': partSkuId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('partSku').prefix +
|
||||||
|
':' +
|
||||||
|
partSkuId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
|||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import PartSkuIcon from '../../../Icons/PartSkuIcon.jsx'
|
import PartSkuIcon from '../../../Icons/PartSkuIcon.jsx'
|
||||||
|
|
||||||
const PartInfo = () => {
|
const PartInfo = () => {
|
||||||
@ -30,7 +31,6 @@ const PartInfo = () => {
|
|||||||
const partId = new URLSearchParams(location.search).get('partId')
|
const partId = new URLSearchParams(location.search).get('partId')
|
||||||
const partSkusTableRef = useRef()
|
const partSkusTableRef = useRef()
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -70,166 +70,165 @@ const PartInfo = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{ maxHeight: '100%', minHeight: 0 }}
|
style={{ maxHeight: '100%', minHeight: 0 }}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='part'
|
||||||
type='part'
|
id={partId}
|
||||||
id={partId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Part Information' },
|
||||||
{ key: 'info', label: 'Part Information' },
|
{ key: 'partSkus', label: 'Part SKUs' },
|
||||||
{ key: 'partSkus', label: 'Part SKUs' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='part'
|
||||||
type='part'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='part'
|
||||||
type='part'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
|
<Space>
|
||||||
|
<EditButtons
|
||||||
|
isEditing={objectFormState.isEditing}
|
||||||
|
handleUpdate={() => {
|
||||||
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
|
}}
|
||||||
|
cancelEditing={() => {
|
||||||
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
|
}}
|
||||||
|
startEditing={() => {
|
||||||
|
actionHandlerRef.current.callAction('edit')
|
||||||
|
}}
|
||||||
|
editLoading={objectFormState.editLoading}
|
||||||
|
formValid={objectFormState.formValid}
|
||||||
|
disabled={
|
||||||
|
objectFormState.beingEditedByOther ||
|
||||||
|
objectFormState.loading ||
|
||||||
|
objectFormState.editDisabled
|
||||||
|
}
|
||||||
|
loading={objectFormState.editLoading}
|
||||||
|
/>
|
||||||
|
<ObjectTableNavigationButtons
|
||||||
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
|
_id={partId}
|
||||||
|
objectType='part'
|
||||||
|
showEndingDivider={true}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
</Flex>
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={partId}
|
||||||
|
type='part'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
}}
|
}}
|
||||||
cancelEditing={() => {
|
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
|
||||||
}}
|
|
||||||
startEditing={() => {
|
|
||||||
actionHandlerRef.current.callAction('edit')
|
|
||||||
}}
|
|
||||||
editLoading={objectFormState.editLoading}
|
|
||||||
formValid={objectFormState.formValid}
|
|
||||||
disabled={
|
|
||||||
objectFormState.beingEditedByOther ||
|
|
||||||
objectFormState.loading ||
|
|
||||||
objectFormState.editDisabled
|
|
||||||
}
|
|
||||||
loading={objectFormState.editLoading}
|
|
||||||
/>
|
|
||||||
<ObjectTableNavigationButtons
|
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
|
||||||
_id={partId}
|
|
||||||
objectType='part'
|
|
||||||
showEndingDivider={true}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</Flex>
|
|
||||||
<ScrollBox>
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<ActionHandler
|
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
>
|
||||||
<ObjectForm
|
{({ loading, isEditing, objectData }) => (
|
||||||
id={partId}
|
<InfoCollapse
|
||||||
type='part'
|
title='Part Information'
|
||||||
style={{ height: '100%' }}
|
icon={<InfoCircleIcon />}
|
||||||
ref={objectFormRef}
|
active={collapseState.info}
|
||||||
setCurrentObject={true}
|
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
||||||
onStateChange={(state) => {
|
collapseKey='info'
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
>
|
||||||
}}
|
<ObjectInfo
|
||||||
>
|
loading={loading}
|
||||||
{({ loading, isEditing, objectData }) => (
|
isEditing={isEditing}
|
||||||
<InfoCollapse
|
type='part'
|
||||||
title='Part Information'
|
objectData={objectData}
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='part'
|
|
||||||
objectData={objectData}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Part SKUs'
|
|
||||||
icon={<PartSkuIcon />}
|
|
||||||
active={collapseState.partSkus}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('partSkus', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='partSkus'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
ref={partSkusTableRef}
|
|
||||||
type='partSku'
|
|
||||||
masterFilter={{ part: partId }}
|
|
||||||
visibleColumns={{ part: false }}
|
|
||||||
/>
|
/>
|
||||||
)}
|
</InfoCollapse>
|
||||||
</InfoCollapse>
|
)}
|
||||||
</ActionHandler>
|
</ObjectForm>
|
||||||
<InfoCollapse
|
<InfoCollapse
|
||||||
title='Notes'
|
title='Part SKUs'
|
||||||
icon={<NoteIcon />}
|
icon={<PartSkuIcon />}
|
||||||
active={collapseState.notes}
|
active={collapseState.partSkus}
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
onToggle={(expanded) => updateCollapseState('partSkus', expanded)}
|
||||||
collapseKey='notes'
|
collapseKey='partSkus'
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={partId} type='part' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
>
|
||||||
{objectFormState.loading ? (
|
{objectFormState.loading ? (
|
||||||
<InfoCollapsePlaceholder />
|
<InfoCollapsePlaceholder />
|
||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
ref={partSkusTableRef}
|
||||||
masterFilter={{ 'parent._id': partId }}
|
type='partSku'
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
masterFilter={{ part: getModelByName('part').prefix + ':' + partId }}
|
||||||
|
visibleColumns={{ part: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
</Flex>
|
</ActionHandler>
|
||||||
</ScrollBox>
|
<InfoCollapse
|
||||||
</Flex>
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={partId} type='part' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('part').prefix +
|
||||||
|
':' +
|
||||||
|
partId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const ProductCategoryInfo = () => {
|
const ProductCategoryInfo = () => {
|
||||||
@ -196,8 +197,13 @@ const ProductCategoryInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': productCategoryId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('productCategory').prefix +
|
||||||
|
':' +
|
||||||
|
productCategoryId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -21,7 +21,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
|||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
import ObjectProperty from '../../common/ObjectProperty.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'
|
import PartIcon from '../../../Icons/PartIcon.jsx'
|
||||||
|
|
||||||
const ProductSkuInfo = () => {
|
const ProductSkuInfo = () => {
|
||||||
@ -224,8 +224,13 @@ const ProductSkuInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': productSkuId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('productSku').prefix +
|
||||||
|
':' +
|
||||||
|
productSkuId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
|||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ProductSkuIcon from '../../../Icons/ProductSkuIcon.jsx'
|
import ProductSkuIcon from '../../../Icons/ProductSkuIcon.jsx'
|
||||||
|
|
||||||
const ProductInfo = () => {
|
const ProductInfo = () => {
|
||||||
@ -36,7 +37,6 @@ const ProductInfo = () => {
|
|||||||
})
|
})
|
||||||
const productSkusTableRef = useRef()
|
const productSkusTableRef = useRef()
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -70,169 +70,172 @@ const ProductInfo = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{ maxHeight: '100%', minHeight: 0 }}
|
style={{ maxHeight: '100%', minHeight: 0 }}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='product'
|
||||||
type='product'
|
id={productId}
|
||||||
id={productId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Product Information' },
|
||||||
{ key: 'info', label: 'Product Information' },
|
{ key: 'productSkus', label: 'Product SKUs' },
|
||||||
{ key: 'productSkus', label: 'Product SKUs' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='product'
|
||||||
type='product'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='product'
|
||||||
type='product'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={productId}
|
}
|
||||||
objectType='product'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={productId}
|
||||||
<ScrollBox>
|
objectType='product'
|
||||||
<Flex vertical gap={'large'}>
|
showEndingDivider={true}
|
||||||
<ActionHandler
|
/>
|
||||||
actions={actions}
|
</Space>
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={productId}
|
|
||||||
type='product'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Product Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='product'
|
|
||||||
objectData={objectData}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Product SKUs'
|
|
||||||
icon={<ProductSkuIcon />}
|
|
||||||
active={collapseState.productSkus}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('productSkus', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='productSkus'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
ref={productSkusTableRef}
|
|
||||||
type='productSku'
|
|
||||||
masterFilter={{ product: productId }}
|
|
||||||
visibleColumns={{ product: false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</ActionHandler>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={productId} type='product' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': productId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={productId}
|
||||||
|
type='product'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Product Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('info', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='product'
|
||||||
|
objectData={objectData}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Product SKUs'
|
||||||
|
icon={<ProductSkuIcon />}
|
||||||
|
active={collapseState.productSkus}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('productSkus', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='productSkus'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
ref={productSkusTableRef}
|
||||||
|
type='productSku'
|
||||||
|
masterFilter={{ product: getModelByName('product').prefix + ':' + productId }}
|
||||||
|
visibleColumns={{ product: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</ActionHandler>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={productId} type='product' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('product').prefix +
|
||||||
|
':' +
|
||||||
|
productId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('TaxRateInfo')
|
const log = loglevel.getLogger('TaxRateInfo')
|
||||||
@ -196,8 +197,13 @@ const TaxRateInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': taxRateId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('taxRate').prefix +
|
||||||
|
':' +
|
||||||
|
taxRateId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
|||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
import ObjectProperty from '../../common/ObjectProperty.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'
|
import { useMediaQuery } from 'react-responsive'
|
||||||
|
|
||||||
const UserInfo = () => {
|
const UserInfo = () => {
|
||||||
@ -206,7 +206,7 @@ const UserInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='appPassword'
|
type='appPassword'
|
||||||
masterFilter={{ user: userId }}
|
masterFilter={{ user: getModelByName('user').prefix + ':' + userId }}
|
||||||
visibleColumns={{ user: false }}
|
visibleColumns={{ user: false }}
|
||||||
ref={appPasswordsTableRef}
|
ref={appPasswordsTableRef}
|
||||||
/>
|
/>
|
||||||
@ -227,9 +227,7 @@ const UserInfo = () => {
|
|||||||
title='Audit Logs'
|
title='Audit Logs'
|
||||||
icon={<AuditLogIcon />}
|
icon={<AuditLogIcon />}
|
||||||
active={collapseState.auditLogs}
|
active={collapseState.auditLogs}
|
||||||
onToggle={(expanded) =>
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
collapseKey='auditLogs'
|
||||||
>
|
>
|
||||||
{objectFormState.loading ? (
|
{objectFormState.loading ? (
|
||||||
@ -237,8 +235,13 @@ const UserInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': userId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('user').prefix +
|
||||||
|
':' +
|
||||||
|
userId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('VendorInfo')
|
const log = loglevel.getLogger('VendorInfo')
|
||||||
@ -196,8 +197,13 @@ const VendorInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': vendorId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('vendor').prefix +
|
||||||
|
':' +
|
||||||
|
vendorId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import SettingsIcon from '../../../Icons/SettingsIcon'
|
|||||||
import UserNotifierToggle from '../../common/UserNotifierToggle'
|
import UserNotifierToggle from '../../common/UserNotifierToggle'
|
||||||
import ViewButton from '../../common/ViewButton'
|
import ViewButton from '../../common/ViewButton'
|
||||||
import useCollapseState from '../../hooks/useCollapseState'
|
import useCollapseState from '../../hooks/useCollapseState'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import {
|
import {
|
||||||
FILAMENT_PROFILE_BED_TEMPERATURE_PROPERTIES,
|
FILAMENT_PROFILE_BED_TEMPERATURE_PROPERTIES,
|
||||||
FILAMENT_PROFILE_COMPATIBILITY_PROPERTIES,
|
FILAMENT_PROFILE_COMPATIBILITY_PROPERTIES,
|
||||||
@ -160,7 +161,9 @@ const FilamentProfileInfo = () => {
|
|||||||
<Space>
|
<Space>
|
||||||
<EditButtons
|
<EditButtons
|
||||||
isEditing={objectFormState.isEditing}
|
isEditing={objectFormState.isEditing}
|
||||||
handleUpdate={() => actionHandlerRef.current.callAction('finishEdit')}
|
handleUpdate={() =>
|
||||||
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
|
}
|
||||||
cancelEditing={() =>
|
cancelEditing={() =>
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
}
|
}
|
||||||
@ -533,8 +536,13 @@ const FilamentProfileInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': filamentProfileId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('filamentProfile').prefix +
|
||||||
|
':' +
|
||||||
|
filamentProfileId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
|||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.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'
|
import PartIcon from '../../../Icons/PartIcon.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('GCodeFileInfo')
|
const log = loglevel.getLogger('GCodeFileInfo')
|
||||||
@ -235,8 +235,13 @@ const GCodeFileInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': gcodeFileId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('gcodeFile').prefix +
|
||||||
|
':' +
|
||||||
|
gcodeFileId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import WizardView from '../../common/WizardView'
|
|||||||
import { ApiServerContext } from '../../context/ApiServerContext'
|
import { ApiServerContext } from '../../context/ApiServerContext'
|
||||||
import { Descriptions, Flex, Typography } from 'antd'
|
import { Descriptions, Flex, Typography } from 'antd'
|
||||||
import ObjectTable from '../../common/ObjectTable'
|
import ObjectTable from '../../common/ObjectTable'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ObjectProperty from '../../common/ObjectProperty'
|
import ObjectProperty from '../../common/ObjectProperty'
|
||||||
const { Text } = Typography
|
const { Text } = Typography
|
||||||
const DeployJob = ({
|
const DeployJob = ({
|
||||||
@ -26,7 +27,7 @@ const DeployJob = ({
|
|||||||
while (hasMore == true) {
|
while (hasMore == true) {
|
||||||
const subJobsPage = await fetchObjects('subJob', {
|
const subJobsPage = await fetchObjects('subJob', {
|
||||||
page: currentPage,
|
page: currentPage,
|
||||||
filter: { 'job._id': job._id }
|
filter: { job: job._id }
|
||||||
})
|
})
|
||||||
subJobs = [...subJobs, ...subJobsPage.data]
|
subJobs = [...subJobs, ...subJobsPage.data]
|
||||||
if (subJobsPage.data.length >= 25) {
|
if (subJobsPage.data.length >= 25) {
|
||||||
@ -150,7 +151,7 @@ const DeployJob = ({
|
|||||||
printer: false,
|
printer: false,
|
||||||
job: false
|
job: false
|
||||||
}}
|
}}
|
||||||
masterFilter={{ 'job._id': job?._id }}
|
masterFilter={{ job: getModelByName('job').prefix + ':' + job?._id }}
|
||||||
size={'small'}
|
size={'small'}
|
||||||
showActions={!slicerIntegration}
|
showActions={!slicerIntegration}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
|||||||
import JobIcon from '../../../Icons/JobIcon.jsx'
|
import JobIcon from '../../../Icons/JobIcon.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('JobInfo')
|
const log = loglevel.getLogger('JobInfo')
|
||||||
@ -34,7 +35,6 @@ const JobInfo = () => {
|
|||||||
const objectFormRef = useRef(null)
|
const objectFormRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -74,169 +74,172 @@ const JobInfo = () => {
|
|||||||
finishEdit: () => {
|
finishEdit: () => {
|
||||||
objectFormRef?.current.handleUpdate()
|
objectFormRef?.current.handleUpdate()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
minHeight: 0
|
minHeight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='job'
|
||||||
type='job'
|
id={jobId}
|
||||||
id={jobId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Job Information' },
|
||||||
{ key: 'info', label: 'Job Information' },
|
{ key: 'subJobs', label: 'Sub Jobs' },
|
||||||
{ key: 'subJobs', label: 'Sub Jobs' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='job'
|
||||||
type='job'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='job'
|
||||||
type='job'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={jobId}
|
}
|
||||||
objectType='job'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={jobId}
|
||||||
|
objectType='job'
|
||||||
<ScrollBox>
|
showEndingDivider={true}
|
||||||
<Flex vertical gap={'large'}>
|
/>
|
||||||
<ActionHandler
|
</Space>
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Job Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={jobId}
|
|
||||||
type='job'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='job'
|
|
||||||
objectData={objectData}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</InfoCollapse>
|
|
||||||
</ActionHandler>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Sub Jobs'
|
|
||||||
icon={<JobIcon />}
|
|
||||||
active={collapseState.subJobs}
|
|
||||||
onToggle={(expanded) => updateCollapseState('subJobs', expanded)}
|
|
||||||
collapseKey='subJobs'
|
|
||||||
>
|
|
||||||
<ObjectTable
|
|
||||||
type='subJob'
|
|
||||||
masterFilter={{ 'job._id': jobId }}
|
|
||||||
visibleColumns={{ 'job._id': false }}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={jobId} type='job' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': jobId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Job Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={jobId}
|
||||||
|
type='job'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='job'
|
||||||
|
objectData={objectData}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</InfoCollapse>
|
||||||
|
</ActionHandler>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Sub Jobs'
|
||||||
|
icon={<JobIcon />}
|
||||||
|
active={collapseState.subJobs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('subJobs', expanded)}
|
||||||
|
collapseKey='subJobs'
|
||||||
|
>
|
||||||
|
<ObjectTable
|
||||||
|
type='subJob'
|
||||||
|
masterFilter={{ job: getModelByName('job').prefix + ':' + jobId }}
|
||||||
|
visibleColumns={{ job: false }}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={jobId} type='job' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('job').prefix +
|
||||||
|
':' +
|
||||||
|
jobId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import UserNotifierToggle from '../../common/UserNotifierToggle'
|
|||||||
import ViewButton from '../../common/ViewButton'
|
import ViewButton from '../../common/ViewButton'
|
||||||
import useCollapseState from '../../hooks/useCollapseState'
|
import useCollapseState from '../../hooks/useCollapseState'
|
||||||
import ObjectProperty from '../../common/ObjectProperty'
|
import ObjectProperty from '../../common/ObjectProperty'
|
||||||
import { getModelProperty } from '../../../../database/ObjectModels'
|
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels'
|
||||||
import GCodeFileIcon from '../../../Icons/GCodeFileIcon'
|
import GCodeFileIcon from '../../../Icons/GCodeFileIcon'
|
||||||
import SettingsIcon from '../../../Icons/SettingsIcon'
|
import SettingsIcon from '../../../Icons/SettingsIcon'
|
||||||
import ExclamationOctagonIcon from '../../../Icons/ExclamationOctagonIcon'
|
import ExclamationOctagonIcon from '../../../Icons/ExclamationOctagonIcon'
|
||||||
@ -133,7 +133,9 @@ const PrinterProfileInfo = () => {
|
|||||||
<Space>
|
<Space>
|
||||||
<EditButtons
|
<EditButtons
|
||||||
isEditing={objectFormState.isEditing}
|
isEditing={objectFormState.isEditing}
|
||||||
handleUpdate={() => actionHandlerRef.current.callAction('finishEdit')}
|
handleUpdate={() =>
|
||||||
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
|
}
|
||||||
cancelEditing={() =>
|
cancelEditing={() =>
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
}
|
}
|
||||||
@ -385,8 +387,13 @@ const PrinterProfileInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': printerProfileId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('printerProfile').prefix +
|
||||||
|
':' +
|
||||||
|
printerProfileId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
|||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
import PrinterProfileIcon from '../../../Icons/PrinterProfileIcon.jsx'
|
import PrinterProfileIcon from '../../../Icons/PrinterProfileIcon.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ObjectTableNavigationButtons from '../../common/ObjectTableNavigationButtons.jsx'
|
import ObjectTableNavigationButtons from '../../common/ObjectTableNavigationButtons.jsx'
|
||||||
const log = loglevel.getLogger('PrinterInfo')
|
const log = loglevel.getLogger('PrinterInfo')
|
||||||
log.setLevel(config.logLevel)
|
log.setLevel(config.logLevel)
|
||||||
@ -34,7 +35,6 @@ const PrinterInfo = () => {
|
|||||||
const profilesTableRef = useRef(null)
|
const profilesTableRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
const printerId = new URLSearchParams(location.search).get('printerId')
|
const printerId = new URLSearchParams(location.search).get('printerId')
|
||||||
const [collapseState, updateCollapseState] = useCollapseState('PrinterInfo', {
|
const [collapseState, updateCollapseState] = useCollapseState('PrinterInfo', {
|
||||||
@ -75,188 +75,191 @@ const PrinterInfo = () => {
|
|||||||
finishEdit: () => {
|
finishEdit: () => {
|
||||||
objectFormRef?.current.handleUpdate()
|
objectFormRef?.current.handleUpdate()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
minHeight: 0
|
minHeight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='printer'
|
||||||
type='printer'
|
id={printerId}
|
||||||
id={printerId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Printer Information' },
|
||||||
{ key: 'info', label: 'Printer Information' },
|
{ key: 'profiles', label: 'Printer Profiles' },
|
||||||
{ key: 'profiles', label: 'Printer Profiles' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='printer'
|
||||||
type='printer'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='printer'
|
||||||
type='printer'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={printerId}
|
}
|
||||||
objectType='printer'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={printerId}
|
||||||
|
objectType='printer'
|
||||||
<ScrollBox>
|
showEndingDivider={true}
|
||||||
<Flex vertical gap={'large'}>
|
/>
|
||||||
<ActionHandler
|
</Space>
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Printer Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={printerId}
|
|
||||||
type='printer'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='printer'
|
|
||||||
objectData={objectData}
|
|
||||||
labelWidth='175px'
|
|
||||||
visibleProperties={{
|
|
||||||
currentFilamentStock: false,
|
|
||||||
'currentFilamentStock._id': false,
|
|
||||||
currentJob: false,
|
|
||||||
'currentJob._id': false,
|
|
||||||
currentSubJob: false,
|
|
||||||
'currentSubJob._id': false,
|
|
||||||
alerts: false,
|
|
||||||
pendingSlicerUploads: false
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</InfoCollapse>
|
|
||||||
</ActionHandler>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Printer Profiles'
|
|
||||||
icon={<PrinterProfileIcon />}
|
|
||||||
active={collapseState.profiles}
|
|
||||||
onToggle={(expanded) => updateCollapseState('profiles', expanded)}
|
|
||||||
collapseKey='profiles'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
ref={profilesTableRef}
|
|
||||||
type='printerProfile'
|
|
||||||
masterFilter={{ printer: printerId }}
|
|
||||||
visibleColumns={{
|
|
||||||
printer: false,
|
|
||||||
'printer._id': false
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={printerId} type='printer' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': printerId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Printer Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={printerId}
|
||||||
|
type='printer'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='printer'
|
||||||
|
objectData={objectData}
|
||||||
|
labelWidth='175px'
|
||||||
|
visibleProperties={{
|
||||||
|
currentFilamentStock: false,
|
||||||
|
'currentFilamentStock._id': false,
|
||||||
|
currentJob: false,
|
||||||
|
'currentJob._id': false,
|
||||||
|
currentSubJob: false,
|
||||||
|
'currentSubJob._id': false,
|
||||||
|
alerts: false,
|
||||||
|
pendingSlicerUploads: false
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</InfoCollapse>
|
||||||
|
</ActionHandler>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Printer Profiles'
|
||||||
|
icon={<PrinterProfileIcon />}
|
||||||
|
active={collapseState.profiles}
|
||||||
|
onToggle={(expanded) => updateCollapseState('profiles', expanded)}
|
||||||
|
collapseKey='profiles'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
ref={profilesTableRef}
|
||||||
|
type='printerProfile'
|
||||||
|
masterFilter={{ printer: getModelByName('printer').prefix + ':' + printerId }}
|
||||||
|
visibleColumns={{
|
||||||
|
printer: false,
|
||||||
|
'printer._id': false
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={printerId} type='printer' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('printer').prefix +
|
||||||
|
':' +
|
||||||
|
printerId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
|||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
|
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
|
||||||
|
|
||||||
const SubJobInfo = () => {
|
const SubJobInfo = () => {
|
||||||
@ -173,9 +174,9 @@ const SubJobInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='stockEvent'
|
type='stockEvent'
|
||||||
masterFilter={{ 'owner._id': subJobId }}
|
masterFilter={{ owner: getModelByName('subJob').prefix + ':' + subJobId }}
|
||||||
visibleColumns={{
|
visibleColumns={{
|
||||||
'owner._id': false,
|
owner: false,
|
||||||
'owner.type': false,
|
'owner.type': false,
|
||||||
owner: false
|
owner: false
|
||||||
}}
|
}}
|
||||||
@ -207,8 +208,13 @@ const SubJobInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': subJobId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('subJob').prefix +
|
||||||
|
':' +
|
||||||
|
subJobId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('ClientInfo')
|
const log = loglevel.getLogger('ClientInfo')
|
||||||
@ -196,8 +197,13 @@ const ClientInfo = () => {
|
|||||||
) : (
|
) : (
|
||||||
<ObjectTable
|
<ObjectTable
|
||||||
type='auditLog'
|
type='auditLog'
|
||||||
masterFilter={{ 'parent._id': clientId }}
|
masterFilter={{
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
parent:
|
||||||
|
getModelByName('client').prefix +
|
||||||
|
':' +
|
||||||
|
clientId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfoCollapse>
|
</InfoCollapse>
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
|||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
|
|
||||||
const log = loglevel.getLogger('ListingVarientInfo')
|
const log = loglevel.getLogger('ListingVarientInfo')
|
||||||
log.setLevel(config.logLevel)
|
log.setLevel(config.logLevel)
|
||||||
@ -32,7 +33,6 @@ const ListingVarientInfo = () => {
|
|||||||
const objectFormRef = useRef(null)
|
const objectFormRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -77,151 +77,154 @@ const ListingVarientInfo = () => {
|
|||||||
delete: () => {
|
delete: () => {
|
||||||
objectFormRef?.current?.handleDelete?.()
|
objectFormRef?.current?.handleDelete?.()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{ maxHeight: '100%', minHeight: 0 }}
|
style={{ maxHeight: '100%', minHeight: 0 }}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='listingVarient'
|
||||||
type='listingVarient'
|
id={listingVarientId}
|
||||||
id={listingVarientId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Listing Varient Information' },
|
||||||
{ key: 'info', label: 'Listing Varient Information' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='listingVarient'
|
||||||
type='listingVarient'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='listingVarient'
|
||||||
type='listingVarient'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={listingVarientId}
|
}
|
||||||
objectType='listingVarient'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={listingVarientId}
|
||||||
<ScrollBox>
|
objectType='listingVarient'
|
||||||
<Flex vertical gap={'large'}>
|
showEndingDivider={true}
|
||||||
<ActionHandler
|
/>
|
||||||
actions={actions}
|
</Space>
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={listingVarientId}
|
|
||||||
type='listingVarient'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Listing Varient Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='listingVarient'
|
|
||||||
objectData={objectData}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</ActionHandler>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={listingVarientId} type='listingVarient' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': listingVarientId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={listingVarientId}
|
||||||
|
type='listingVarient'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Listing Varient Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('info', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='listingVarient'
|
||||||
|
objectData={objectData}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</ActionHandler>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={listingVarientId} type='listingVarient' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('listingVarient').prefix +
|
||||||
|
':' +
|
||||||
|
listingVarientId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
|
|||||||
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
|
||||||
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
|
||||||
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('ListingInfo')
|
const log = loglevel.getLogger('ListingInfo')
|
||||||
@ -34,7 +35,6 @@ const ListingInfo = () => {
|
|||||||
const listingVarientsTableRef = useRef(null)
|
const listingVarientsTableRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -75,171 +75,174 @@ const ListingInfo = () => {
|
|||||||
delete: () => {
|
delete: () => {
|
||||||
objectFormRef?.current?.handleDelete?.()
|
objectFormRef?.current?.handleDelete?.()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{ maxHeight: '100%', minHeight: 0 }}
|
style={{ maxHeight: '100%', minHeight: 0 }}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='listing'
|
||||||
type='listing'
|
id={listingId}
|
||||||
id={listingId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Listing Information' },
|
||||||
{ key: 'info', label: 'Listing Information' },
|
{ key: 'listingVarients', label: 'Listing Varients' },
|
||||||
{ key: 'listingVarients', label: 'Listing Varients' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='listing'
|
||||||
type='listing'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='listing'
|
||||||
type='listing'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={listingId}
|
}
|
||||||
objectType='listing'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={listingId}
|
||||||
<ScrollBox>
|
objectType='listing'
|
||||||
<Flex vertical gap={'large'}>
|
showEndingDivider={true}
|
||||||
<ActionHandler
|
/>
|
||||||
actions={actions}
|
</Space>
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={listingId}
|
|
||||||
type='listing'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Listing Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='listing'
|
|
||||||
labelWidth={165}
|
|
||||||
objectData={objectData}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Listing Varients'
|
|
||||||
icon={<ListingVarientIcon />}
|
|
||||||
active={collapseState.listingVarients}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('listingVarients', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='listingVarients'
|
|
||||||
>
|
|
||||||
<ObjectTable
|
|
||||||
type='listingVarient'
|
|
||||||
masterFilter={{
|
|
||||||
'listing._id': listingId
|
|
||||||
}}
|
|
||||||
visibleColumns={{ listing: false }}
|
|
||||||
ref={listingVarientsTableRef}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</ActionHandler>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={listingId} type='listing' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': listingId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={listingId}
|
||||||
|
type='listing'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Listing Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('info', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='listing'
|
||||||
|
labelWidth={165}
|
||||||
|
objectData={objectData}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Listing Varients'
|
||||||
|
icon={<ListingVarientIcon />}
|
||||||
|
active={collapseState.listingVarients}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('listingVarients', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='listingVarients'
|
||||||
|
>
|
||||||
|
<ObjectTable
|
||||||
|
type='listingVarient'
|
||||||
|
masterFilter={{
|
||||||
|
listing: getModelByName('listing').prefix + ':' + listingId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ listing: false }}
|
||||||
|
ref={listingVarientsTableRef}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</ActionHandler>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={listingId} type='listing' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('listing').prefix +
|
||||||
|
':' +
|
||||||
|
listingId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useContext, useRef, useState , useEffect} from 'react'
|
import { useContext, useRef, useState, useEffect } from 'react'
|
||||||
import { useLocation } from 'react-router-dom'
|
import { useLocation } from 'react-router-dom'
|
||||||
import { Card, Flex, message, Space } from 'antd'
|
import { Card, Flex, message, Space } from 'antd'
|
||||||
import loglevel from 'loglevel'
|
import loglevel from 'loglevel'
|
||||||
@ -25,6 +25,7 @@ import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
|
|||||||
import ScrollBox from '../../common/ScrollBox.jsx'
|
import ScrollBox from '../../common/ScrollBox.jsx'
|
||||||
import { ApiServerContext } from '../../context/ApiServerContext.jsx'
|
import { ApiServerContext } from '../../context/ApiServerContext.jsx'
|
||||||
import { ElectronContext } from '../../context/ElectronContext.jsx'
|
import { ElectronContext } from '../../context/ElectronContext.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import {
|
import {
|
||||||
buildMarketplaceAuthState,
|
buildMarketplaceAuthState,
|
||||||
storeMarketplaceAuthState
|
storeMarketplaceAuthState
|
||||||
@ -38,7 +39,6 @@ const MarketplaceInfo = () => {
|
|||||||
const objectFormRef = useRef(null)
|
const objectFormRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -148,144 +148,147 @@ const MarketplaceInfo = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{ maxHeight: '100%', minHeight: 0 }}
|
style={{ maxHeight: '100%', minHeight: 0 }}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='marketplace'
|
||||||
type='marketplace'
|
id={marketplaceId}
|
||||||
id={marketplaceId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Marketplace Information' },
|
||||||
{ key: 'info', label: 'Marketplace Information' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='marketplace'
|
||||||
type='marketplace'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='marketplace'
|
||||||
type='marketplace'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={marketplaceId}
|
}
|
||||||
objectType='marketplace'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={marketplaceId}
|
||||||
<ScrollBox>
|
objectType='marketplace'
|
||||||
<Flex vertical gap={'large'}>
|
showEndingDivider={true}
|
||||||
<ActionHandler
|
/>
|
||||||
actions={actions}
|
</Space>
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Marketplace Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={marketplaceId}
|
|
||||||
type='marketplace'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='marketplace'
|
|
||||||
labelWidth={215}
|
|
||||||
objectData={objectData}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</InfoCollapse>
|
|
||||||
</ActionHandler>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={marketplaceId} type='marketplace' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': marketplaceId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Marketplace Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={marketplaceId}
|
||||||
|
type='marketplace'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='marketplace'
|
||||||
|
labelWidth={215}
|
||||||
|
objectData={objectData}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</InfoCollapse>
|
||||||
|
</ActionHandler>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={marketplaceId} type='marketplace' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('marketplace').prefix +
|
||||||
|
':' +
|
||||||
|
marketplaceId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import ScrollBox from '../../common/ScrollBox.jsx'
|
|||||||
import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx'
|
import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx'
|
||||||
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
|
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
|
||||||
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
|
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
|
||||||
|
import { getModelByName } from '../../../../database/ObjectModels.js'
|
||||||
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
|
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
|
||||||
|
|
||||||
const log = loglevel.getLogger('SalesOrderInfo')
|
const log = loglevel.getLogger('SalesOrderInfo')
|
||||||
@ -39,7 +40,6 @@ const SalesOrderInfo = () => {
|
|||||||
const shipmentsTableRef = useRef(null)
|
const shipmentsTableRef = useRef(null)
|
||||||
const actionHandlerRef = useRef(null)
|
const actionHandlerRef = useRef(null)
|
||||||
|
|
||||||
|
|
||||||
const { setOnModalOk } = useActions()
|
const { setOnModalOk } = useActions()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOnModalOk(() => () => {
|
setOnModalOk(() => () => {
|
||||||
@ -90,244 +90,247 @@ const SalesOrderInfo = () => {
|
|||||||
delete: () => {
|
delete: () => {
|
||||||
objectFormRef?.current?.handleDelete?.()
|
objectFormRef?.current?.handleDelete?.()
|
||||||
return true
|
return true
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
gap='large'
|
gap='large'
|
||||||
vertical='true'
|
vertical='true'
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
minHeight: 0
|
minHeight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Space size='small'>
|
<ObjectActions
|
||||||
<ObjectActions
|
type='salesOrder'
|
||||||
type='salesOrder'
|
id={salesOrderId}
|
||||||
id={salesOrderId}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
/>
|
||||||
/>
|
<ViewButton
|
||||||
<ViewButton
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
items={[
|
||||||
items={[
|
{ key: 'info', label: 'Sales Order Information' },
|
||||||
{ key: 'info', label: 'Sales 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: 'invoices', label: 'Invoices' },
|
{ key: 'stockEvents', label: 'Stock Events' },
|
||||||
{ key: 'stockEvents', label: 'Stock Events' },
|
{ key: 'notes', label: 'Notes' },
|
||||||
{ key: 'notes', label: 'Notes' },
|
{ key: 'auditLogs', label: 'Audit Logs' }
|
||||||
{ key: 'auditLogs', label: 'Audit Logs' }
|
]}
|
||||||
]}
|
visibleState={collapseState}
|
||||||
visibleState={collapseState}
|
updateVisibleState={updateCollapseState}
|
||||||
updateVisibleState={updateCollapseState}
|
/>
|
||||||
/>
|
<UserNotifierToggle
|
||||||
<UserNotifierToggle
|
type='salesOrder'
|
||||||
type='salesOrder'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
/>
|
||||||
/>
|
<DocumentPrintButton
|
||||||
<DocumentPrintButton
|
type='salesOrder'
|
||||||
type='salesOrder'
|
objectData={objectFormState.objectData}
|
||||||
objectData={objectFormState.objectData}
|
disabled={objectFormState.loading}
|
||||||
disabled={objectFormState.loading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
<ActivityIndicator
|
|
||||||
activities={objectFormState.activities}
|
|
||||||
showStartingDivider={true}
|
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Space>
|
<ActivityIndicator
|
||||||
<EditButtons
|
activities={objectFormState.activities}
|
||||||
isEditing={objectFormState.isEditing}
|
showStartingDivider={true}
|
||||||
handleUpdate={() => {
|
/>
|
||||||
actionHandlerRef.current.callAction('finishEdit')
|
</Space>
|
||||||
}}
|
<Space>
|
||||||
cancelEditing={() => {
|
<EditButtons
|
||||||
actionHandlerRef.current.callAction('cancelEdit')
|
isEditing={objectFormState.isEditing}
|
||||||
}}
|
handleUpdate={() => {
|
||||||
startEditing={() => {
|
actionHandlerRef.current.callAction('finishEdit')
|
||||||
actionHandlerRef.current.callAction('edit')
|
}}
|
||||||
}}
|
cancelEditing={() => {
|
||||||
editLoading={objectFormState.editLoading}
|
actionHandlerRef.current.callAction('cancelEdit')
|
||||||
formValid={objectFormState.formValid}
|
}}
|
||||||
disabled={
|
startEditing={() => {
|
||||||
objectFormState.beingEditedByOther ||
|
actionHandlerRef.current.callAction('edit')
|
||||||
objectFormState.loading ||
|
}}
|
||||||
objectFormState.editDisabled
|
editLoading={objectFormState.editLoading}
|
||||||
}
|
formValid={objectFormState.formValid}
|
||||||
loading={objectFormState.editLoading}
|
disabled={
|
||||||
/>
|
objectFormState.beingEditedByOther ||
|
||||||
<ObjectTableNavigationButtons
|
objectFormState.loading ||
|
||||||
disabled={objectFormState.loading || objectFormState.isEditing}
|
objectFormState.editDisabled
|
||||||
_id={salesOrderId}
|
}
|
||||||
objectType='salesOrder'
|
loading={objectFormState.editLoading}
|
||||||
showEndingDivider={true}
|
/>
|
||||||
/>
|
<ObjectTableNavigationButtons
|
||||||
</Space>
|
disabled={objectFormState.loading || objectFormState.isEditing}
|
||||||
</Flex>
|
_id={salesOrderId}
|
||||||
|
objectType='salesOrder'
|
||||||
<ScrollBox>
|
showEndingDivider={true}
|
||||||
<Flex vertical gap={'large'}>
|
/>
|
||||||
<ActionHandler
|
</Space>
|
||||||
actions={actions}
|
|
||||||
loading={objectFormState.loading}
|
|
||||||
ref={actionHandlerRef}
|
|
||||||
>
|
|
||||||
<ObjectForm
|
|
||||||
id={salesOrderId}
|
|
||||||
type='salesOrder'
|
|
||||||
style={{ height: '100%' }}
|
|
||||||
ref={objectFormRef}
|
|
||||||
setCurrentObject={true}
|
|
||||||
onStateChange={(state) => {
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ loading, isEditing, objectData }) => (
|
|
||||||
<Flex vertical gap={'large'}>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Sales Order Information'
|
|
||||||
icon={<InfoCircleIcon />}
|
|
||||||
active={collapseState.info}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('info', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='info'
|
|
||||||
>
|
|
||||||
<ObjectInfo
|
|
||||||
loading={loading}
|
|
||||||
indicator={<LoadingOutlined />}
|
|
||||||
isEditing={isEditing}
|
|
||||||
type='salesOrder'
|
|
||||||
labelWidth='225px'
|
|
||||||
objectData={objectData}
|
|
||||||
visibleProperties={{
|
|
||||||
items: false
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Sales Order Items'
|
|
||||||
icon={<OrderItemsIcon />}
|
|
||||||
active={collapseState.orderItems}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('orderItems', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='orderItems'
|
|
||||||
>
|
|
||||||
<ObjectTable
|
|
||||||
type='orderItem'
|
|
||||||
masterFilter={{
|
|
||||||
'order._id': salesOrderId,
|
|
||||||
orderType: 'salesOrder'
|
|
||||||
}}
|
|
||||||
visibleColumns={{ order: false }}
|
|
||||||
ref={orderItemsTableRef}
|
|
||||||
/>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Shipments'
|
|
||||||
icon={<ShipmentIcon />}
|
|
||||||
active={collapseState.shipments}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('shipments', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='shipments'
|
|
||||||
>
|
|
||||||
<ObjectTable
|
|
||||||
type='shipment'
|
|
||||||
masterFilter={{
|
|
||||||
'order._id': salesOrderId,
|
|
||||||
orderType: 'salesOrder'
|
|
||||||
}}
|
|
||||||
visibleColumns={{ order: false }}
|
|
||||||
ref={shipmentsTableRef}
|
|
||||||
/>
|
|
||||||
</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': salesOrderId,
|
|
||||||
orderType: 'salesOrder'
|
|
||||||
}}
|
|
||||||
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': salesOrderId
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</ObjectForm>
|
|
||||||
</ActionHandler>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Notes'
|
|
||||||
icon={<NoteIcon />}
|
|
||||||
active={collapseState.notes}
|
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
|
||||||
collapseKey='notes'
|
|
||||||
>
|
|
||||||
<Card>
|
|
||||||
<NotesPanel _id={salesOrderId} type='salesOrder' />
|
|
||||||
</Card>
|
|
||||||
</InfoCollapse>
|
|
||||||
<InfoCollapse
|
|
||||||
title='Audit Logs'
|
|
||||||
icon={<AuditLogIcon />}
|
|
||||||
active={collapseState.auditLogs}
|
|
||||||
onToggle={(expanded) =>
|
|
||||||
updateCollapseState('auditLogs', expanded)
|
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': salesOrderId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
|
||||||
</ScrollBox>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<ScrollBox>
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<ActionHandler
|
||||||
|
actions={actions}
|
||||||
|
loading={objectFormState.loading}
|
||||||
|
ref={actionHandlerRef}
|
||||||
|
>
|
||||||
|
<ObjectForm
|
||||||
|
id={salesOrderId}
|
||||||
|
type='salesOrder'
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
ref={objectFormRef}
|
||||||
|
setCurrentObject={true}
|
||||||
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({ loading, isEditing, objectData }) => (
|
||||||
|
<Flex vertical gap={'large'}>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Sales Order Information'
|
||||||
|
icon={<InfoCircleIcon />}
|
||||||
|
active={collapseState.info}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('info', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='info'
|
||||||
|
>
|
||||||
|
<ObjectInfo
|
||||||
|
loading={loading}
|
||||||
|
indicator={<LoadingOutlined />}
|
||||||
|
isEditing={isEditing}
|
||||||
|
type='salesOrder'
|
||||||
|
labelWidth='225px'
|
||||||
|
objectData={objectData}
|
||||||
|
visibleProperties={{
|
||||||
|
items: false
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Sales Order Items'
|
||||||
|
icon={<OrderItemsIcon />}
|
||||||
|
active={collapseState.orderItems}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('orderItems', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='orderItems'
|
||||||
|
>
|
||||||
|
<ObjectTable
|
||||||
|
type='orderItem'
|
||||||
|
masterFilter={{
|
||||||
|
order: getModelByName('salesOrder').prefix + ':' + salesOrderId,
|
||||||
|
orderType: 'salesOrder'
|
||||||
|
}}
|
||||||
|
visibleColumns={{ order: false }}
|
||||||
|
ref={orderItemsTableRef}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Shipments'
|
||||||
|
icon={<ShipmentIcon />}
|
||||||
|
active={collapseState.shipments}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('shipments', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='shipments'
|
||||||
|
>
|
||||||
|
<ObjectTable
|
||||||
|
type='shipment'
|
||||||
|
masterFilter={{
|
||||||
|
order: getModelByName('salesOrder').prefix + ':' + salesOrderId,
|
||||||
|
orderType: 'salesOrder'
|
||||||
|
}}
|
||||||
|
visibleColumns={{ order: false }}
|
||||||
|
ref={shipmentsTableRef}
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Invoices'
|
||||||
|
icon={<InvoiceIcon />}
|
||||||
|
active={collapseState.invoices}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('invoices', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='invoices'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='invoice'
|
||||||
|
masterFilter={{
|
||||||
|
order: getModelByName('salesOrder').prefix + ':' + salesOrderId,
|
||||||
|
orderType: 'salesOrder'
|
||||||
|
}}
|
||||||
|
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: getModelByName('salesOrder').prefix + ':' + salesOrderId
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
|
</ActionHandler>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Notes'
|
||||||
|
icon={<NoteIcon />}
|
||||||
|
active={collapseState.notes}
|
||||||
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
|
collapseKey='notes'
|
||||||
|
>
|
||||||
|
<Card>
|
||||||
|
<NotesPanel _id={salesOrderId} type='salesOrder' />
|
||||||
|
</Card>
|
||||||
|
</InfoCollapse>
|
||||||
|
<InfoCollapse
|
||||||
|
title='Audit Logs'
|
||||||
|
icon={<AuditLogIcon />}
|
||||||
|
active={collapseState.auditLogs}
|
||||||
|
onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
|
||||||
|
collapseKey='auditLogs'
|
||||||
|
>
|
||||||
|
{objectFormState.loading ? (
|
||||||
|
<InfoCollapsePlaceholder />
|
||||||
|
) : (
|
||||||
|
<ObjectTable
|
||||||
|
type='auditLog'
|
||||||
|
masterFilter={{
|
||||||
|
parent:
|
||||||
|
getModelByName('salesOrder').prefix +
|
||||||
|
':' +
|
||||||
|
salesOrderId
|
||||||
|
}}
|
||||||
|
visibleColumns={{ _id: false, parent: false }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
</ScrollBox>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -78,9 +78,7 @@ const ElipsisText = ({ children, style, className, title, code, ...rest }) => {
|
|||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className={
|
className={showTruncated ? 'elipsis-text is-truncated' : 'elipsis-text'}
|
||||||
showTruncated ? 'elipsis-text is-truncated' : 'elipsis-text'
|
|
||||||
}
|
|
||||||
ref={containerRef}
|
ref={containerRef}
|
||||||
>
|
>
|
||||||
<RootTag className='elipsis-text-measure' ref={measureRef}>
|
<RootTag className='elipsis-text-measure' ref={measureRef}>
|
||||||
|
|||||||
@ -71,7 +71,9 @@ const NoteItem = ({
|
|||||||
setChildNotesLoading(true)
|
setChildNotesLoading(true)
|
||||||
try {
|
try {
|
||||||
const childNotesData = await fetchObjects('note', {
|
const childNotesData = await fetchObjects('note', {
|
||||||
filter: { 'parent._id': note._id }
|
filter: {
|
||||||
|
parent: getModelByName('note').prefix + ':' + note._id
|
||||||
|
}
|
||||||
})
|
})
|
||||||
setChildNotes(childNotesData.data)
|
setChildNotes(childNotesData.data)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -105,7 +107,7 @@ const NoteItem = ({
|
|||||||
if (isExpanded == true) {
|
if (isExpanded == true) {
|
||||||
subscribeToObjectTypeUpdatesRef.current = subscribeToObjectTypeUpdates(
|
subscribeToObjectTypeUpdatesRef.current = subscribeToObjectTypeUpdates(
|
||||||
'note',
|
'note',
|
||||||
{ 'parent._id': note._id },
|
{ parent: getModelByName('note').prefix + ':' + note._id },
|
||||||
() => {
|
() => {
|
||||||
if (isExpanded == true) {
|
if (isExpanded == true) {
|
||||||
handleNoteExpand()
|
handleNoteExpand()
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import InfoCircleIcon from '../../Icons/InfoCircleIcon'
|
|||||||
import ReloadIcon from '../../Icons/ReloadIcon'
|
import ReloadIcon from '../../Icons/ReloadIcon'
|
||||||
import NewNote from '../Management/Notes/NewNote'
|
import NewNote from '../Management/Notes/NewNote'
|
||||||
import NoteItem from './NoteItem'
|
import NoteItem from './NoteItem'
|
||||||
|
import { getModelByName } from '../../../database/ObjectModels.js'
|
||||||
|
|
||||||
const { Text } = Typography
|
const { Text } = Typography
|
||||||
|
|
||||||
@ -40,14 +41,14 @@ const NotesPanel = ({ _id, type }) => {
|
|||||||
const fetchData = useCallback(
|
const fetchData = useCallback(
|
||||||
async (id) => {
|
async (id) => {
|
||||||
try {
|
try {
|
||||||
const newData = await fetchNotes(id)
|
const newData = await fetchNotes(id, type)
|
||||||
return newData
|
return newData
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setError(error)
|
setError(error)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[fetchNotes]
|
[fetchNotes, type]
|
||||||
)
|
)
|
||||||
|
|
||||||
const generateNotes = useCallback(
|
const generateNotes = useCallback(
|
||||||
@ -98,7 +99,7 @@ const NotesPanel = ({ _id, type }) => {
|
|||||||
if (connected == true && subscribeToObjectTypeUpdatesRef.current == null) {
|
if (connected == true && subscribeToObjectTypeUpdatesRef.current == null) {
|
||||||
subscribeToObjectTypeUpdatesRef.current = subscribeToObjectTypeUpdates(
|
subscribeToObjectTypeUpdatesRef.current = subscribeToObjectTypeUpdates(
|
||||||
'note',
|
'note',
|
||||||
{ 'parent._id': _id },
|
{ parent: getModelByName(type).prefix + ':' + _id },
|
||||||
() => handleReloadData()
|
() => handleReloadData()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1543,12 +1543,12 @@ const ApiServerProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch notes for a specific parent
|
// Fetch notes for a specific parent
|
||||||
const fetchNotes = async (parentId) => {
|
const fetchNotes = async (parentId, parentType) => {
|
||||||
logger.debug('Fetching notes for parent:', parentId)
|
logger.debug('Fetching notes for parent:', parentId, parentType)
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`${config.backendUrl}/notes`, {
|
const response = await axios.get(`${config.backendUrl}/notes`, {
|
||||||
params: {
|
params: {
|
||||||
'parent._id': parentId,
|
parent: getModelByName(parentType).prefix + ':' + parentId,
|
||||||
sort: 'createdAt',
|
sort: 'createdAt',
|
||||||
order: 'ascend'
|
order: 'ascend'
|
||||||
},
|
},
|
||||||
@ -1564,7 +1564,7 @@ const ApiServerProvider = ({ children }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
showError(err, () => {
|
showError(err, () => {
|
||||||
fetchNotes(parentId)
|
fetchNotes(parentId, parentType)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,6 @@ export const AppPassword = {
|
|||||||
'name',
|
'name',
|
||||||
'user',
|
'user',
|
||||||
'active',
|
'active',
|
||||||
'user._id',
|
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
|
|||||||
@ -17,8 +17,8 @@ export const AuditLog = {
|
|||||||
'createdAt'
|
'createdAt'
|
||||||
],
|
],
|
||||||
filters: [
|
filters: [
|
||||||
'parent._id',
|
'parent',
|
||||||
'owner._id',
|
'owner',
|
||||||
'operation',
|
'operation',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
|
|||||||
@ -89,7 +89,6 @@ export const CourierService = {
|
|||||||
filters: [
|
filters: [
|
||||||
'_id',
|
'_id',
|
||||||
'courier',
|
'courier',
|
||||||
'courier._id',
|
|
||||||
'name',
|
'name',
|
||||||
'active',
|
'active',
|
||||||
'tracked',
|
'tracked',
|
||||||
|
|||||||
@ -110,7 +110,6 @@ export const Filament = {
|
|||||||
filters: [
|
filters: [
|
||||||
'_id',
|
'_id',
|
||||||
'material',
|
'material',
|
||||||
'material._id',
|
|
||||||
'diameter',
|
'diameter',
|
||||||
'name',
|
'name',
|
||||||
'cost',
|
'cost',
|
||||||
|
|||||||
@ -90,7 +90,6 @@ export const FilamentSku = {
|
|||||||
'_id',
|
'_id',
|
||||||
'barcode',
|
'barcode',
|
||||||
'filament',
|
'filament',
|
||||||
'filament._id',
|
|
||||||
'name',
|
'name',
|
||||||
'color',
|
'color',
|
||||||
'cost',
|
'cost',
|
||||||
|
|||||||
@ -45,14 +45,11 @@ export const FilamentStock = {
|
|||||||
],
|
],
|
||||||
filters: [
|
filters: [
|
||||||
'filament',
|
'filament',
|
||||||
'filament._id',
|
|
||||||
'filamentSku',
|
'filamentSku',
|
||||||
'state',
|
'state',
|
||||||
'startingWeight',
|
'startingWeight',
|
||||||
'currentWeight',
|
'currentWeight',
|
||||||
'filamentSku._id',
|
|
||||||
'stockLocation',
|
'stockLocation',
|
||||||
'stockLocation._id',
|
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
|
|||||||
@ -101,9 +101,7 @@ export const GCodeFile = {
|
|||||||
'_id',
|
'_id',
|
||||||
'name',
|
'name',
|
||||||
'filament',
|
'filament',
|
||||||
'filament._id',
|
|
||||||
'filamentSku',
|
'filamentSku',
|
||||||
'filamentSku._id',
|
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
|
|||||||
@ -166,10 +166,7 @@ export const Invoice = {
|
|||||||
'vendor',
|
'vendor',
|
||||||
'client',
|
'client',
|
||||||
'state',
|
'state',
|
||||||
'vendor._id',
|
|
||||||
'client._id',
|
|
||||||
'order',
|
'order',
|
||||||
'order._id',
|
|
||||||
'orderType',
|
'orderType',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
|
|||||||
@ -122,7 +122,6 @@ export const ListingVarient = {
|
|||||||
],
|
],
|
||||||
filters: [
|
filters: [
|
||||||
'listing',
|
'listing',
|
||||||
'listing._id',
|
|
||||||
'product',
|
'product',
|
||||||
'productSku',
|
'productSku',
|
||||||
'state',
|
'state',
|
||||||
|
|||||||
@ -56,12 +56,10 @@ export const Note = {
|
|||||||
filters: [
|
filters: [
|
||||||
'_id',
|
'_id',
|
||||||
'user',
|
'user',
|
||||||
'user._id',
|
|
||||||
'parentType',
|
'parentType',
|
||||||
'parent',
|
'parent',
|
||||||
'parent._id',
|
'parent',
|
||||||
'noteType',
|
'noteType',
|
||||||
'noteType._id',
|
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
|
|||||||
@ -87,12 +87,9 @@ export const OrderItem = {
|
|||||||
'name',
|
'name',
|
||||||
'itemType',
|
'itemType',
|
||||||
'item',
|
'item',
|
||||||
'item._id',
|
|
||||||
'order',
|
'order',
|
||||||
'order._id',
|
|
||||||
'orderType',
|
'orderType',
|
||||||
'shipment',
|
'shipment',
|
||||||
'shipment._id',
|
|
||||||
'state',
|
'state',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
|
|||||||
@ -92,7 +92,6 @@ export const PartSku = {
|
|||||||
'_id',
|
'_id',
|
||||||
'barcode',
|
'barcode',
|
||||||
'part',
|
'part',
|
||||||
'part._id',
|
|
||||||
'name',
|
'name',
|
||||||
'cost',
|
'cost',
|
||||||
'price',
|
'price',
|
||||||
|
|||||||
@ -36,9 +36,7 @@ export const PartStock = {
|
|||||||
'state',
|
'state',
|
||||||
'startingQuantity',
|
'startingQuantity',
|
||||||
'currentQuantity',
|
'currentQuantity',
|
||||||
'partSku._id',
|
|
||||||
'stockLocation',
|
'stockLocation',
|
||||||
'stockLocation._id',
|
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
|
|||||||
@ -163,10 +163,7 @@ export const Payment = {
|
|||||||
'vendor',
|
'vendor',
|
||||||
'client',
|
'client',
|
||||||
'state',
|
'state',
|
||||||
'vendor._id',
|
|
||||||
'client._id',
|
|
||||||
'invoice',
|
'invoice',
|
||||||
'invoice._id',
|
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
|
|||||||
@ -102,7 +102,6 @@ export const Product = {
|
|||||||
'name',
|
'name',
|
||||||
'globalPrice',
|
'globalPrice',
|
||||||
'productCategory',
|
'productCategory',
|
||||||
'productCategory._id',
|
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
|
|||||||
@ -92,7 +92,6 @@ export const ProductSku = {
|
|||||||
'_id',
|
'_id',
|
||||||
'barcode',
|
'barcode',
|
||||||
'product',
|
'product',
|
||||||
'product._id',
|
|
||||||
'name',
|
'name',
|
||||||
'cost',
|
'cost',
|
||||||
'price',
|
'price',
|
||||||
|
|||||||
@ -7,6 +7,7 @@ const PostProductStock = lazy(
|
|||||||
() => import('../../components/Dashboard/Inventory/ProductStocks/PostProductStock')
|
() => import('../../components/Dashboard/Inventory/ProductStocks/PostProductStock')
|
||||||
)
|
)
|
||||||
import ProductStockIcon from '../../components/Icons/ProductStockIcon'
|
import ProductStockIcon from '../../components/Icons/ProductStockIcon'
|
||||||
|
import { getModelByName } from '../ObjectModels.js'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
import EditIcon from '../../components/Icons/EditIcon'
|
import EditIcon from '../../components/Icons/EditIcon'
|
||||||
import CheckIcon from '../../components/Icons/CheckIcon'
|
import CheckIcon from '../../components/Icons/CheckIcon'
|
||||||
@ -103,9 +104,7 @@ export const ProductStock = {
|
|||||||
'productSku',
|
'productSku',
|
||||||
'state',
|
'state',
|
||||||
'currentQuantity',
|
'currentQuantity',
|
||||||
'productSku._id',
|
|
||||||
'stockLocation',
|
'stockLocation',
|
||||||
'stockLocation._id',
|
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
@ -227,7 +226,9 @@ export const ProductStock = {
|
|||||||
masterFilter: (objectData) => {
|
masterFilter: (objectData) => {
|
||||||
const partSkuId = objectData?.partSku?._id
|
const partSkuId = objectData?.partSku?._id
|
||||||
if (partSkuId == null) return {}
|
if (partSkuId == null) return {}
|
||||||
return { 'partSku._id': partSkuId }
|
return {
|
||||||
|
partSku: getModelByName('partSku').prefix + ':' + partSkuId
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -231,7 +231,6 @@ export const PurchaseOrder = {
|
|||||||
'vendor',
|
'vendor',
|
||||||
'state',
|
'state',
|
||||||
'value',
|
'value',
|
||||||
'vendor._id',
|
|
||||||
'totalAmount',
|
'totalAmount',
|
||||||
'totalAmountWithTax',
|
'totalAmountWithTax',
|
||||||
'totalTaxAmount',
|
'totalTaxAmount',
|
||||||
|
|||||||
@ -238,7 +238,6 @@ export const SalesOrder = {
|
|||||||
'client',
|
'client',
|
||||||
'state',
|
'state',
|
||||||
'value',
|
'value',
|
||||||
'client._id',
|
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
|
|||||||
@ -147,7 +147,6 @@ export const Shipment = {
|
|||||||
'order',
|
'order',
|
||||||
'state',
|
'state',
|
||||||
'courierService',
|
'courierService',
|
||||||
'order._id',
|
|
||||||
'taxRate',
|
'taxRate',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
|
|||||||
@ -9,14 +9,8 @@ export const StockEvent = {
|
|||||||
icon: StockEventIcon,
|
icon: StockEventIcon,
|
||||||
actions: [],
|
actions: [],
|
||||||
columns: ['_reference', 'owner', 'parent', 'value', 'createdAt', 'updatedAt'],
|
columns: ['_reference', 'owner', 'parent', 'value', 'createdAt', 'updatedAt'],
|
||||||
filters: [
|
filters: ['owner', 'parent', 'createdAt', 'updatedAt', '_reference'],
|
||||||
'owner._id',
|
sorters: ['createdAt', 'updatedAt'],
|
||||||
'parent._id',
|
|
||||||
'createdAt',
|
|
||||||
'updatedAt',
|
|
||||||
'_reference'
|
|
||||||
],
|
|
||||||
sorters: ['createdAt','updatedAt'],
|
|
||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
name: '_id',
|
name: '_id',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user