fix: Filter products in admin list based on show_in_kauf and show_in_abo flags instead of billing_interval
All checks were successful
Staging Build / build (push) Successful in 2m36s

This commit is contained in:
DanielS
2026-06-25 13:07:18 +02:00
parent 9e189f331a
commit 9246fb7d77

View File

@@ -41,9 +41,11 @@ export function ProductList({ initialProducts, categories }: { initialProducts:
const filteredProducts = useMemo(() => { const filteredProducts = useMemo(() => {
return products.filter(p => { return products.filter(p => {
if (p.billing_interval === 'one_time') return showKauf const inKauf = p.show_in_kauf ?? true
if (p.billing_interval === 'monthly') return showAbo const inAbo = p.show_in_abo ?? true
return true if (showKauf && inKauf) return true
if (showAbo && inAbo) return true
return false
}) })
}, [products, showKauf, showAbo]) }, [products, showKauf, showAbo])
@@ -134,14 +136,14 @@ export function ProductList({ initialProducts, categories }: { initialProducts:
checked={showKauf} checked={showKauf}
onCheckedChange={(checked) => setShowKauf(!!checked)} onCheckedChange={(checked) => setShowKauf(!!checked)}
/> />
Kaufprodukte In Kaufauswahl
</label> </label>
<label className="flex items-center gap-2 text-sm font-medium text-slate-700 dark:text-slate-300 cursor-pointer select-none"> <label className="flex items-center gap-2 text-sm font-medium text-slate-700 dark:text-slate-300 cursor-pointer select-none">
<Checkbox <Checkbox
checked={showAbo} checked={showAbo}
onCheckedChange={(checked) => setShowAbo(!!checked)} onCheckedChange={(checked) => setShowAbo(!!checked)}
/> />
Mietprodukte In Aboauswahl
</label> </label>
<Button <Button
variant="outline" variant="outline"