feat: menitelny pocet produktov vo vernostnych zlavach
Tlacidlo Pridat produkt (novy produkt sa hned otvori) a mazanie produktu; karty sa radia po 2 na riadok. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2605b6281b
commit
b13a447c64
1 file changed
+33
-2
@@ -870,11 +870,41 @@ export const ConfigPanel: React.FC<ConfigPanelProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Vernostné produkty */}
|
||||
{/* Vernostné produkty (ľubovoľný počet, 2 na riadok) */}
|
||||
<div className="space-y-2 pt-2">
|
||||
<span className="text-xs font-bold text-gray-700 block">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-xs font-bold text-gray-700">
|
||||
Vernostné produkty ({module.data.products?.length || 0})
|
||||
</span>
|
||||
<button
|
||||
onClick={() => {
|
||||
const newP: CardProduct = {
|
||||
id: `lp-${Date.now()}`,
|
||||
title: 'Nový vernostný produkt',
|
||||
imageUrl: `${SUPABASE_ASSETS_BASE}vernostna_karta-produkt_1.png`,
|
||||
priceMain: '',
|
||||
priceSub: '',
|
||||
unitPrice: '',
|
||||
discountText: '',
|
||||
badgeText: 'zľava',
|
||||
noCardDiscount: '20%',
|
||||
noCardPriceMain: '0',
|
||||
noCardPriceSub: '99',
|
||||
noCardUnitPrice: '',
|
||||
cardDiscount: '30%',
|
||||
cardPriceMain: '0',
|
||||
cardPriceSub: '79',
|
||||
cardUnitPrice: '',
|
||||
stores: { potraviny: true, supermarket: true, tempo: true }
|
||||
};
|
||||
updateData({ products: [...(module.data.products || []), newP] });
|
||||
onSelectProduct?.(newP.id);
|
||||
}}
|
||||
className="text-xs font-bold text-white bg-gray-900 hover:bg-black px-2.5 py-1 rounded-lg flex items-center gap-1"
|
||||
>
|
||||
<Plus className="w-3.5 h-3.5" /> Pridať produkt
|
||||
</button>
|
||||
</div>
|
||||
{(module.data.products || []).map((p: CardProduct, pIdx: number) => (
|
||||
<ProductEditor
|
||||
key={p.id || pIdx}
|
||||
@@ -885,6 +915,7 @@ export const ConfigPanel: React.FC<ConfigPanelProps> = ({
|
||||
onToggle={() => onSelectProduct?.(selectedProductId === p.id ? null : p.id)}
|
||||
availableBadges={availableBadges || []}
|
||||
onChange={(patch) => updateProduct(pIdx, patch)}
|
||||
onDelete={() => updateData({ products: (module.data.products || []).filter((_: CardProduct, i: number) => i !== pIdx) })}
|
||||
onOpenBadgeEditor={onOpenBadgeManager ? () => onOpenBadgeManager(p.id) : undefined}
|
||||
onApplyBadgeToSection={() => applyBadgeToSection(p)}
|
||||
onApplyBadgeToAll={onApplyBadgeToAll ? () => applyBadgeToAll(p, 'loyalty') : undefined}
|
||||
|
||||
Reference in new issue
Block a user