Fixed product SKUs.
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good

This commit is contained in:
Tom Butcher 2026-06-20 22:27:17 +01:00
parent 133adece5f
commit 8f369d777d
3 changed files with 88 additions and 68 deletions

View File

@ -130,13 +130,6 @@ const ProductSkuInfo = () => {
actions={actions} actions={actions}
loading={objectFormState.loading} loading={objectFormState.loading}
ref={actionHandlerRef} ref={actionHandlerRef}
>
<InfoCollapse
title='Product SKU Information'
icon={<InfoCircleIcon />}
active={collapseState.info}
onToggle={(expanded) => updateCollapseState('info', expanded)}
collapseKey='info'
> >
<ObjectForm <ObjectForm
id={productSkuId} id={productSkuId}
@ -148,7 +141,16 @@ const ProductSkuInfo = () => {
}} }}
> >
{({ loading, isEditing, objectData }) => ( {({ loading, isEditing, objectData }) => (
<> <Flex vertical gap={'large'}>
<InfoCollapse
title='Product SKU Information'
icon={<InfoCircleIcon />}
active={collapseState.info}
onToggle={(expanded) =>
updateCollapseState('info', expanded)
}
collapseKey='info'
>
<ObjectInfo <ObjectInfo
loading={loading} loading={loading}
isEditing={isEditing} isEditing={isEditing}
@ -158,26 +160,29 @@ const ProductSkuInfo = () => {
parts: false parts: false
}} }}
/> />
</>
)}
</ObjectForm>
</InfoCollapse> </InfoCollapse>
</ActionHandler>
<InfoCollapse <InfoCollapse
title='SKU Parts' title='SKU Parts'
icon={<PartIcon />} icon={<PartIcon />}
active={collapseState.parts} active={collapseState.parts}
onToggle={(expanded) => updateCollapseState('parts', expanded)} onToggle={(expanded) =>
updateCollapseState('parts', expanded)
}
collapseKey='parts' collapseKey='parts'
> >
<ObjectProperty <ObjectProperty
{...getModelProperty('productSku', 'parts')} {...getModelProperty('productSku', 'parts')}
isEditing={objectFormState.isEditing} isEditing={isEditing}
objectData={objectFormState.objectData} objectData={objectData}
loading={objectFormState.loading} loading={loading}
size='medium' size='medium'
/> />
</InfoCollapse> </InfoCollapse>
</Flex>
)}
</ObjectForm>
</ActionHandler>
<Flex vertical gap={'large'}>
<InfoCollapse <InfoCollapse
title='Notes' title='Notes'
icon={<NoteIcon />} icon={<NoteIcon />}
@ -209,6 +214,7 @@ const ProductSkuInfo = () => {
)} )}
</InfoCollapse> </InfoCollapse>
</Flex> </Flex>
</Flex>
</ScrollBox> </ScrollBox>
</Flex> </Flex>
</> </>

View File

@ -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)
} }

View File

@ -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',