fix, table cp, mengenfeld
This commit is contained in:
@@ -29,19 +29,19 @@ function createInitialState() {
|
||||
step: STEPS.PRODUCT,
|
||||
customerType: null, // 'business' | 'private'
|
||||
product: null,
|
||||
// Calculator-Felder
|
||||
// Calculator-Felder - Defaults auf günstigste Optionen
|
||||
quantity: 100,
|
||||
format: 'a6h', // a4, a6h (a6p), a6q (a6l)
|
||||
shippingMode: 'direct', // direct, bulk
|
||||
envelope: true, // Bei Sammelversand: Kuvert ja/nein
|
||||
envelopeMode: 'recipientData', // recipientData, customText, none (Beschriftungsart)
|
||||
format: 'a6p', // a6p ist günstiger als a4 (kein Aufpreis)
|
||||
shippingMode: 'bulk', // Sammelversand ist günstiger (nur Pauschale statt pro Stück)
|
||||
envelope: false, // Kein Kuvert ist günstiger
|
||||
envelopeMode: 'none', // Keine Beschriftung ist günstiger
|
||||
followupYearlyVolume: '50-199',
|
||||
followupCreateMode: 'manual', // auto, manual
|
||||
followupCreateMode: 'manual', // Manuell ist günstiger (keine API-Kosten)
|
||||
// Motiv (nur für Postkarten/Einladungen mit A6)
|
||||
motifNeed: false,
|
||||
motifNeed: false, // Kein Motiv ist günstiger
|
||||
motifSource: null, // upload, design
|
||||
// Inhalt
|
||||
contentCreateMode: 'self', // self, textservice
|
||||
contentCreateMode: 'self', // Selbst erstellen ist günstiger
|
||||
};
|
||||
}
|
||||
|
||||
@@ -55,8 +55,14 @@ function reducer(state, action) {
|
||||
};
|
||||
|
||||
case 'SET_PRODUCT': {
|
||||
// Default-Format setzen
|
||||
const defaultFormat = action.product.formats?.[0] || 'a4';
|
||||
// Default-Format: Günstigstes zuerst (A6 hat keinen Aufpreis bei Postkarten/Einladungen)
|
||||
// Bei Produkten mit supportsMotif ist A6 günstiger, also bevorzugen
|
||||
const formats = action.product.formats || [];
|
||||
const hasA6 = formats.some(f => f === 'a6p' || f === 'a6l');
|
||||
const hasA4 = formats.includes('a4');
|
||||
// A6 bevorzugen wenn verfügbar (günstiger), sonst erstes Format
|
||||
const defaultFormat = hasA6 ? 'a6p' : (formats[0] || 'a4');
|
||||
|
||||
// Default-Menge je nach Kundentyp
|
||||
const settings = window.SkriftPreisrechner?.settings || window.SkriftConfigurator?.settings || {};
|
||||
const dynamicPricing = settings.dynamic_pricing || {};
|
||||
|
||||
Reference in New Issue
Block a user