feat: import ZIP s podkladmi aj do sekcie Vernostne zlavy (bez zmeny farby pozadia)

S kartou = Cena s vernostnou kartou (inak akciova cena), bez karty = akciova
(inak bezna) cena; jednotkova cena bez karty sa prepocita.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub_HostacnyandClaude Opus 5.5 committed 2026-10-21 16:36:01 +02:00
1 parent 8660f92b5a
commit 5cbe981430
4 files changed
+77 -13

No files matched your search

+6 -2
View File
@@ -358,7 +358,7 @@ export default function Home() {
const handleImportProducts = (imported: ProductItem[], options?: { replace?: boolean }) => {
if (!selectedModuleId) return;
const target = campaign.modules.find((m) => m.id === selectedModuleId);
if (!target || target.type !== 'products_grid') {
if (!target || (target.type !== 'products_grid' && target.type !== 'loyalty_club')) {
alert('Pre import prosím najskôr označte produktovú sekciu.');
return;
}
@@ -372,7 +372,10 @@ export default function Home() {
const withLayout = imported.map((p) => {
if (!first) return p;
const inherited: Partial<ProductItem> = {};
for (const k of layoutKeys) if (p[k] === undefined && first[k] !== undefined) Object.assign(inherited, { [k]: first[k] });
for (const k of layoutKeys) {
if (k === 'cardBgColor' && target.type === 'loyalty_club') continue; // vernostné zľavy: farba pozadia ostáva
if (p[k] === undefined && first[k] !== undefined) Object.assign(inherited, { [k]: first[k] });
}
return { ...inherited, ...p };
});
@@ -1015,6 +1018,7 @@ export default function Home() {
onClose={() => setIsImportOpen(false)}
onImportProducts={handleImportProducts}
availableBadges={availableBadges}
variant={campaign.modules.find((m) => m.id === selectedModuleId)?.type === 'loyalty_club' ? 'loyalty' : 'standard'}
/>
{/* Modál Editora cenoviek (SVG -> PNG) */}