fix/standardized-phone-validation-and-billing #86
|
|
@ -113,36 +113,55 @@ export const CartDrawer: React.FC<CartDrawerProps> = ({
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-3 max-h-[220px] overflow-y-auto pr-1">
|
<div className="space-y-3 max-h-[220px] overflow-y-auto pr-1">
|
||||||
{cart.map((item) => (
|
{cart.map((item) => {
|
||||||
<div
|
const isCompletePackage =
|
||||||
key={item.code}
|
item.code === 'POINTS_PACK' ||
|
||||||
className="flex justify-between items-center gap-4 bg-slate-50 border border-slate-200/60 p-3 rounded-2xl"
|
item.code === 'PATTERN_CORE' ||
|
||||||
>
|
item.code === 'NUTRITION_CORE' ||
|
||||||
<div className="flex-1 min-w-0">
|
item.code === 'THERAPEUTICS_CORE' ||
|
||||||
<p className="text-xs font-bold text-slate-800 truncate">{item.name}</p>
|
item.name.toLowerCase().includes('complete pack') ||
|
||||||
<p className="text-[9px] text-slate-400 tracking-wider uppercase font-semibold">{item.category}</p>
|
item.name.toLowerCase().includes('complete package') ||
|
||||||
|
item.name.toLowerCase().includes('complete bundle') ||
|
||||||
|
item.category === 'Bundle';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={item.code}
|
||||||
|
className="flex justify-between items-center gap-4 bg-slate-50 border border-slate-200/60 p-3 rounded-2xl"
|
||||||
|
>
|
||||||
|
<div className="flex-1 min-w-0">
|
||||||
|
<div className="flex items-center gap-1.5 flex-wrap min-w-0">
|
||||||
|
<p className="text-xs font-bold text-slate-800 truncate">{item.name}</p>
|
||||||
|
{isCompletePackage && (
|
||||||
|
<span className="text-[8px] bg-gradient-to-r from-indigo-500 to-purple-600 text-white font-extrabold px-1.5 py-0.5 rounded tracking-wider uppercase flex-shrink-0">
|
||||||
|
Complete Pack
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<p className="text-[9px] text-slate-400 tracking-wider uppercase font-semibold">{item.category}</p>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<span className="text-xs font-bold text-indigo-600">
|
||||||
|
{(() => {
|
||||||
|
const calculatedItem = activePricing?.cart_items?.find((ci: any) => ci.code === item.code);
|
||||||
|
const price = calculatedItem
|
||||||
|
? calculatedItem.price
|
||||||
|
: (currency === 'INR' ? item.priceInr : currency === 'EUR' ? item.priceEur : item.priceUsd);
|
||||||
|
const symbol = currency === 'INR' ? '₹' : currency === 'EUR' ? '€' : '$';
|
||||||
|
return `${symbol}${price}`;
|
||||||
|
})()}
|
||||||
|
</span>
|
||||||
|
<button
|
||||||
|
onClick={() => toggleCartItem(item)}
|
||||||
|
className="h-7 w-7 rounded-lg bg-rose-50 text-rose-500 hover:bg-rose-100 flex items-center justify-center transition-colors"
|
||||||
|
title="Remove item"
|
||||||
|
>
|
||||||
|
<Trash2 className="h-3.5 w-3.5" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-3">
|
);
|
||||||
<span className="text-xs font-bold text-indigo-600">
|
})}
|
||||||
{(() => {
|
|
||||||
const calculatedItem = activePricing?.cart_items?.find((ci: any) => ci.code === item.code);
|
|
||||||
const price = calculatedItem
|
|
||||||
? calculatedItem.price
|
|
||||||
: (currency === 'INR' ? item.priceInr : currency === 'EUR' ? item.priceEur : item.priceUsd);
|
|
||||||
const symbol = currency === 'INR' ? '₹' : currency === 'EUR' ? '€' : '$';
|
|
||||||
return `${symbol}${price}`;
|
|
||||||
})()}
|
|
||||||
</span>
|
|
||||||
<button
|
|
||||||
onClick={() => toggleCartItem(item)}
|
|
||||||
className="h-7 w-7 rounded-lg bg-rose-50 text-rose-500 hover:bg-rose-100 flex items-center justify-center transition-colors"
|
|
||||||
title="Remove item"
|
|
||||||
>
|
|
||||||
<Trash2 className="h-3.5 w-3.5" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue