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
All checks were successful
Staging Build / build (push) Successful in 2m36s
This commit is contained in:
@@ -41,9 +41,11 @@ export function ProductList({ initialProducts, categories }: { initialProducts:
|
||||
|
||||
const filteredProducts = useMemo(() => {
|
||||
return products.filter(p => {
|
||||
if (p.billing_interval === 'one_time') return showKauf
|
||||
if (p.billing_interval === 'monthly') return showAbo
|
||||
return true
|
||||
const inKauf = p.show_in_kauf ?? true
|
||||
const inAbo = p.show_in_abo ?? true
|
||||
if (showKauf && inKauf) return true
|
||||
if (showAbo && inAbo) return true
|
||||
return false
|
||||
})
|
||||
}, [products, showKauf, showAbo])
|
||||
|
||||
@@ -134,14 +136,14 @@ export function ProductList({ initialProducts, categories }: { initialProducts:
|
||||
checked={showKauf}
|
||||
onCheckedChange={(checked) => setShowKauf(!!checked)}
|
||||
/>
|
||||
Kaufprodukte
|
||||
In Kaufauswahl
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm font-medium text-slate-700 dark:text-slate-300 cursor-pointer select-none">
|
||||
<Checkbox
|
||||
checked={showAbo}
|
||||
onCheckedChange={(checked) => setShowAbo(!!checked)}
|
||||
/>
|
||||
Mietprodukte
|
||||
In Aboauswahl
|
||||
</label>
|
||||
<Button
|
||||
variant="outline"
|
||||
|
||||
Reference in New Issue
Block a user