feat(shop): move linked fee configuration to product level
All checks were successful
Staging Build / build (push) Successful in 2m52s
All checks were successful
Staging Build / build (push) Successful in 2m52s
This commit is contained in:
@@ -302,31 +302,8 @@ export function WysiwygAdminClient({
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{(prod.modules || []).length > 0 ? (
|
||||
(prod.modules || []).map((m) => (
|
||||
<span key={m.id} className="inline-flex items-center gap-2 px-2.5 py-1 rounded text-[10px] bg-white/10 text-slate-300 font-medium">
|
||||
<span>{m.name}</span>
|
||||
<select
|
||||
value={m.linked_fee_product_id || ''}
|
||||
onChange={async (e) => {
|
||||
const val = e.target.value || null
|
||||
const updatedModules = (prod.modules || []).map(mod =>
|
||||
mod.id === m.id ? { ...mod, linked_fee_product_id: val } : mod
|
||||
)
|
||||
setProducts(products.map(p => p.id === prod.id ? { ...p, modules: updatedModules } : p))
|
||||
await updateProduct(prod.id, {}, updatedModules)
|
||||
}}
|
||||
className="bg-slate-900 border border-white/10 text-[9px] text-slate-400 focus:ring-0 cursor-pointer rounded px-1 py-0.5 outline-none max-w-[120px]"
|
||||
title="Verknüpfte Gebühr"
|
||||
>
|
||||
<option value="">Keine Gebühr</option>
|
||||
{products
|
||||
.filter(p => p.billing_interval === 'monthly')
|
||||
.map(p => (
|
||||
<option key={p.id} value={p.id}>
|
||||
+ {p.name} ({p.base_price} €)
|
||||
</option>
|
||||
))
|
||||
}
|
||||
</select>
|
||||
<span key={m.id} className="inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] bg-white/10 text-slate-300 font-medium">
|
||||
{m.name}
|
||||
<button
|
||||
onClick={async () => {
|
||||
const updatedModules = (prod.modules || []).filter(mod => mod.id !== m.id)
|
||||
@@ -425,6 +402,30 @@ export function WysiwygAdminClient({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Verknüpfte monatliche Gebühr */}
|
||||
<div className="space-y-1 mt-2">
|
||||
<span className="text-[10px] uppercase tracking-wider text-slate-500 font-semibold block">Verknüpfte Gebühr:</span>
|
||||
<select
|
||||
value={prod.linked_fee_product_id || ''}
|
||||
onChange={async (e) => {
|
||||
const val = e.target.value || null
|
||||
setProducts(products.map(p => p.id === prod.id ? { ...p, linked_fee_product_id: val } : p))
|
||||
await updateProduct(prod.id, { linked_fee_product_id: val }, prod.modules || [])
|
||||
}}
|
||||
className="w-full bg-slate-950 border border-white/10 text-[10px] text-slate-300 focus:ring-0 cursor-pointer rounded px-2 py-1 outline-none"
|
||||
>
|
||||
<option value="">Keine Gebühr verknüpft</option>
|
||||
{products
|
||||
.filter(p => p.billing_interval === 'monthly' && p.id !== prod.id)
|
||||
.map(p => (
|
||||
<option key={p.id} value={p.id}>
|
||||
{p.name} ({new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(p.base_price)} / mtl.)
|
||||
</option>
|
||||
))
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{/* Modul hinzufügen Popover */}
|
||||
<div className="mt-3 pt-2 border-t border-white/5">
|
||||
<ModulePopover
|
||||
|
||||
Reference in New Issue
Block a user