Fix FAQFull: Use isDraft boolean for draft filtering, fix Kontakt ID override
This commit is contained in:
+33
-25
@@ -41,21 +41,25 @@ const questions_pl: FAQFullBlock['questions'] = [
|
||||
category: 'Dodatkowe (DO UZUPEŁNIENIA)',
|
||||
question: 'Czy mogę się rozliczyć, jeśli pracowałem w Niemczech tylko kilka miesięcy?',
|
||||
answer: PLACEHOLDER_ANSWER_PL,
|
||||
isDraft: true,
|
||||
},
|
||||
{
|
||||
category: 'Dodatkowe (DO UZUPEŁNIENIA)',
|
||||
question: 'Co się stanie, jeśli spóźnię się ze złożeniem deklaracji?',
|
||||
answer: PLACEHOLDER_ANSWER_PL,
|
||||
isDraft: true,
|
||||
},
|
||||
{
|
||||
category: 'Dodatkowe (DO UZUPEŁNIENIA)',
|
||||
question: 'Czy mogę rozliczyć się wspólnie z małżonkiem, jeśli on/ona nie pracuje w Niemczech?',
|
||||
answer: PLACEHOLDER_ANSWER_PL,
|
||||
isDraft: true,
|
||||
},
|
||||
{
|
||||
category: 'Dodatkowe (DO UZUPEŁNIENIA)',
|
||||
question: 'Czy pomagacie też w rozliczeniu za lata wcześniejsze (wsteczne)?',
|
||||
answer: PLACEHOLDER_ANSWER_PL,
|
||||
isDraft: true,
|
||||
}
|
||||
];
|
||||
|
||||
@@ -91,24 +95,28 @@ const questions_de: FAQFullBlock['questions'] = [
|
||||
answer: 'Ja, wir unterstützen Sie beim gesamten Antragsprozess für Kindergeld bei der Familienkasse. Wir kümmern uns um die Anlagen, die Überprüfung des Familienstands und den Schriftverkehr.',
|
||||
},
|
||||
{
|
||||
category: 'Zusätzlich (ZUM AUSFÜLLEN)',
|
||||
category: 'Zusätzliche (ZU ERGÄNZEN)',
|
||||
question: 'Kann ich eine Steuererklärung abgeben, wenn ich nur wenige Monate in Deutschland gearbeitet habe?',
|
||||
answer: PLACEHOLDER_ANSWER_DE,
|
||||
isDraft: true,
|
||||
},
|
||||
{
|
||||
category: 'Zusätzlich (ZUM AUSFÜLLEN)',
|
||||
question: 'Was passiert, wenn ich die Steuererklärung zu spät abgebe?',
|
||||
category: 'Zusätzliche (ZU ERGÄNZEN)',
|
||||
question: 'Was passiert, wenn ich die Erklärung zu spät abgebe?',
|
||||
answer: PLACEHOLDER_ANSWER_DE,
|
||||
isDraft: true,
|
||||
},
|
||||
{
|
||||
category: 'Zusätzlich (ZUM AUSFÜLLEN)',
|
||||
question: 'Kann ich mit meinem Ehepartner zusammenveranlagt werden, auch wenn er/sie nicht in Deutschland arbeitet?',
|
||||
category: 'Zusätzliche (ZU ERGÄNZEN)',
|
||||
question: 'Kann ich mich gemeinsam mit meinem Ehepartner veranlagen lassen, wenn er/sie nicht in Deutschland arbeitet?',
|
||||
answer: PLACEHOLDER_ANSWER_DE,
|
||||
isDraft: true,
|
||||
},
|
||||
{
|
||||
category: 'Zusätzlich (ZUM AUSFÜLLEN)',
|
||||
question: 'Helfen Sie auch bei der Steuererklärung für Vorjahre (rückwirkend)?',
|
||||
category: 'Zusätzliche (ZU ERGÄNZEN)',
|
||||
question: 'Helfen Sie auch bei der Steuererklärung für frühere Jahre (rückwirkend)?',
|
||||
answer: PLACEHOLDER_ANSWER_DE,
|
||||
isDraft: true,
|
||||
}
|
||||
];
|
||||
|
||||
@@ -128,14 +136,7 @@ async function run() {
|
||||
locale: locale
|
||||
})
|
||||
|
||||
const hasFaqFull = page.layout?.some(block => block.blockType === 'faqFull');
|
||||
|
||||
if (hasFaqFull) {
|
||||
console.log(`[${locale}] Migracja już wykonana - znaleziono blok faqFull. Pomijam.`)
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(`[${locale}] Migruję... Dodaję faqFull...`)
|
||||
const hasFaqFull = page.layout?.findIndex(block => block.blockType === 'faqFull') ?? -1;
|
||||
|
||||
const title = locale === 'de' ? 'Häufig gestellte Fragen' : 'Często zadawane pytania'
|
||||
const subtitle = locale === 'de' ? 'Hier finden Sie Antworten auf die wichtigsten Fragen zur Steuererklärung.' : 'Tutaj znajdziesz odpowiedzi na najważniejsze pytania dotyczące rozliczeń podatkowych.'
|
||||
@@ -143,16 +144,23 @@ async function run() {
|
||||
const ctaText = locale === 'de' ? 'Haben Sie noch Fragen? Schreiben Sie uns auf WhatsApp' : 'Masz więcej pytań? Napisz na WhatsApp'
|
||||
const ctaUrl = '#'; // CMS link, dynamically handled later if needed
|
||||
|
||||
const newLayout = [
|
||||
{
|
||||
blockType: 'faqFull',
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
questions: locale === 'pl' ? questions_pl : questions_de,
|
||||
ctaText: ctaText,
|
||||
ctaUrl: ctaUrl
|
||||
} as FAQFullBlock
|
||||
]
|
||||
const faqFullBlock = {
|
||||
blockType: 'faqFull',
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
ctaText: ctaText,
|
||||
ctaUrl: ctaUrl,
|
||||
questions: locale === 'de' ? questions_de : questions_pl
|
||||
} as FAQFullBlock
|
||||
|
||||
let newLayout = page.layout ? [...page.layout] : [];
|
||||
if (hasFaqFull > -1) {
|
||||
console.log(`[${locale}] Zastępuję istniejący blok faqFull...`)
|
||||
newLayout[hasFaqFull] = faqFullBlock;
|
||||
} else {
|
||||
console.log(`[${locale}] Dodaję faqFull...`)
|
||||
newLayout.push(faqFullBlock)
|
||||
}
|
||||
|
||||
await payload.update({
|
||||
collection: 'pages',
|
||||
|
||||
Reference in New Issue
Block a user