feat(categories): allow disabling preselection
All checks were successful
Staging Build / build (push) Successful in 2m45s
All checks were successful
Staging Build / build (push) Successful in 2m45s
This commit is contained in:
@@ -211,7 +211,7 @@ export function OrderWizard({
|
||||
return
|
||||
}
|
||||
}
|
||||
if (cat.allow_multiselect) {
|
||||
if (cat.allow_multiselect || cat.preselect === false) {
|
||||
init[cat.id] = { productId: null, productIds: [], moduleIds: [] }
|
||||
} else {
|
||||
const first = products.find(p => p.category_id === cat.id && p.show_in_abo !== false)
|
||||
@@ -459,11 +459,19 @@ export function OrderWizard({
|
||||
}
|
||||
const newSelections: Record<string, CategorySelection> = {}
|
||||
categories.forEach(cat => {
|
||||
const matchingProd = products.find(p =>
|
||||
p.category_id === cat.id &&
|
||||
(val === 'one_time' ? p.show_in_kauf !== false : p.show_in_abo !== false)
|
||||
)
|
||||
newSelections[cat.id] = { productId: matchingProd?.id ?? null, moduleIds: [] }
|
||||
if (cat.allow_multiselect || cat.preselect === false) {
|
||||
newSelections[cat.id] = { productId: null, productIds: [], moduleIds: [] }
|
||||
} else {
|
||||
const matchingProd = products.find(p =>
|
||||
p.category_id === cat.id &&
|
||||
(val === 'one_time' ? p.show_in_kauf !== false : p.show_in_abo !== false)
|
||||
)
|
||||
newSelections[cat.id] = {
|
||||
productId: matchingProd?.id ?? null,
|
||||
productIds: matchingProd ? [matchingProd.id] : [],
|
||||
moduleIds: []
|
||||
}
|
||||
}
|
||||
})
|
||||
setSelections(newSelections)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user