fix(piece) : persist slot quantity on blur and send prix as string
- Save composant piece slot quantity via PATCH on blur - Pass slotId through hierarchy and selection entries - Send prix as string (not number) to match backend expectation - Show quantity in view mode when > 1 - Allow quantity edit for all pieces (not just root-level) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ export interface DefinitionOverridePayload {
|
||||
name?: string
|
||||
reference?: string
|
||||
constructeurIds?: string[]
|
||||
prix?: number
|
||||
prix?: string
|
||||
}
|
||||
|
||||
export const sanitizeDefinitionOverrides = (definition: any): DefinitionOverridePayload | null => {
|
||||
@@ -41,7 +41,7 @@ export const sanitizeDefinitionOverrides = (definition: any): DefinitionOverride
|
||||
if (definition.prix !== undefined && definition.prix !== null && definition.prix !== '') {
|
||||
const parsed = Number(definition.prix)
|
||||
if (!Number.isNaN(parsed)) {
|
||||
payload.prix = parsed
|
||||
payload.prix = String(parsed)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ export type SelectionEntry = {
|
||||
requirementLabel: string
|
||||
resolvedName: string
|
||||
quantity?: number
|
||||
slotId?: string
|
||||
_definition?: Record<string, any>
|
||||
}
|
||||
|
||||
@@ -62,6 +63,7 @@ export function collectStructureSelections(
|
||||
requirementLabel: resolvers.resolvePieceLabel(definition),
|
||||
resolvedName: catalogPiece?.name || selectedId,
|
||||
quantity: typeof definition?.quantity === 'number' ? definition.quantity : undefined,
|
||||
slotId: isNonEmptyString(entry?.slotId) ? entry.slotId : undefined,
|
||||
_definition: definition,
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user