- {visibleCategories.map(cat => {
- const sel = selections[cat.id]
- const selectedProds: Product[] = []
- if (cat.allow_multiselect && sel?.productIds) {
- sel.productIds.forEach(pId => {
- const p = products.find(prod => prod.id === pId)
- if (p) selectedProds.push(p)
- })
- } else if (sel?.productId) {
- const p = products.find(prod => prod.id === sel.productId)
- if (p) selectedProds.push(p)
- }
-
- if (selectedProds.length === 0) return null
-
- // Sort selected products by price to determine which ones are free
- const sortedProds = [...selectedProds].sort((a, b) => a.base_price - b.base_price)
- const freeLimit = cat.allow_multiselect ? cat.free_items_limit : 0
-
- return (
-
-
-
- {cat.name}
-
- {sortedProds.map((prod, idx) => {
- const isFree = idx < freeLimit
- const actualPrice = isFree ? 0 : prod.base_price
- const catTotal =
- Number(actualPrice) +
- (sel?.moduleIds?.reduce((acc, mId) => {
- const mod = prod.modules?.find(m => m.id === mId)
- const qty = moduleQuantities[mId] || 1
- return acc + (Number(mod?.price ?? 0) * qty)
- }, 0) || 0)
-
- return (
-
-
-
- {prod.name} {isFree && (Frei)}
-
-
- {new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(catTotal)}
- {' '}{billingLabel(prod.billing_interval)}
-
-
- {sel?.moduleIds && sel.moduleIds.length > 0 && (
-
- Module: {sel.moduleIds
- .map(id => {
- const mod = prod.modules?.find(m => m.id === id)
- const qty = moduleQuantities[id] || 1
- return mod ? `${mod.name}${mod.has_quantity ? ` (x${qty})` : ''}` : ''
- })
- .filter(Boolean)
- .join(', ')}
-
- )}
-
- )
- })}
+
+ {finalItemsToShow.map((item, itemIdx) => (
+
+
+ Gerät: {item.deviceName}
+ {item.billingInterval === 'one_time' ? 'Kauf' : 'Abo'}
- )
- })}
+
+ {visibleCategories.map(cat => {
+ const sel = item.selections[cat.id]
+ const selectedProds: Product[] = []
+ if (cat.allow_multiselect && sel?.productIds) {
+ sel.productIds.forEach(pId => {
+ const p = products.find(prod => prod.id === pId)
+ if (p) selectedProds.push(p)
+ })
+ } else if (sel?.productId) {
+ const p = products.find(prod => prod.id === sel.productId)
+ if (p) selectedProds.push(p)
+ }
+
+ if (selectedProds.length === 0) return null
+
+ const sortedProds = [...selectedProds].sort((a, b) => a.base_price - b.base_price)
+ const freeLimit = cat.allow_multiselect ? cat.free_items_limit : 0
+
+ return (
+
+
+
+ {cat.name}
+
+ {sortedProds.map((prod, idx) => {
+ const isFree = idx < freeLimit
+ const actualPrice = isFree ? 0 : prod.base_price
+ const catTotal =
+ Number(actualPrice) +
+ (sel?.moduleIds?.reduce((acc, mId) => {
+ const mod = prod.modules?.find(m => m.id === mId)
+ const qty = item.moduleQuantities[mId] || 1
+ return acc + (Number(mod?.price ?? 0) * qty)
+ }, 0) || 0)
+
+ return (
+
+
+
+ {prod.name} {isFree && (Frei)}
+
+
+ {new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(catTotal)}
+
+
+ {sel?.moduleIds && sel.moduleIds.length > 0 && (
+
+ Module: {sel.moduleIds
+ .map(id => {
+ const mod = prod.modules?.find(m => m.id === id)
+ const qty = item.moduleQuantities[id] || 1
+ return mod ? `${mod.name}${mod.has_quantity ? ` (x${qty})` : ''}` : ''
+ })
+ .filter(Boolean)
+ .join(', ')}
+
+ )}
+
+ )
+ })}
+
+ )
+ })}
+
+ ))}
{selectedEndCustomer ? (