feat(wizard): allow deleting devices in step 4 summary and redirect home when empty
This commit is contained in:
@@ -718,13 +718,19 @@ export function OrderWizard({
|
||||
resetSels[cat.id] = { productId: first?.id ?? null, productIds: first ? [first.id] : [], moduleIds: [] }
|
||||
}
|
||||
})
|
||||
setSelections(resetSels)
|
||||
} else if (editingIdx !== null && idx < editingIdx) {
|
||||
setEditingIdx(editingIdx - 1)
|
||||
}
|
||||
setBasketItems(prev => prev.filter((_, i) => i !== idx))
|
||||
}
|
||||
|
||||
const handleDeleteFromSummary = (idx: number) => {
|
||||
deleteBasketItem(idx)
|
||||
if (basketItems.length - 1 <= 0) {
|
||||
router.push('/')
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (isSubmitting) return
|
||||
setIsSubmitting(true)
|
||||
@@ -1137,6 +1143,7 @@ export function OrderWizard({
|
||||
setOrderNotes={setOrderNotes}
|
||||
onEditBasketItem={handleEditFromSummary}
|
||||
onAddNewBasketItem={handleAddAnotherFromSummary}
|
||||
onDeleteBasketItem={handleDeleteFromSummary}
|
||||
/>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user