Fixed product SKUs.
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
This commit is contained in:
parent
133adece5f
commit
8f369d777d
@ -131,24 +131,26 @@ const ProductSkuInfo = () => {
|
|||||||
loading={objectFormState.loading}
|
loading={objectFormState.loading}
|
||||||
ref={actionHandlerRef}
|
ref={actionHandlerRef}
|
||||||
>
|
>
|
||||||
<InfoCollapse
|
<ObjectForm
|
||||||
title='Product SKU Information'
|
id={productSkuId}
|
||||||
icon={<InfoCircleIcon />}
|
type='productSku'
|
||||||
active={collapseState.info}
|
style={{ height: '100%' }}
|
||||||
onToggle={(expanded) => updateCollapseState('info', expanded)}
|
ref={objectFormRef}
|
||||||
collapseKey='info'
|
onStateChange={(state) => {
|
||||||
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<ObjectForm
|
{({ loading, isEditing, objectData }) => (
|
||||||
id={productSkuId}
|
<Flex vertical gap={'large'}>
|
||||||
type='productSku'
|
<InfoCollapse
|
||||||
style={{ height: '100%' }}
|
title='Product SKU Information'
|
||||||
ref={objectFormRef}
|
icon={<InfoCircleIcon />}
|
||||||
onStateChange={(state) => {
|
active={collapseState.info}
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
onToggle={(expanded) =>
|
||||||
}}
|
updateCollapseState('info', expanded)
|
||||||
>
|
}
|
||||||
{({ loading, isEditing, objectData }) => (
|
collapseKey='info'
|
||||||
<>
|
>
|
||||||
<ObjectInfo
|
<ObjectInfo
|
||||||
loading={loading}
|
loading={loading}
|
||||||
isEditing={isEditing}
|
isEditing={isEditing}
|
||||||
@ -158,56 +160,60 @@ const ProductSkuInfo = () => {
|
|||||||
parts: false
|
parts: false
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</>
|
</InfoCollapse>
|
||||||
)}
|
<InfoCollapse
|
||||||
</ObjectForm>
|
title='SKU Parts'
|
||||||
</InfoCollapse>
|
icon={<PartIcon />}
|
||||||
|
active={collapseState.parts}
|
||||||
|
onToggle={(expanded) =>
|
||||||
|
updateCollapseState('parts', expanded)
|
||||||
|
}
|
||||||
|
collapseKey='parts'
|
||||||
|
>
|
||||||
|
<ObjectProperty
|
||||||
|
{...getModelProperty('productSku', 'parts')}
|
||||||
|
isEditing={isEditing}
|
||||||
|
objectData={objectData}
|
||||||
|
loading={loading}
|
||||||
|
size='medium'
|
||||||
|
/>
|
||||||
|
</InfoCollapse>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</ObjectForm>
|
||||||
</ActionHandler>
|
</ActionHandler>
|
||||||
<InfoCollapse
|
<Flex vertical gap={'large'}>
|
||||||
title='SKU Parts'
|
<InfoCollapse
|
||||||
icon={<PartIcon />}
|
title='Notes'
|
||||||
active={collapseState.parts}
|
icon={<NoteIcon />}
|
||||||
onToggle={(expanded) => updateCollapseState('parts', expanded)}
|
active={collapseState.notes}
|
||||||
collapseKey='parts'
|
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
||||||
>
|
collapseKey='notes'
|
||||||
<ObjectProperty
|
>
|
||||||
{...getModelProperty('productSku', 'parts')}
|
<Card>
|
||||||
isEditing={objectFormState.isEditing}
|
<NotesPanel _id={productSkuId} type='productSku' />
|
||||||
objectData={objectFormState.objectData}
|
</Card>
|
||||||
loading={objectFormState.loading}
|
</InfoCollapse>
|
||||||
size='medium'
|
<InfoCollapse
|
||||||
/>
|
title='Audit Logs'
|
||||||
</InfoCollapse>
|
icon={<AuditLogIcon />}
|
||||||
<InfoCollapse
|
active={collapseState.auditLogs}
|
||||||
title='Notes'
|
onToggle={(expanded) =>
|
||||||
icon={<NoteIcon />}
|
updateCollapseState('auditLogs', expanded)
|
||||||
active={collapseState.notes}
|
}
|
||||||
onToggle={(expanded) => updateCollapseState('notes', expanded)}
|
collapseKey='auditLogs'
|
||||||
collapseKey='notes'
|
>
|
||||||
>
|
{objectFormState.loading ? (
|
||||||
<Card>
|
<InfoCollapsePlaceholder />
|
||||||
<NotesPanel _id={productSkuId} type='productSku' />
|
) : (
|
||||||
</Card>
|
<ObjectTable
|
||||||
</InfoCollapse>
|
type='auditLog'
|
||||||
<InfoCollapse
|
masterFilter={{ 'parent._id': productSkuId }}
|
||||||
title='Audit Logs'
|
visibleColumns={{ _id: false, 'parent._id': false }}
|
||||||
icon={<AuditLogIcon />}
|
/>
|
||||||
active={collapseState.auditLogs}
|
)}
|
||||||
onToggle={(expanded) =>
|
</InfoCollapse>
|
||||||
updateCollapseState('auditLogs', expanded)
|
</Flex>
|
||||||
}
|
|
||||||
collapseKey='auditLogs'
|
|
||||||
>
|
|
||||||
{objectFormState.loading ? (
|
|
||||||
<InfoCollapsePlaceholder />
|
|
||||||
) : (
|
|
||||||
<ObjectTable
|
|
||||||
type='auditLog'
|
|
||||||
masterFilter={{ 'parent._id': productSkuId }}
|
|
||||||
visibleColumns={{ _id: false, 'parent._id': false }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</InfoCollapse>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</ScrollBox>
|
</ScrollBox>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
@ -259,6 +259,7 @@ const ObjectChildTable = ({
|
|||||||
const currentItems = Array.isArray(itemsSource) ? itemsSource : []
|
const currentItems = Array.isArray(itemsSource) ? itemsSource : []
|
||||||
const newItems = [...currentItems, newItem]
|
const newItems = [...currentItems, newItem]
|
||||||
|
|
||||||
|
console.log('newItems', newItems)
|
||||||
if (typeof onChange === 'function') {
|
if (typeof onChange === 'function') {
|
||||||
onChange(newItems)
|
onChange(newItems)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -332,15 +332,28 @@ export const ProductSku = {
|
|||||||
name: 'parts',
|
name: 'parts',
|
||||||
label: 'Parts',
|
label: 'Parts',
|
||||||
type: 'objectChildren',
|
type: 'objectChildren',
|
||||||
objectType: 'partSku',
|
size: 'medium',
|
||||||
properties: [
|
properties: [
|
||||||
|
{
|
||||||
|
name: 'part',
|
||||||
|
label: 'Part',
|
||||||
|
type: 'object',
|
||||||
|
objectType: 'part',
|
||||||
|
required: true,
|
||||||
|
showHyperlink: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'partSku',
|
name: 'partSku',
|
||||||
label: 'Part SKU',
|
label: 'Part SKU',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
objectType: 'partSku',
|
objectType: 'partSku',
|
||||||
required: true,
|
required: true,
|
||||||
showHyperlink: true
|
showHyperlink: true,
|
||||||
|
masterFilter: (objectData) => {
|
||||||
|
const partId = objectData?.part?._id
|
||||||
|
if (partId == null) return {}
|
||||||
|
return { part: partId }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'quantity',
|
name: 'quantity',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user