Compare commits

..

No commits in common. "f2ccec483f861950f29bf2d7b529ee4d7ef3a9f2" and "93bd485ae37464bb8e53d8b8ff80128d9000c2b1" have entirely different histories.

97 changed files with 2986 additions and 3706 deletions

View File

@ -330,28 +330,6 @@ code {
padding: 0 !important;
}
.iddisplay > *:first-child {
min-width: 0;
flex: 0 1 auto;
max-width: 100%;
overflow: hidden;
}
.iddisplay .ant-btn {
flex-shrink: 0;
}
.miscid > *:first-child {
min-width: 0;
flex: 0 1 auto;
max-width: 100%;
overflow: hidden;
}
.miscid .ant-btn {
flex-shrink: 0;
}
.ant-popover-inner:has(.spotlight-tooltip) {
padding: 0 !important;
}
@ -1161,150 +1139,3 @@ span.ant-skeleton-input.ant-skeleton-input-sm.text-skeleton {
.filter-sidebar-field-select .ant-select-selector {
width: max-content !important;
}
.elipsis-text-wrapper.ant-typography {
display: block;
min-width: 0;
max-width: 100%;
width: auto;
overflow: hidden;
flex-grow: 0;
flex-shrink: 1;
flex-basis: auto;
}
.elipsis-text-wrapper.ant-typography .elipsis-text {
display: flex;
flex-direction: row;
align-items: baseline;
width: 100%;
max-width: 100%;
min-width: 0;
position: relative;
overflow: hidden;
white-space: pre;
}
.elipsis-text-wrapper.ant-typography code.elipsis-text-measure,
.elipsis-text-wrapper.ant-typography code.elipsis-text-full,
.elipsis-text-wrapper.ant-typography code.elipsis-text-truncated {
margin: 0;
box-sizing: border-box;
}
.elipsis-text-measure {
position: absolute;
visibility: hidden;
pointer-events: none;
white-space: pre;
}
.elipsis-text-full {
display: none;
position: absolute;
left: 0;
top: 0;
width: max-content;
max-width: 100%;
min-width: 0;
overflow: hidden;
white-space: pre;
}
.elipsis-text:not(.is-truncated) .elipsis-text-full {
display: inline-block;
}
.elipsis-text.is-truncated .elipsis-text-full {
display: none;
}
.elipsis-text:not(.is-truncated) .elipsis-text-truncated .elipsis-text-dots {
display: none;
}
.elipsis-text:not(.is-truncated) .elipsis-text-truncated {
visibility: hidden;
}
.elipsis-text-truncated {
display: flex;
flex: 1 1 0;
align-items: baseline;
min-width: 0;
width: 100%;
max-width: 100%;
overflow: hidden;
white-space: pre;
}
.elipsis-text-wrapper.ant-typography code.elipsis-text-truncated {
display: flex;
}
.elipsis-text-start,
.elipsis-text-end {
flex: 1 1 0;
min-width: 0;
overflow: hidden;
white-space: pre;
}
.elipsis-text-start {
mask-image: linear-gradient(
to right,
#000 0%,
#000 calc(100% - 0.8em),
transparent 100%
);
-webkit-mask-image: linear-gradient(
to right,
#000 0%,
#000 calc(100% - 0.8em),
transparent 100%
);
}
.elipsis-text-end {
display: flex;
justify-content: flex-end;
mask-image: linear-gradient(
to left,
#000 0%,
#000 calc(100% - 0.8em),
transparent 100%
);
-webkit-mask-image: linear-gradient(
to left,
#000 0%,
#000 calc(100% - 0.8em),
transparent 100%
);
}
.elipsis-text-end-inner {
flex: 0 0 auto;
white-space: pre;
}
.elipsis-text-dots {
flex: 0 0 auto;
user-select: none;
}
.code-diff-viewer {
height: 70vh;
border: 1px solid #85858541;
}
.code-diff-viewer .cm-mergeView {
height: 100%;
overflow: auto;
}
.diff-label-square {
width: 7px;
height: 7px;
background-color: #85858541;
border-radius: 2px;
}

View File

@ -23,7 +23,6 @@
"@codemirror/lang-xml": "^6.1.0",
"@codemirror/lang-yaml": "^6.1.2",
"@codemirror/language": "6.12.1",
"@codemirror/merge": "^6.12.2",
"@codemirror/state": "6.7.1",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "6.39.12",
@ -239,8 +238,6 @@
"@codemirror/lint": ["@codemirror/lint@6.9.3", "", { "dependencies": { "@codemirror/state": "6.7.1", "@codemirror/view": "6.39.12", "crelt": "1.0.6" } }, "sha512-y3YkYhdnhjDBAe0VIA0c4wVoFOvnp8CnAvfLqi0TqotIv92wIlAAP7HELOpLBsKwjAX6W92rSflA6an/2zBvXw=="],
"@codemirror/merge": ["@codemirror/merge@6.12.2", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/highlight": "^1.0.0", "style-mod": "^4.1.0" } }, "sha512-V8JvyAPjHbPupqP7BeMcsdsYCbyPij74jxIbaIJDORI+VZzW44zFmon8bF+oxGWvOKhcRmkiUMXd8MxHr3YA2w=="],
"@codemirror/search": ["@codemirror/search@6.6.0", "", { "dependencies": { "@codemirror/state": "6.7.1", "@codemirror/view": "6.39.12", "crelt": "1.0.7" } }, "sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw=="],
"@codemirror/state": ["@codemirror/state@6.7.1", "", { "dependencies": { "@marijn/find-cluster-break": "1.0.3" } }, "sha512-9QzNDgE4EYDnAHfrTlR2lwiPciiOymLtwKK+8yHQzCc7GXhAP9xdEbEJFy2IWB1j9UGUl9BsgMmTo/ImA02T7A=="],

View File

@ -27,7 +27,6 @@
"@codemirror/lang-xml": "^6.1.0",
"@codemirror/lang-yaml": "^6.1.2",
"@codemirror/language": "6.12.1",
"@codemirror/merge": "^6.12.2",
"@codemirror/state": "6.7.1",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "6.39.12",

14
pnpm-lock.yaml generated
View File

@ -70,9 +70,6 @@ importers:
'@codemirror/language':
specifier: 6.12.1
version: 6.12.1
'@codemirror/merge':
specifier: ^6.12.2
version: 6.12.2
'@codemirror/state':
specifier: 6.7.1
version: 6.7.1
@ -614,9 +611,6 @@ packages:
'@codemirror/lint@6.9.3':
resolution: {integrity: sha512-y3YkYhdnhjDBAe0VIA0c4wVoFOvnp8CnAvfLqi0TqotIv92wIlAAP7HELOpLBsKwjAX6W92rSflA6an/2zBvXw==}
'@codemirror/merge@6.12.2':
resolution: {integrity: sha512-V8JvyAPjHbPupqP7BeMcsdsYCbyPij74jxIbaIJDORI+VZzW44zFmon8bF+oxGWvOKhcRmkiUMXd8MxHr3YA2w==}
'@codemirror/search@6.6.0':
resolution: {integrity: sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw==}
@ -7053,14 +7047,6 @@ snapshots:
'@codemirror/view': 6.39.12
crelt: 1.0.6
'@codemirror/merge@6.12.2':
dependencies:
'@codemirror/language': 6.12.1
'@codemirror/state': 6.7.1
'@codemirror/view': 6.39.12
'@lezer/highlight': 1.2.3
style-mod: 4.1.3
'@codemirror/search@6.6.0':
dependencies:
'@codemirror/state': 6.7.1

View File

@ -26,7 +26,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import OrderItemIcon from '../../../Icons/OrderItemIcon.jsx'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
@ -38,6 +38,7 @@ const InvoiceInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -81,218 +82,215 @@ const InvoiceInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='invoice'
id={invoiceId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Invoice Information' },
{ key: 'invoiceOrderItems', label: 'Invoice Order Items' },
{ key: 'invoiceShipments', label: 'Invoice Shipments' },
{ key: 'payments', label: 'Payments' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='invoice'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='invoice'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='invoice'
id={invoiceId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Invoice Information' },
{ key: 'invoiceOrderItems', label: 'Invoice Order Items' },
{ key: 'invoiceShipments', label: 'Invoice Shipments' },
{ key: 'payments', label: 'Payments' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='invoice'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='invoice'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={invoiceId}
objectType='invoice'
showEndingDivider={true}
/>
</Space>
</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 }))
<Space>
<EditButtons
isEditing={objectFormState.isEditing}
handleUpdate={() => {
actionHandlerRef.current.callAction('finishEdit')
}}
>
{({ 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>
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={invoiceId}
objectType='invoice'
showEndingDivider={true}
/>
</Space>
</Flex>
</ScrollBox>
</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._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>
)
}

View File

@ -23,7 +23,6 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('PaymentInfo')
@ -34,6 +33,7 @@ const PaymentInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -74,160 +74,157 @@ const PaymentInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='payment'
id={paymentId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Payment Information' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='payment'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='payment'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='payment'
id={paymentId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Payment Information' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='payment'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='payment'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={paymentId}
objectType='payment'
showEndingDivider={true}
/>
</Space>
</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 }))
<Space>
<EditButtons
isEditing={objectFormState.isEditing}
handleUpdate={() => {
actionHandlerRef.current.callAction('finishEdit')
}}
>
{({ 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>
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={paymentId}
objectType='payment'
showEndingDivider={true}
/>
</Space>
</Flex>
</ScrollBox>
</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._id': paymentId }}
visibleColumns={{ _id: false, 'parent._id': false }}
/>
)}
</InfoCollapse>
</Flex>
</ScrollBox>
</Flex>
)
}

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@ import InfoCollapse from '../../common/InfoCollapse.jsx'
import ObjectInfo from '../../common/ObjectInfo.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx'
import ViewButton from '../../common/ViewButton.jsx'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import InfoCircleIcon from '../../../Icons/InfoCircleIcon.jsx'
import NoteIcon from '../../../Icons/NoteIcon.jsx'
import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx'
@ -39,6 +39,7 @@ const ProductStockInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -87,220 +88,217 @@ const ProductStockInfo = () => {
delete: () => {
objectFormRef?.current.handleDelete?.()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='productStock'
id={productStockId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Product Stock Information' },
{ key: 'partStocks', label: 'Part Stocks' },
{ key: 'events', label: 'Product Stock Events' },
{ key: 'history', label: 'Product Stock History' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='productStock'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='productStock'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='productStock'
id={productStockId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Product Stock Information' },
{ key: 'partStocks', label: 'Part Stocks' },
{ key: 'events', label: 'Product Stock Events' },
{ key: 'history', label: 'Product Stock History' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='productStock'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='productStock'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={productStockId}
objectType='productStock'
showEndingDivider={true}
/>
</Space>
</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 }))
<Space>
<EditButtons
isEditing={objectFormState.isEditing}
handleUpdate={() => {
actionHandlerRef.current.callAction('finishEdit')
}}
>
{({ 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>
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={productStockId}
objectType='productStock'
showEndingDivider={true}
/>
</Space>
</Flex>
</ScrollBox>
</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._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>
)
}

View File

@ -27,7 +27,6 @@ import ScrollBox from '../../common/ScrollBox.jsx'
import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
const log = loglevel.getLogger('PurchaseOrderInfo')
@ -40,6 +39,7 @@ const PurchaseOrderInfo = () => {
const shipmentsTableRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -92,247 +92,244 @@ const PurchaseOrderInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='purchaseOrder'
id={purchaseOrderId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Purchase Order Information' },
{ key: 'orderItems', label: 'Order Items' },
{ key: 'shipments', label: 'Shipments' },
{ key: 'invoices', label: 'Invoices' },
{ key: 'stockEvents', label: 'Stock Events' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='purchaseOrder'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='purchaseOrder'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='purchaseOrder'
id={purchaseOrderId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Purchase Order Information' },
{ key: 'orderItems', label: 'Order Items' },
{ key: 'shipments', label: 'Shipments' },
{ key: 'invoices', label: 'Invoices' },
{ key: 'stockEvents', label: 'Stock Events' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='purchaseOrder'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='purchaseOrder'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={purchaseOrderId}
objectType='purchaseOrder'
showEndingDivider={true}
/>
</Space>
</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 }))
<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={purchaseOrderId}
objectType='purchaseOrder'
showEndingDivider={true}
/>
</Space>
</Flex>
<ScrollBox>
<Flex vertical gap={'large'}>
<ActionHandler
actions={actions}
loading={objectFormState.loading}
ref={actionHandlerRef}
>
{({ 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 />
) : (
<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='invoice'
type='orderItem'
masterFilter={{
order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
'order._id': purchaseOrderId,
orderType: 'purchaseOrder'
}}
visibleColumns={{ order: false }}
ref={orderItemsTableRef}
/>
)}
</InfoCollapse>
<InfoCollapse
title='Stock Events'
icon={<StockEventIcon />}
active={collapseState.stockEvents}
onToggle={(expanded) =>
updateCollapseState('stockEvents', expanded)
}
collapseKey='stockEvents'
>
{objectFormState.loading ? (
<InfoCollapsePlaceholder />
) : (
</InfoCollapse>
<InfoCollapse
title='Shipments'
icon={<ShipmentIcon />}
active={collapseState.shipments}
onToggle={(expanded) =>
updateCollapseState('shipments', expanded)
}
collapseKey='shipments'
>
<ObjectTable
type='stockEvent'
type='shipment'
masterFilter={{
owner: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId
'order._id': purchaseOrderId,
orderType: 'purchaseOrder'
}}
visibleColumns={{ order: false }}
ref={shipmentsTableRef}
/>
)}
</InfoCollapse>
</Flex>
</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 }}
/>
)}
</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>
</InfoCollapse>
</Flex>
</ScrollBox>
</Flex>
)
}

View File

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

View File

@ -24,7 +24,6 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import OrderItemIcon from '../../../Icons/OrderItemIcon.jsx'
const log = loglevel.getLogger('ShipmentInfo')
@ -35,6 +34,7 @@ const ShipmentInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -77,182 +77,179 @@ const ShipmentInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='shipment'
id={shipmentId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Shipment Information' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='shipment'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='shipment'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='shipment'
id={shipmentId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Shipment Information' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='shipment'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='shipment'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={shipmentId}
objectType='shipment'
showEndingDivider={true}
/>
</Space>
</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 }))
<Space>
<EditButtons
isEditing={objectFormState.isEditing}
handleUpdate={() => {
actionHandlerRef.current.callAction('finishEdit')
}}
>
{({ 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>
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={shipmentId}
objectType='shipment'
showEndingDivider={true}
/>
</Space>
</Flex>
</ScrollBox>
</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._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>
)
}

View File

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

View File

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

View File

@ -8,7 +8,7 @@ import InfoCollapse from '../../common/InfoCollapse.jsx'
import ObjectInfo from '../../common/ObjectInfo.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx'
import ViewButton from '../../common/ViewButton.jsx'
import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import InfoCircleIcon from '../../../Icons/InfoCircleIcon.jsx'
import NoteIcon from '../../../Icons/NoteIcon.jsx'
import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx'
@ -31,6 +31,7 @@ const StockTransferInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -77,181 +78,178 @@ const StockTransferInfo = () => {
delete: () => {
objectFormRef?.current.handleDelete?.()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='stockTransfer'
id={stockTransferId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Transfer' },
{ key: 'lines', label: 'Lines' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='stockTransfer'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='stockTransfer'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='stockTransfer'
id={stockTransferId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Transfer' },
{ key: 'lines', label: 'Lines' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='stockTransfer'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='stockTransfer'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={stockTransferId}
objectType='stockTransfer'
showEndingDivider={true}
/>
</Space>
</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 }))
<Space>
<EditButtons
isEditing={objectFormState.isEditing}
handleUpdate={() => {
actionHandlerRef.current.callAction('finishEdit')
}}
>
{({ 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>
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={stockTransferId}
objectType='stockTransfer'
showEndingDivider={true}
/>
</Space>
</Flex>
</ScrollBox>
</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._id': stockTransferId }}
visibleColumns={{ _id: false, 'parent._id': false }}
/>
)}
</InfoCollapse>
</Flex>
</ScrollBox>
</Flex>
)
}

View File

@ -19,7 +19,6 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const AppPasswordInfo = () => {
@ -27,6 +26,7 @@ const AppPasswordInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -70,135 +70,132 @@ const AppPasswordInfo = () => {
}
return (
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='appPassword'
id={appPasswordId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'App Password Information' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='appPassword'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='appPassword'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='appPassword'
id={appPasswordId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'App Password Information' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='appPassword'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='appPassword'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={appPasswordId}
objectType='appPassword'
showEndingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={appPasswordId}
objectType='appPassword'
showEndingDivider={true}
/>
</Space>
</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>
<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._id': appPasswordId }}
visibleColumns={{ _id: false, 'parent._id': false }}
/>
)}
</InfoCollapse>
</Flex>
</ScrollBox>
</Flex>
)
}

View File

@ -6,7 +6,6 @@ import CloudIcon from '../../../Icons/CloudIcon'
import HostIcon from '../../../Icons/HostIcon'
import ReloadIcon from '../../../Icons/ReloadIcon'
import HProgress from '../../common/HProgress'
import ElipsisText from '../../common/ElipsisText'
import CheckCircleIcon from '../../../Icons/CheckCircleIcon'
import XMarkCircleIcon from '../../../Icons/XMarkCircleIcon'
@ -144,9 +143,9 @@ const UpdateStage = ({ stage, status, percent, detail }) => {
style={{ flex: 1, margin: 0 }}
/>
{detail && (
<ElipsisText type='secondary' style={{ minWidth: 0 }}>
<Text type='secondary' ellipsis style={{ minWidth: 0 }}>
{detail}
</ElipsisText>
</Text>
)}
</Flex>
)}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,6 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import PrinterIcon from '../../../Icons/PrinterIcon.jsx'
import DocumentPrinterIcon from '../../../Icons/DocumentPrinterIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('HostInfo')
@ -36,6 +35,7 @@ const HostInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -81,201 +81,198 @@ const HostInfo = () => {
}
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='host'
id={hostId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Host Information' },
{ key: 'printers', label: 'Printers' },
{ key: 'documentPrinters', label: 'Document Printers' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='host'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='host'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='host'
id={hostId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Host Information' },
{ key: 'printers', label: 'Printers' },
{ key: 'documentPrinters', label: 'Document Printers' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='host'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='host'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={hostId}
objectType='host'
showEndingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={hostId}
objectType='host'
showEndingDivider={true}
/>
</Space>
</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>
<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._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>
)
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,6 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import PartSkuIcon from '../../../Icons/PartSkuIcon.jsx'
const PartInfo = () => {
@ -31,6 +30,7 @@ const PartInfo = () => {
const partId = new URLSearchParams(location.search).get('partId')
const partSkusTableRef = useRef()
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -70,165 +70,166 @@ const PartInfo = () => {
}
return (
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='part'
id={partId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Part Information' },
{ key: 'partSkus', label: 'Part SKUs' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='part'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='part'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='part'
id={partId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Part Information' },
{ key: 'partSkus', label: 'Part SKUs' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='part'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='part'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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 }))
<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}
>
{({ loading, isEditing, objectData }) => (
<InfoCollapse
title='Part Information'
icon={<InfoCircleIcon />}
active={collapseState.info}
onToggle={(expanded) => updateCollapseState('info', expanded)}
collapseKey='info'
>
<ObjectInfo
loading={loading}
isEditing={isEditing}
type='part'
objectData={objectData}
<ObjectForm
id={partId}
type='part'
style={{ height: '100%' }}
ref={objectFormRef}
setCurrentObject={true}
onStateChange={(state) => {
setEditFormState((prev) => ({ ...prev, ...state }))
}}
>
{({ loading, isEditing, objectData }) => (
<InfoCollapse
title='Part Information'
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>
)}
</ObjectForm>
)}
</InfoCollapse>
</ActionHandler>
<InfoCollapse
title='Part SKUs'
icon={<PartSkuIcon />}
active={collapseState.partSkus}
onToggle={(expanded) => updateCollapseState('partSkus', expanded)}
collapseKey='partSkus'
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
ref={partSkusTableRef}
type='partSku'
masterFilter={{ part: getModelByName('part').prefix + ':' + partId }}
visibleColumns={{ part: false }}
type='auditLog'
masterFilter={{ 'parent._id': partId }}
visibleColumns={{ _id: false, 'parent._id': false }}
/>
)}
</InfoCollapse>
</ActionHandler>
<InfoCollapse
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>
</Flex>
</ScrollBox>
</Flex>
)
}

View File

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

View File

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

View File

@ -21,7 +21,6 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ProductSkuIcon from '../../../Icons/ProductSkuIcon.jsx'
const ProductInfo = () => {
@ -37,6 +36,7 @@ const ProductInfo = () => {
})
const productSkusTableRef = useRef()
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -70,172 +70,169 @@ const ProductInfo = () => {
}
return (
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='product'
id={productId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Product Information' },
{ key: 'productSkus', label: 'Product SKUs' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='product'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='product'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='product'
id={productId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Product Information' },
{ key: 'productSkus', label: 'Product SKUs' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='product'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='product'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={productId}
objectType='product'
showEndingDivider={true}
/>
</Space>
</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 }))
<Space>
<EditButtons
isEditing={objectFormState.isEditing}
handleUpdate={() => {
actionHandlerRef.current.callAction('finishEdit')
}}
>
{({ 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>
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={productId}
objectType='product'
showEndingDivider={true}
/>
</Space>
</Flex>
</ScrollBox>
</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: 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>
)
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,6 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import JobIcon from '../../../Icons/JobIcon.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('JobInfo')
@ -35,6 +34,7 @@ const JobInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -74,172 +74,169 @@ const JobInfo = () => {
finishEdit: () => {
objectFormRef?.current.handleUpdate()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='job'
id={jobId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Job Information' },
{ key: 'subJobs', label: 'Sub Jobs' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='job'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='job'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='job'
id={jobId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Job Information' },
{ key: 'subJobs', label: 'Sub Jobs' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='job'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='job'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={jobId}
objectType='job'
showEndingDivider={true}
/>
</Space>
</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 }}
<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}
/>
</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>
<ObjectTableNavigationButtons
disabled={objectFormState.loading || objectFormState.isEditing}
_id={jobId}
objectType='job'
showEndingDivider={true}
/>
</Space>
</Flex>
</ScrollBox>
</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._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>
)
}

View File

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

View File

@ -24,7 +24,6 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import PrinterProfileIcon from '../../../Icons/PrinterProfileIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ObjectTableNavigationButtons from '../../common/ObjectTableNavigationButtons.jsx'
const log = loglevel.getLogger('PrinterInfo')
log.setLevel(config.logLevel)
@ -35,6 +34,7 @@ const PrinterInfo = () => {
const profilesTableRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
const printerId = new URLSearchParams(location.search).get('printerId')
const [collapseState, updateCollapseState] = useCollapseState('PrinterInfo', {
@ -75,191 +75,188 @@ const PrinterInfo = () => {
finishEdit: () => {
objectFormRef?.current.handleUpdate()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='printer'
id={printerId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Printer Information' },
{ key: 'profiles', label: 'Printer Profiles' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='printer'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='printer'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='printer'
id={printerId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Printer Information' },
{ key: 'profiles', label: 'Printer Profiles' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='printer'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='printer'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={printerId}
objectType='printer'
showEndingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={printerId}
objectType='printer'
showEndingDivider={true}
/>
</Space>
</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>
<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: 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>
)
}

View File

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

View File

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

View File

@ -23,7 +23,6 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
const log = loglevel.getLogger('ListingVarientInfo')
log.setLevel(config.logLevel)
@ -33,6 +32,7 @@ const ListingVarientInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -77,154 +77,151 @@ const ListingVarientInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='listingVarient'
id={listingVarientId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Listing Varient Information' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='listingVarient'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='listingVarient'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='listingVarient'
id={listingVarientId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Listing Varient Information' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='listingVarient'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='listingVarient'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={listingVarientId}
objectType='listingVarient'
showEndingDivider={true}
/>
</Space>
</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 }))
<Space>
<EditButtons
isEditing={objectFormState.isEditing}
handleUpdate={() => {
actionHandlerRef.current.callAction('finishEdit')
}}
>
{({ 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>
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={listingVarientId}
objectType='listingVarient'
showEndingDivider={true}
/>
</Space>
</Flex>
</ScrollBox>
</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._id': listingVarientId }}
visibleColumns={{ _id: false, 'parent._id': false }}
/>
)}
</InfoCollapse>
</Flex>
</ScrollBox>
</Flex>
)
}

View File

@ -23,7 +23,6 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('ListingInfo')
@ -35,6 +34,7 @@ const ListingInfo = () => {
const listingVarientsTableRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -75,174 +75,171 @@ const ListingInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='listing'
id={listingId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Listing Information' },
{ key: 'listingVarients', label: 'Listing Varients' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='listing'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='listing'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='listing'
id={listingId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Listing Information' },
{ key: 'listingVarients', label: 'Listing Varients' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='listing'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='listing'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={listingId}
objectType='listing'
showEndingDivider={true}
/>
</Space>
</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 }))
<Space>
<EditButtons
isEditing={objectFormState.isEditing}
handleUpdate={() => {
actionHandlerRef.current.callAction('finishEdit')
}}
>
{({ 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>
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={listingId}
objectType='listing'
showEndingDivider={true}
/>
</Space>
</Flex>
</ScrollBox>
</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._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>
)
}

View File

@ -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 { Card, Flex, message, Space } from 'antd'
import loglevel from 'loglevel'
@ -25,7 +25,6 @@ import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { ApiServerContext } from '../../context/ApiServerContext.jsx'
import { ElectronContext } from '../../context/ElectronContext.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import {
buildMarketplaceAuthState,
storeMarketplaceAuthState
@ -39,6 +38,7 @@ const MarketplaceInfo = () => {
const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -148,147 +148,144 @@ const MarketplaceInfo = () => {
}
return (
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{ maxHeight: '100%', minHeight: 0 }}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='marketplace'
id={marketplaceId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Marketplace Information' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='marketplace'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='marketplace'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='marketplace'
id={marketplaceId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Marketplace Information' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='marketplace'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='marketplace'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={marketplaceId}
objectType='marketplace'
showEndingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={marketplaceId}
objectType='marketplace'
showEndingDivider={true}
/>
</Space>
</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>
<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._id': marketplaceId }}
visibleColumns={{ _id: false, 'parent._id': false }}
/>
)}
</InfoCollapse>
</Flex>
</ScrollBox>
</Flex>
)
}

View File

@ -27,7 +27,6 @@ import ScrollBox from '../../common/ScrollBox.jsx'
import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
const log = loglevel.getLogger('SalesOrderInfo')
@ -40,6 +39,7 @@ const SalesOrderInfo = () => {
const shipmentsTableRef = useRef(null)
const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions()
useEffect(() => {
setOnModalOk(() => () => {
@ -90,247 +90,244 @@ const SalesOrderInfo = () => {
delete: () => {
objectFormRef?.current?.handleDelete?.()
return true
}
},
}
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='small'>
<ObjectActions
type='salesOrder'
id={salesOrderId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Sales Order Information' },
{ key: 'orderItems', label: 'Order Items' },
{ key: 'shipments', label: 'Shipments' },
{ key: 'invoices', label: 'Invoices' },
{ key: 'stockEvents', label: 'Stock Events' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='salesOrder'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='salesOrder'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
<Space size='small'>
<ObjectActions
type='salesOrder'
id={salesOrderId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Sales Order Information' },
{ key: 'orderItems', label: 'Order Items' },
{ key: 'shipments', label: 'Shipments' },
{ key: 'invoices', label: 'Invoices' },
{ key: 'stockEvents', label: 'Stock Events' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='salesOrder'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='salesOrder'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</Space>
<ActivityIndicator
activities={objectFormState.activities}
showStartingDivider={true}
/>
</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={salesOrderId}
objectType='salesOrder'
showEndingDivider={true}
/>
</Space>
</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 }))
<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={salesOrderId}
objectType='salesOrder'
showEndingDivider={true}
/>
</Space>
</Flex>
<ScrollBox>
<Flex vertical gap={'large'}>
<ActionHandler
actions={actions}
loading={objectFormState.loading}
ref={actionHandlerRef}
>
{({ 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 />
) : (
<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='invoice'
type='orderItem'
masterFilter={{
order: getModelByName('salesOrder').prefix + ':' + salesOrderId,
'order._id': salesOrderId,
orderType: 'salesOrder'
}}
visibleColumns={{ order: false }}
ref={orderItemsTableRef}
/>
)}
</InfoCollapse>
<InfoCollapse
title='Stock Events'
icon={<StockEventIcon />}
active={collapseState.stockEvents}
onToggle={(expanded) =>
updateCollapseState('stockEvents', expanded)
}
collapseKey='stockEvents'
>
{objectFormState.loading ? (
<InfoCollapsePlaceholder />
) : (
</InfoCollapse>
<InfoCollapse
title='Shipments'
icon={<ShipmentIcon />}
active={collapseState.shipments}
onToggle={(expanded) =>
updateCollapseState('shipments', expanded)
}
collapseKey='shipments'
>
<ObjectTable
type='stockEvent'
type='shipment'
masterFilter={{
owner: getModelByName('salesOrder').prefix + ':' + salesOrderId
'order._id': salesOrderId,
orderType: 'salesOrder'
}}
visibleColumns={{ order: false }}
ref={shipmentsTableRef}
/>
)}
</InfoCollapse>
</Flex>
</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 }}
/>
)}
</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>
</InfoCollapse>
</Flex>
</ScrollBox>
</Flex>
)
}

View File

@ -2,7 +2,6 @@ import PropTypes from 'prop-types'
import { Flex, Typography, Input } from 'antd'
import CountryDisplay from './CountryDisplay'
import CountrySelect from './CountrySelect'
import ElipsisText from './ElipsisText'
const { Text } = Typography
@ -51,9 +50,9 @@ const AddressDisplay = ({
{isCountry ? (
<CountryDisplay countryCode={fieldValue} />
) : (
<ElipsisText alt={label}>
<Text ellipsis alt={label}>
{fieldValue}
</ElipsisText>
</Text>
)}
</Flex>
)

View File

@ -22,64 +22,6 @@ import { Button, Modal, Typography } from 'antd'
const { Link } = Typography
export function toEditorCode(code, language = 'javascript') {
if (code == null) return ''
if (typeof code === 'object' && language === 'json') {
return JSON.stringify(code, null, 2)
}
return String(code)
}
export function getCodeLanguageExtension(
language = 'javascript',
autoCompleteObject = null
) {
const lang = Array.isArray(language) ? language[0] : language
switch (String(lang || 'javascript').toLowerCase()) {
case 'javascript':
case 'js':
return javascript()
case 'python':
case 'py':
return python()
case 'json':
return json()
case 'xml':
return xml()
case 'fctemplatelang':
case 'ejs':
return fcTemplateLang({ autoCompleteObject })
case 'html':
return html()
case 'css':
return css()
case 'markdown':
case 'md':
return markdown()
case 'sql':
return sql()
case 'java':
return java()
case 'cpp':
case 'c++':
case 'c':
return cpp()
case 'rust':
case 'rs':
return rust()
case 'go':
return go()
case 'php':
return php()
case 'yaml':
case 'yml':
return yaml()
default:
return javascript()
}
}
export default function CodeBlockEditor({
code = '',
language = 'javascript',
@ -95,12 +37,57 @@ export default function CodeBlockEditor({
}) {
const { isDarkMode } = useThemeContext()
const [codeMirrorOpen, setCodeMirrorOpen] = useState(false)
const editorCode = toEditorCode(code, language)
var editorCode = code
const languageExtension = useMemo(
() => getCodeLanguageExtension(language, autoCompleteObject),
[language, autoCompleteObject]
)
if (typeof code == 'object' && language == 'json') {
editorCode = JSON.stringify(code, null, 2)
}
// Map language to CodeMirror extension
const languageExtension = useMemo(() => {
switch (language.toLowerCase()) {
case 'javascript':
case 'js':
return javascript()
case 'python':
case 'py':
return python()
case 'json':
return json()
case 'xml':
return xml()
case 'fctemplatelang':
case 'ejs':
return fcTemplateLang({ autoCompleteObject })
case 'html':
return html()
case 'css':
return css()
case 'markdown':
case 'md':
return markdown()
case 'sql':
return sql()
case 'java':
return java()
case 'cpp':
case 'c++':
case 'c':
return cpp()
case 'rust':
case 'rs':
return rust()
case 'go':
return go()
case 'php':
return php()
case 'yaml':
case 'yml':
return yaml()
default:
return javascript() // Default fallback
}
}, [language, autoCompleteObject])
const handleOnChange = (value) => {
if (typeof code == 'object' && language == 'json') {

View File

@ -1,85 +0,0 @@
import { useLayoutEffect, useMemo, useRef } from 'react'
import PropTypes from 'prop-types'
import { MergeView } from '@codemirror/merge'
import { EditorState } from '@codemirror/state'
import { EditorView } from '@codemirror/view'
import { oneDark } from '@codemirror/theme-one-dark'
import { basicSetup } from 'codemirror'
import { useThemeContext } from '../context/ThemeContext'
import {
getCodeLanguageExtension,
toEditorCode
} from './CodeBlockEditor'
export default function CodeDiffViewer({
oldCode = '',
newCode = '',
language = 'javascript'
}) {
const { isDarkMode } = useThemeContext()
const parentRef = useRef(null)
const oldDoc = toEditorCode(oldCode, language)
const newDoc = toEditorCode(newCode, language)
const languageExtension = useMemo(
() => getCodeLanguageExtension(language),
[language]
)
useLayoutEffect(() => {
if (!parentRef.current) return
const editorTheme = EditorView.theme({
'&': {
fontSize: '14px',
fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace'
}
})
const sharedExtensions = [
basicSetup,
languageExtension,
editorTheme,
EditorView.editable.of(false),
EditorState.readOnly.of(true),
...(isDarkMode ? [oneDark] : [])
]
const view = new MergeView({
a: {
doc: oldDoc,
extensions: sharedExtensions
},
b: {
doc: newDoc,
extensions: sharedExtensions
},
parent: parentRef.current,
highlightChanges: true,
gutter: true,
collapseUnchanged: { margin: 3, minSize: 6 }
})
return () => {
view.destroy()
}
}, [oldDoc, newDoc, languageExtension, isDarkMode])
return (
<div
ref={parentRef}
className={
isDarkMode ? 'code-diff-viewer is-dark' : 'code-diff-viewer'
}
/>
)
}
CodeDiffViewer.propTypes = {
oldCode: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
newCode: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
language: PropTypes.oneOfType([
PropTypes.string,
PropTypes.arrayOf(PropTypes.string)
])
}

View File

@ -1,8 +1,9 @@
import PropTypes from 'prop-types'
import { Flex } from 'antd'
import { Flex, Typography } from 'antd'
import Flag from './Flag'
import countries from '../../../database/Countries'
import ElipsisText from './ElipsisText'
const { Text } = Typography
const CountryDisplay = ({ countryCode }) => {
const country = countries.find((c) => c.code === countryCode)
@ -16,7 +17,7 @@ const CountryDisplay = ({ countryCode }) => {
gap={'small'}
align='center'
className='country-display'
style={{ minWidth: 0, width: '100%' }}
style={{ minWidth: 0 }}
>
<Flag
code={country.code}
@ -24,8 +25,8 @@ const CountryDisplay = ({ countryCode }) => {
hasBorder={true}
borderRadius={5}
/>
<div style={{ minWidth: 0, flex: 1, overflow: 'hidden' }}>
<ElipsisText>{country.name}</ElipsisText>
<div style={{ minWidth: 0 }}>
<Text ellipsis>{country.name}</Text>
</div>
</Flex>
)

View File

@ -1,8 +1,9 @@
import { Select, Flex } from 'antd'
import { Select, Flex, Typography } from 'antd'
import PropTypes from 'prop-types'
import Flag from './Flag'
import countries from '../../../database/Countries'
import ElipsisText from './ElipsisText'
const { Text } = Typography
const CountrySelect = ({
value,
@ -29,7 +30,7 @@ const CountrySelect = ({
label: (
<Flex gap='small' align='center' className='country-display'>
<Flag code={country.code} size='small' borderRadius={3} />
<ElipsisText>{country.name}</ElipsisText>
<Text elipsis>{country.name}</Text>
</Flex>
)
}))}

View File

@ -22,7 +22,6 @@ import { Header } from 'antd/es/layout/layout'
import { useMediaQuery } from 'react-responsive'
import KeyboardShortcut from './KeyboardShortcut'
import UserProfilePopover from './UserProfilePopover'
import ElipsisText from './ElipsisText'
import FarmControlLogo from '../../Logos/FarmControlLogo'
import FarmControlLogoSmall from '../../Logos/FarmControlLogoSmall'
@ -195,17 +194,19 @@ const DashboardNavigation = () => {
}}
>
{selectedMenuItem.icon}
<ElipsisText
<Text
ellipsis
style={{
minWidth: 0,
maxWidth: '100%',
minWidth: 0, // CRUCIAL for flex children
maxWidth: '100%', // Responsive
whiteSpace: 'nowrap',
overflow: 'hidden',
flex: 1
textOverflow: 'ellipsis',
flex: 1 // Take available space, shrink as needed
}}
>
{selectedMenuItem.label}
</ElipsisText>
</Text>
</Flex>
)}
<div style={{ flexGrow: 1 }}>

View File

@ -1,116 +0,0 @@
import { useMemo, useState } from 'react'
import PropTypes from 'prop-types'
import { Button, Modal, Typography, theme, Flex } from 'antd'
import { presentableDiff } from '@codemirror/merge'
import CodeDiffViewer from './CodeDiffViewer'
import { toEditorCode } from './CodeBlockEditor'
const { Link, Text } = Typography
const SQUARE_COUNT = 10
const countLines = (str) => {
if (!str) return 0
const parts = str.split('\n')
if (parts[parts.length - 1] === '') parts.pop()
return Math.max(parts.length, 1)
}
export function getCodeDiffStats(oldCode, newCode, language = 'javascript') {
const oldText = toEditorCode(oldCode, language)
const newText = toEditorCode(newCode, language)
const changes = presentableDiff(oldText, newText)
let additions = 0
let deletions = 0
for (const change of changes) {
const deleted = oldText.slice(change.fromA, change.toA)
const added = newText.slice(change.fromB, change.toB)
if (deleted) deletions += countLines(deleted)
if (added) additions += countLines(added)
}
return { additions, deletions }
}
export default function DiffLabel({
oldCode = '',
newCode = '',
language = 'javascript'
}) {
const { token } = theme.useToken()
const [open, setOpen] = useState(false)
const [viewerReady, setViewerReady] = useState(false)
const { additions, deletions } = useMemo(
() => getCodeDiffStats(oldCode, newCode, language),
[oldCode, newCode, language]
)
const greenCount = Math.round(
(additions / (additions + deletions)) * SQUARE_COUNT
)
return (
<>
<Link
className='diff-label'
onClick={() => {
setOpen(true)
}}
>
<Flex gap='small' align='center' style={{ marginTop: 0.5 }}>
<Text style={{ color: token.colorSuccess }}>+{additions}</Text>
<Flex gap='4px' align='center' style={{ marginBottom: 2 }}>
{Array.from({ length: SQUARE_COUNT }).map((_, i) => (
<div
key={i}
className='diff-label-square'
style={{
backgroundColor:
i < greenCount ? token.colorSuccess : token.colorError
}}
/>
))}
</Flex>
<Text style={{ color: token.colorError }}>-{deletions}</Text>
</Flex>
</Link>
<Modal
closeIcon={false}
open={open}
width='90%'
destroyOnClose
afterOpenChange={setViewerReady}
onCancel={() => {
setOpen(false)
}}
footer={
<Button
onClick={() => {
setOpen(false)
}}
>
Close
</Button>
}
>
{viewerReady ? (
<CodeDiffViewer
oldCode={oldCode}
newCode={newCode}
language={language}
/>
) : null}
</Modal>
</>
)
}
DiffLabel.propTypes = {
oldCode: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
newCode: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
language: PropTypes.oneOfType([
PropTypes.string,
PropTypes.arrayOf(PropTypes.string)
])
}

View File

@ -1,108 +0,0 @@
import { useLayoutEffect, useRef, useState } from 'react'
import PropTypes from 'prop-types'
import { Typography } from 'antd'
const { Text } = Typography
const childrenToString = (children) => {
if (children == null || typeof children === 'boolean') return ''
if (typeof children === 'string' || typeof children === 'number') {
return String(children)
}
if (Array.isArray(children)) {
return children.map(childrenToString).join('')
}
if (typeof children === 'object' && children.props) {
return childrenToString(children.props.children)
}
return ''
}
const splitMiddle = (text) => {
const mid = Math.ceil(text.length / 2)
return {
start: text.slice(0, mid),
end: text.slice(mid)
}
}
const ElipsisText = ({ children, style, className, title, code, ...rest }) => {
const text = childrenToString(children)
const { start, end } = splitMiddle(text)
const containerRef = useRef(null)
const measureRef = useRef(null)
const truncatedRef = useRef(false)
const [truncated, setTruncated] = useState(false)
useLayoutEffect(() => {
const container = containerRef.current
const measure = measureRef.current
if (!container || !measure) return
const update = () => {
const available = container.getBoundingClientRect().width
if (available < 1) return
const textWidth = measure.getBoundingClientRect().width
const next = Boolean(end) && textWidth > available
if (truncatedRef.current === next) return
truncatedRef.current = next
setTruncated(next)
}
update()
const frame = requestAnimationFrame(update)
const resizeObserver = new ResizeObserver(update)
resizeObserver.observe(container)
const intersectionObserver = new IntersectionObserver(update)
intersectionObserver.observe(container)
return () => {
cancelAnimationFrame(frame)
resizeObserver.disconnect()
intersectionObserver.disconnect()
}
}, [text, end])
const showTruncated = truncated && Boolean(end)
const RootTag = code ? 'code' : 'span'
return (
<Text
{...rest}
className={['elipsis-text-wrapper', className].filter(Boolean).join(' ')}
title={title ?? text}
style={style}
>
<span
className={showTruncated ? 'elipsis-text is-truncated' : 'elipsis-text'}
ref={containerRef}
>
<RootTag className='elipsis-text-measure' ref={measureRef}>
{text}
</RootTag>
<RootTag className='elipsis-text-full'>{text}</RootTag>
<RootTag className='elipsis-text-truncated'>
<span className='elipsis-text-start'>{start}</span>
<span className='elipsis-text-dots'>...</span>
<span className='elipsis-text-end'>
<span className='elipsis-text-end-inner'>{end}</span>
</span>
</RootTag>
</span>
</Text>
)
}
ElipsisText.propTypes = {
children: PropTypes.node,
style: PropTypes.object,
className: PropTypes.string,
title: PropTypes.string,
code: PropTypes.bool
}
export default ElipsisText

View File

@ -3,7 +3,6 @@ import { Typography, Flex, Button, Tooltip } from 'antd'
import NewMailIcon from '../../Icons/NewMailIcon'
// import CopyIcon from './CopyIcon'
import CopyButton from './CopyButton'
import ElipsisText from './ElipsisText'
const { Text, Link } = Typography
@ -19,9 +18,9 @@ const EmailDisplay = ({ email, showCopy = true, showLink = false }) => {
</Link>
) : (
<>
<ElipsisText style={{ marginRight: 8 }}>
<Text style={{ marginRight: 8 }} ellipsis>
{email}
</ElipsisText>
</Text>
<Tooltip title='Email' arrow={false}>
<Button
icon={<NewMailIcon />}

View File

@ -1,4 +1,4 @@
import { Card, Flex, Button, Tag, Divider } from 'antd'
import { Card, Flex, Typography, Button, Tag, Divider } from 'antd'
import PropTypes from 'prop-types'
import FileIcon from '../../Icons/FileIcon'
import BinIcon from '../../Icons/BinIcon'
@ -11,7 +11,8 @@ import EyeSlashIcon from '../../Icons/EyeSlashIcon'
import { getModelByName } from '../../../database/ObjectModels'
import InfoCircleIcon from '../../Icons/InfoCircleIcon'
import { useNavigate } from 'react-router-dom'
import ElipsisText from './ElipsisText'
const { Text } = Typography
const FileList = ({
files,
@ -86,15 +87,15 @@ const FileList = ({
<Flex
gap={'small'}
align='center'
style={{ minWidth: 0, flex: '1 1 auto', overflow: 'hidden' }}
style={{ minWidth: 0, flex: '0 1 auto', overflow: 'hidden' }}
>
<FileIcon
style={{ margin: 0, fontSize: card == true ? '24px' : '16px' }}
/>
<ElipsisText style={{ marginTop: '1px', minWidth: 0 }}>
<Text style={{ marginTop: '1px', minWidth: 0 }} ellipsis>
{file.name || file.filename || 'Unknown file'}
</ElipsisText>
</Text>
{file.extension && <Tag style={{ margin: 0 }}>{file.extension}</Tag>}
</Flex>
{!minimal && (

View File

@ -4,7 +4,6 @@ import { Flex, Typography, Popover } from 'antd'
import { useNavigate } from 'react-router-dom'
import { useMediaQuery } from 'react-responsive'
import CopyButton from './CopyButton'
import ElipsisText from './ElipsisText'
import SpotlightTooltip from './SpotlightTooltip'
import { getModelByName } from '../../../database/ObjectModels'
import { buildActionUrl } from '../../../utils/modelActions'
@ -69,12 +68,13 @@ const IdDisplay = ({
if (plainCode == false) {
textElement = (
<ElipsisText
<Text
code
ellipsis
style={showCopy ? { marginRight: 6, minWidth: '0px' } : undefined}
>
{displayId}
</ElipsisText>
</Text>
)
}
@ -83,12 +83,8 @@ const IdDisplay = ({
const linkElement = (
<Link
onClick={() => navigate(hyperlink)}
style={{
minWidth: 0,
maxWidth: '100%',
display: 'block',
...(showCopy ? { marginRight: 6 } : null)
}}
ellipsis
style={showCopy ? { marginRight: 6 } : undefined}
>
{textElement}
</Link>

View File

@ -1,7 +1,6 @@
import PropTypes from 'prop-types'
import { Flex, Typography } from 'antd'
import CopyButton from './CopyButton'
import ElipsisText from './ElipsisText'
const { Text } = Typography
@ -16,12 +15,13 @@ const MiscId = ({ value, showCopy = true }) => {
className='miscid'
style={{ minWidth: '0px', width: '100%' }}
>
<ElipsisText
<Text
code
ellipsis
style={showCopy ? { marginRight: 6, minWidth: '0px' } : undefined}
>
{value}
</ElipsisText>
</Text>
{showCopy && (
<CopyButton

View File

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

View File

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

View File

@ -23,7 +23,6 @@ import ExclamationOctagonIcon from '../../Icons/ExclamationOctagonIcon'
import CheckCircleIcon from '../../Icons/CheckCircleIcon'
import BellIcon from '../../Icons/BellIcon'
import { getModelByName } from '../../../database/ObjectModels'
import ElipsisText from './ElipsisText'
const { Text, Paragraph } = Typography
@ -362,12 +361,13 @@ const Notification = ({
{inlineIcon &&
getNotificationIcon(notification.type, notification.metadata)}
<ElipsisText
<Text
strong={!notification.read}
ellipsis
style={{ minWidth: 0 }}
>
{notification.title}
</ElipsisText>
</Text>
</Flex>
<Flex align='center' gap='5px' style={{ marginLeft: 10 }}>
{showDetails && (

View File

@ -9,7 +9,6 @@ import { ApiServerContext } from '../context/ApiServerContext'
import { AuthContext } from '../context/AuthContext'
import merge from 'lodash/merge'
import IdDisplay from './IdDisplay'
import ElipsisText from './ElipsisText'
import SpotlightTooltip from './SpotlightTooltip'
import StateTag from './StateTag'
@ -184,7 +183,13 @@ const ObjectDisplay = ({
const objectId = getStringId(objectData)
if (defaultModelActions.length >= 1 && objectId) {
hyperlink = buildActionUrl(model, defaultModelActions[0], objectId, '', '')
hyperlink = buildActionUrl(
model,
defaultModelActions[0],
objectId,
'',
''
)
}
// Render name with hyperlink/spotlight support
@ -192,9 +197,9 @@ const ObjectDisplay = ({
if (!objectData?.name) return null
const textElement = (
<ElipsisText style={{ lineHeight: '1', paddingBottom: '2px' }}>
<Text ellipsis style={{ lineHeight: '1', paddingBottom: '2px' }}>
{objectData.name}
</ElipsisText>
</Text>
)
// If hyperlink is enabled
@ -263,7 +268,7 @@ const ObjectDisplay = ({
style={{ minWidth: 0, height: '24px' }}
>
<Icon />
<Flex gap={'small'} align='center' style={{ minWidth: 0, flex: 1 }}>
<Flex gap={'small'} align='center' style={{ minWidth: 0 }}>
{objectData?.color ? (
<Badge
color={objectData?.color}
@ -277,7 +282,7 @@ const ObjectDisplay = ({
style={{ marginBottom: '1.5px' }}
/>
) : null}
<div style={{ minWidth: 0, flex: 1, overflow: 'hidden' }}>
<div style={{ minWidth: 0 }}>
{renderNameDisplay()}
{objectId && !objectData?.name ? (

View File

@ -51,7 +51,6 @@ import MiscId from './MiscId'
import AddressDisplay from './AddressDisplay'
import ArrayDisplay from './ArrayDisplay'
import ArrayInput from './ArrayInput'
import ElipsisText from './ElipsisText'
import { round } from '../utils/Utils'
const { Text } = Typography
@ -379,11 +378,11 @@ const ObjectProperty = ({
case 'text':
if (value != null && value != '') {
return (
<ElipsisText style={style}>
<Text ellipsis style={style}>
{prefix}
{getTextValue(value)}
{suffix}
</ElipsisText>
</Text>
)
} else {
return (

View File

@ -1,11 +1,7 @@
import PropTypes from 'prop-types'
import { Descriptions, Typography, Flex } from 'antd'
import {
getModelProperty,
getPropertyValue
} from '../../../database/ObjectModels'
import { getModelProperty } from '../../../database/ObjectModels'
import ObjectProperty from './ObjectProperty'
import DiffLabel from './DiffLabel'
import ArrowRightIcon from '../../Icons/ArrowRightIcon'
const { Text } = Typography
@ -55,17 +51,6 @@ const PropertyChanges = ({ type, value }) => {
if (!changeProperty) {
return null
}
const oldValue = getPropertyValue(value?.old, key)
const newValue = getPropertyValue(value?.new, key)
const isCodeKey = key === 'code' || changeProperty.type === 'codeBlock'
const isCodeEdit =
isCodeKey &&
oldValue != null &&
oldValue !== '' &&
newValue != null &&
newValue !== ''
return (
<Descriptions.Item key={key} label={changeProperty.label}>
<Flex
@ -73,41 +58,31 @@ const PropertyChanges = ({ type, value }) => {
style={{ minWidth: 0, width: '100%' }}
className='property-changes'
>
{isCodeEdit ? (
<DiffLabel
oldCode={oldValue}
newCode={newValue}
language={changeProperty.language}
{value?.old ? (
<ObjectProperty
{...changeProperty}
longId={false}
minimal={true}
showPreview={false}
objectData={value?.old}
maxWidth='200px'
/>
) : (
<>
{value?.old ? (
<ObjectProperty
{...changeProperty}
longId={false}
minimal={true}
showPreview={false}
objectData={value?.old}
maxWidth='200px'
/>
) : null}
{value?.old && value?.new ? (
<Text type='secondary'>
<ArrowRightIcon />
</Text>
) : null}
{value?.new ? (
<ObjectProperty
{...changeProperty}
longId={false}
minimal={true}
showPreview={false}
objectData={value?.new}
maxWidth='200px'
/>
) : null}
</>
)}
) : null}
{value?.old && value?.new ? (
<Text type='secondary'>
<ArrowRightIcon />
</Text>
) : null}
{value?.new ? (
<ObjectProperty
{...changeProperty}
longId={false}
minimal={true}
showPreview={false}
objectData={value?.new}
maxWidth='200px'
/>
) : null}
</Flex>
</Descriptions.Item>
)

View File

@ -2,7 +2,6 @@ import PropTypes from 'prop-types'
import { Typography, Flex, Button, Tooltip } from 'antd'
import LinkIcon from '../../Icons/LinkIcon'
import CopyButton from './CopyButton'
import ElipsisText from './ElipsisText'
const { Text, Link } = Typography
@ -25,15 +24,15 @@ const UrlDisplay = ({ url, showCopy = true, showLink = false }) => {
width: 0
}}
>
<ElipsisText style={{ display: 'block' }}>
<Text ellipsis style={{ display: 'block' }}>
{url}
</ElipsisText>
</Text>
</Link>
) : (
<>
<ElipsisText style={{ marginRight: 8, minWidth: 0 }}>
<Text style={{ marginRight: 8, minWidth: 0 }} ellipsis>
{url}
</ElipsisText>
</Text>
<Tooltip title='Open URL' arrow={false}>
<Button
icon={<LinkIcon />}

View File

@ -8,7 +8,6 @@ import { User } from '../../../database/models/User'
import { buildActionUrl } from '../../../utils/modelActions'
import { AuthContext } from '../context/AuthContext'
import ObjectActions from './ObjectActions'
import ElipsisText from './ElipsisText'
const { Text } = Typography
@ -90,12 +89,13 @@ const UserProfilePopover = ({ onClose }) => {
)}
<Flex vertical style={{ minWidth: 0 }}>
{fullName && (
<ElipsisText
<Text
strong
ellipsis
style={{ fontSize: 18, lineHeight: 1, marginTop: 1 }}
>
{fullName}
</ElipsisText>
</Text>
)}
{email && (
<Space>
@ -106,12 +106,13 @@ const UserProfilePopover = ({ onClose }) => {
>
@{username}
</Text>
<ElipsisText
<Text
type='secondary'
ellipsis
style={{ fontSize: 12, lineHeight: 1 }}
>
{email}
</ElipsisText>
</Text>
</Space>
)}
{!username && !fullName && !email && (

View File

@ -16,7 +16,6 @@ import {
buildActionUrl,
stripActionParams
} from '../../../utils/modelActions'
import ElipsisText from '../common/ElipsisText'
const ActionsModalContext = createContext()
@ -292,14 +291,15 @@ const ActionsModalProvider = ({ children }) => {
>
{Icon ? <Icon style={{ fontSize: '18px' }} /> : null}
<Flex vertical style={{ flexGrow: 1, minWidth: 0 }}>
<ElipsisText
<Text
ellipsis
style={{
maxWidth: 320,
width: '100%'
}}
>
{action.fullLabel || action.label || action.name}
</ElipsisText>
</Text>
</Flex>
</Flex>
<Flex gap='small' align='center'>

View File

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

View File

@ -26,7 +26,6 @@ import PropTypes from 'prop-types'
import { useNavigate } from 'react-router-dom'
import StateDisplay from '../common/StateDisplay'
import IdDisplay from '../common/IdDisplay'
import ElipsisText from '../common/ElipsisText'
import config from '../../../config'
import {
@ -502,7 +501,8 @@ const SpotlightContent = ({
{Icon ? <Icon style={{ fontSize: '20px' }} /> : null}
{item.name ? (
<ElipsisText
<Text
ellipsis
style={{
maxWidth: 170,
flexGrow: 1,
@ -510,7 +510,7 @@ const SpotlightContent = ({
}}
>
{item.name}
</ElipsisText>
</Text>
) : null}
{item?.state ? (
<StateDisplay

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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