Compare commits
1 Commits
f8403ddfbc
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4fc0f1fee |
@@ -313,9 +313,8 @@ export function useComponentEdit(componentId: string) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const savePieceSlotSelection = async (slotId: string, selectedPieceId: string | null) => {
|
const savePieceSlotSelection = async (slotId: string, selectedPieceId: string | null) => {
|
||||||
try {
|
const result = await patch(`/composant-piece-slots/${slotId}`, { selectedPieceId })
|
||||||
await patch(`/composant-piece-slots/${slotId}`, { selectedPieceId })
|
if (result.success) {
|
||||||
// Update local structure
|
|
||||||
const structure = component.value?.structure
|
const structure = component.value?.structure
|
||||||
if (structure?.pieces) {
|
if (structure?.pieces) {
|
||||||
const slot = (structure.pieces as any[]).find((s: any) => s.slotId === slotId)
|
const slot = (structure.pieces as any[]).find((s: any) => s.slotId === slotId)
|
||||||
@@ -323,14 +322,11 @@ export function useComponentEdit(componentId: string) {
|
|||||||
}
|
}
|
||||||
toast.showSuccess('Pièce mise à jour')
|
toast.showSuccess('Pièce mise à jour')
|
||||||
}
|
}
|
||||||
catch (error: any) {
|
|
||||||
toast.showError(error?.message || 'Erreur lors de la mise à jour')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveProductSlotSelection = async (slotId: string, selectedProductId: string | null) => {
|
const saveProductSlotSelection = async (slotId: string, selectedProductId: string | null) => {
|
||||||
try {
|
const result = await patch(`/composant-product-slots/${slotId}`, { selectedProductId })
|
||||||
await patch(`/composant-product-slots/${slotId}`, { selectedProductId })
|
if (result.success) {
|
||||||
const structure = component.value?.structure
|
const structure = component.value?.structure
|
||||||
if (structure?.products) {
|
if (structure?.products) {
|
||||||
const slot = (structure.products as any[]).find((s: any) => s.slotId === slotId)
|
const slot = (structure.products as any[]).find((s: any) => s.slotId === slotId)
|
||||||
@@ -338,14 +334,11 @@ export function useComponentEdit(componentId: string) {
|
|||||||
}
|
}
|
||||||
toast.showSuccess('Produit mis à jour')
|
toast.showSuccess('Produit mis à jour')
|
||||||
}
|
}
|
||||||
catch (error: any) {
|
|
||||||
toast.showError(error?.message || 'Erreur lors de la mise à jour')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveSubcomponentSlotSelection = async (slotId: string, selectedComposantId: string | null) => {
|
const saveSubcomponentSlotSelection = async (slotId: string, selectedComposantId: string | null) => {
|
||||||
try {
|
const result = await patch(`/composant-subcomponent-slots/${slotId}`, { selectedComposantId })
|
||||||
await patch(`/composant-subcomponent-slots/${slotId}`, { selectedComposantId })
|
if (result.success) {
|
||||||
const structure = component.value?.structure
|
const structure = component.value?.structure
|
||||||
if (structure?.subcomponents) {
|
if (structure?.subcomponents) {
|
||||||
const slot = (structure.subcomponents as any[]).find((s: any) => s.slotId === slotId)
|
const slot = (structure.subcomponents as any[]).find((s: any) => s.slotId === slotId)
|
||||||
@@ -353,9 +346,6 @@ export function useComponentEdit(componentId: string) {
|
|||||||
}
|
}
|
||||||
toast.showSuccess('Sous-composant mis à jour')
|
toast.showSuccess('Sous-composant mis à jour')
|
||||||
}
|
}
|
||||||
catch (error: any) {
|
|
||||||
toast.showError(error?.message || 'Erreur lors de la mise à jour')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveSlotQuantity = async (entry: SelectionEntry) => {
|
const saveSlotQuantity = async (entry: SelectionEntry) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user