94 lines
3.0 KiB
TypeScript
94 lines
3.0 KiB
TypeScript
import { getPayload } from 'payload'
|
|
import configPromise from '../src/payload.config'
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
|
|
async function run() {
|
|
const payload = await getPayload({ config: configPromise })
|
|
|
|
const stepsPL = [
|
|
{
|
|
title: "Napisz na WhatsApp",
|
|
description: "Skontaktuj się z nami bezpośrednio przez WhatsApp lub formularz poniżej, aby rozpocząć i ustalić szczegóły Twojej sytuacji podatkowej."
|
|
},
|
|
{
|
|
title: "Przekaż dokumenty",
|
|
description: "Prześlij zaświadczenia o dochodach (Lohnsteuerbescheinigung, EU/EWR), podatkowy numer identyfikacyjny (IdNr) lub PESEL oraz ewentualne potwierdzenia kosztów."
|
|
},
|
|
{
|
|
title: "Odbierz gotowe rozliczenie do podpisu",
|
|
description: "Przygotowujemy kompletną deklarację, wyliczamy przewidywany zwrot z urzędu skarbowego i przesyłamy gotowy dokument do Twojej akceptacji i podpisu."
|
|
}
|
|
];
|
|
|
|
const finalStepsDE = [
|
|
{
|
|
title: "WhatsApp kontaktieren",
|
|
description: "Schreiben Sie uns direkt über WhatsApp oder das untenstehende Formular, um Ihre Anfrage und steuerliche Situation zu besprechen."
|
|
},
|
|
{
|
|
title: "Unterlagen einreichen",
|
|
description: "Übermitteln Sie Ihre Lohnsteuerbescheinigung, Steuer-Identifikationsnummer sowie relevante Belege für Werbungskosten und Freibeträge."
|
|
},
|
|
{
|
|
title: "Fertige Erklärung zur Unterschrift",
|
|
description: "Wir erstellen Ihre vollständige Erklärung, berechnen die voraussichtliche Erstattung und übermitteln Ihnen die Unterlagen zur Freigabe."
|
|
}
|
|
];
|
|
|
|
// 1. Update PL
|
|
const jsuPL = await payload.find({ collection: 'pages', locale: 'pl', where: { slug: { equals: 'jak-sie-umowic' } } })
|
|
if (jsuPL.docs.length > 0) {
|
|
const doc = jsuPL.docs[0]
|
|
const layout = doc.layout || []
|
|
let updated = false
|
|
for (let i = 0; i < layout.length; i++) {
|
|
if (layout[i].blockType === 'process') {
|
|
layout[i].steps = stepsPL.map((s: any) => ({
|
|
title: s.title,
|
|
description: s.description
|
|
}))
|
|
updated = true
|
|
}
|
|
}
|
|
if (updated) {
|
|
await payload.update({
|
|
collection: 'pages',
|
|
id: doc.id,
|
|
locale: 'pl',
|
|
data: { layout }
|
|
})
|
|
console.log("Zaktualizowano kroki dla PL")
|
|
}
|
|
}
|
|
|
|
// 2. Update DE
|
|
const jsuDE = await payload.find({ collection: 'pages', locale: 'de', where: { slug: { equals: 'terminvereinbarung' } } })
|
|
if (jsuDE.docs.length > 0) {
|
|
const doc = jsuDE.docs[0]
|
|
const layout = doc.layout || []
|
|
let updated = false
|
|
for (let i = 0; i < layout.length; i++) {
|
|
if (layout[i].blockType === 'process') {
|
|
layout[i].steps = finalStepsDE.map((s: any) => ({
|
|
title: s.title,
|
|
description: s.description
|
|
}))
|
|
updated = true
|
|
}
|
|
}
|
|
if (updated) {
|
|
await payload.update({
|
|
collection: 'pages',
|
|
id: doc.id,
|
|
locale: 'de',
|
|
data: { layout }
|
|
})
|
|
console.log("Zaktualizowano kroki dla DE")
|
|
}
|
|
}
|
|
|
|
process.exit(0)
|
|
}
|
|
run().catch(console.error)
|