-
Quantity (10-{maxForCoffee} pcs)
-
- {qty} pcs
-
+
+
+
+
Pack selection
+
{packsToCapsules(qty).toLocaleString('en-US')} capsules
-
-
-
- onChangeQuantity(coffee.id, parseInt(e.target.value, 10) - qty)}
- className="w-full appearance-none cursor-pointer bg-transparent"
- style={{
- background:
- 'linear-gradient(to right,#0f172a 0%,#0f172a ' +
- sliderProgress +
- '%,#e2e8f0 ' +
- sliderProgress +
- '%,#e2e8f0 100%)',
- height: '6px',
- borderRadius: '999px',
- }}
- />
-
-
-
-
-
Subtotal
-
EUR {((qty / 10) * coffee.pricePer10).toFixed(2)}
+
+ {qty.toLocaleString('en-US')} packs
- )}
+
+
+
+ onSetQuantity(coffee.id, Number(e.target.value))}
+ className="h-10 w-full rounded-xl border border-slate-200 bg-white px-3 text-center text-sm font-semibold text-slate-900 shadow-sm focus:border-slate-900 focus:outline-none focus:ring-2 focus:ring-slate-900/10"
+ />
+
+
+
+
+ You can add {addableForCoffee.toLocaleString('en-US')} more packs here.
+ EUR {subtotal.toFixed(2)}
+
+
);
})}
diff --git a/src/app/coffee-abonnements/components/SelectionSummaryCard.tsx b/src/app/coffee-abonnements/components/SelectionSummaryCard.tsx
index 2dc3c52..4ffe6a9 100644
--- a/src/app/coffee-abonnements/components/SelectionSummaryCard.tsx
+++ b/src/app/coffee-abonnements/components/SelectionSummaryCard.tsx
@@ -1,4 +1,5 @@
import type { CoffeeItem } from '../hooks/getActiveCoffees';
+import { MAX_ABO_PACKS, MIN_ABO_PACKS, packsToCapsules } from '../lib/orderRules';
type SelectedEntry = {
coffee: CoffeeItem;
@@ -12,9 +13,9 @@ type Props = {
selectedShippingFee: number;
totalNetWithShipping: number;
totalCapsules: number;
- packsSelected: number;
- selectedPlanCapsules: number;
- requiredPacks: number;
+ totalPacks: number;
+ orderPackError: string | null;
+ remainingMinPacks: number;
canProceed: boolean;
onProceed: () => void;
title: string;
@@ -29,9 +30,9 @@ export default function SelectionSummaryCard({
selectedShippingFee,
totalNetWithShipping,
totalCapsules,
- packsSelected,
- selectedPlanCapsules,
- requiredPacks,
+ totalPacks,
+ orderPackError,
+ remainingMinPacks,
canProceed,
onProceed,
title,
@@ -49,10 +50,10 @@ export default function SelectionSummaryCard({
{entry.coffee.name}
- {entry.quantity} pcs • EUR {entry.coffee.pricePer10}/10
+ {entry.quantity} packs ({packsToCapsules(entry.quantity)} capsules) • EUR {entry.coffee.pricePer10.toFixed(2)}/pack
-
EUR {((entry.quantity / 10) * entry.coffee.pricePer10).toFixed(2)}
+
EUR {(entry.quantity * entry.coffee.pricePer10).toFixed(2)}
))}
@@ -68,11 +69,21 @@ export default function SelectionSummaryCard({