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

View File

@ -259,6 +259,7 @@ const ObjectChildTable = ({
const currentItems = Array.isArray(itemsSource) ? itemsSource : []
const newItems = [...currentItems, newItem]
console.log('newItems', newItems)
if (typeof onChange === 'function') {
onChange(newItems)
}

View File

@ -332,15 +332,28 @@ export const ProductSku = {
name: 'parts',
label: 'Parts',
type: 'objectChildren',
objectType: 'partSku',
size: 'medium',
properties: [
{
name: 'part',
label: 'Part',
type: 'object',
objectType: 'part',
required: true,
showHyperlink: true
},
{
name: 'partSku',
label: 'Part SKU',
type: 'object',
objectType: 'partSku',
required: true,
showHyperlink: true
showHyperlink: true,
masterFilter: (objectData) => {
const partId = objectData?.part?._id
if (partId == null) return {}
return { part: partId }
}
},
{
name: 'quantity',