- Vintage Modell hinzugefuegt - Equipment Multi-Select (Neue Buchung + Bearbeitung) - Kundenadresse in Formularen - Bearbeiten-Seite fuer Buchungen - Abbau-Zeiten in Formularen und Uebersicht - Vertrag PDF nur bei Privatkunden - LexOffice Kontakt-Erstellung Fix (BUSINESS) - Zurueck-Pfeil auf Touren-Seite
114 lines
3.6 KiB
TypeScript
114 lines
3.6 KiB
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
// LexOffice Artikel-IDs (von Dennis bereitgestellt)
|
|
const LEXOFFICE_ARTICLES = {
|
|
// Fotoboxen
|
|
VINTAGE: {
|
|
withFlat: '3f26c02c-d705-41a6-9b49-2e2e96e77036', // Fotobox Vintage Flat
|
|
withoutFlat: '5d9d3716-f81e-4e46-b5cf-13988f489cc2', // Fotobox Vintage
|
|
},
|
|
NOSTALGIE: {
|
|
withFlat: '701bd150-48c0-4937-b628-f4a754d86264', // Fotobox Nostalgie Flat
|
|
withoutFlat: '8954bd20-570c-4a7d-9ac3-8ee756652a89', // Fotobox Nostalgie
|
|
},
|
|
MAGIC_MIRROR: {
|
|
withFlat: '39ec59e7-57a6-4d6d-80f6-645e589c4b2c', // Fotobox Magic Mirror Flat
|
|
withoutFlat: '72bbe51b-c0bb-437a-963b-248cb105553a', // Fotobox Magic Mirror
|
|
},
|
|
|
|
// Equipment/Extras
|
|
ACCESSORIES: 'c62d4dad-4f04-4330-9019-f9804bb43ddc',
|
|
VIP_BARRIER: 'e3942394-94d7-45ea-a31b-a1b035f6f34e',
|
|
PRINT_FLAT_DIY: '774aba7f-2c20-4d65-b8d0-4793f27d2d71',
|
|
CARD_GAME: '17d563fe-5f00-4591-a414-d013d7ce68e0',
|
|
RED_CARPET: 'd138da65-4e23-4a88-813a-1f3725a75a15',
|
|
SERVICE_TECH: 'ec972616-8bc5-4334-876d-b442838a8bbf',
|
|
};
|
|
|
|
async function setupLexOfficeMapping() {
|
|
console.log('🔧 Konfiguriere LexOffice Artikel-IDs...\n');
|
|
|
|
try {
|
|
const locations = await prisma.location.findMany();
|
|
|
|
for (const location of locations) {
|
|
console.log(`📍 ${location.name}:`);
|
|
|
|
// VINTAGE_SMILE / VINTAGE_PHOTOS (gleiche Box)
|
|
const vintageConfigs = await prisma.priceConfig.findMany({
|
|
where: {
|
|
locationId: location.id,
|
|
model: {
|
|
in: ['VINTAGE_SMILE', 'VINTAGE_PHOTOS'],
|
|
},
|
|
},
|
|
});
|
|
|
|
for (const config of vintageConfigs) {
|
|
await prisma.priceConfig.update({
|
|
where: { id: config.id },
|
|
data: {
|
|
lexofficeArticleId: LEXOFFICE_ARTICLES.VINTAGE.withoutFlat,
|
|
lexofficeArticleIdWithFlat: LEXOFFICE_ARTICLES.VINTAGE.withFlat,
|
|
},
|
|
});
|
|
console.log(` ✅ ${config.model}: LexOffice IDs gesetzt`);
|
|
}
|
|
|
|
// NOSTALGIE
|
|
const nostalgieConfig = await prisma.priceConfig.findFirst({
|
|
where: {
|
|
locationId: location.id,
|
|
model: 'NOSTALGIE',
|
|
},
|
|
});
|
|
|
|
if (nostalgieConfig) {
|
|
await prisma.priceConfig.update({
|
|
where: { id: nostalgieConfig.id },
|
|
data: {
|
|
lexofficeArticleId: LEXOFFICE_ARTICLES.NOSTALGIE.withoutFlat,
|
|
lexofficeArticleIdWithFlat: LEXOFFICE_ARTICLES.NOSTALGIE.withFlat,
|
|
},
|
|
});
|
|
console.log(` ✅ NOSTALGIE: LexOffice IDs gesetzt`);
|
|
}
|
|
|
|
// MAGIC_MIRROR
|
|
const magicMirrorConfig = await prisma.priceConfig.findFirst({
|
|
where: {
|
|
locationId: location.id,
|
|
model: 'MAGIC_MIRROR',
|
|
},
|
|
});
|
|
|
|
if (magicMirrorConfig) {
|
|
await prisma.priceConfig.update({
|
|
where: { id: magicMirrorConfig.id },
|
|
data: {
|
|
lexofficeArticleId: LEXOFFICE_ARTICLES.MAGIC_MIRROR.withoutFlat,
|
|
lexofficeArticleIdWithFlat: LEXOFFICE_ARTICLES.MAGIC_MIRROR.withFlat,
|
|
},
|
|
});
|
|
console.log(` ✅ MAGIC_MIRROR: LexOffice IDs gesetzt`);
|
|
}
|
|
}
|
|
|
|
console.log('\n🎉 LexOffice Artikel-Mapping erfolgreich konfiguriert!');
|
|
console.log('\n📝 Nächste Schritte:');
|
|
console.log(' 1. Testbuchung erstellen (mit/ohne Druckflatrate)');
|
|
console.log(' 2. LexOffice Angebot generieren');
|
|
console.log(' 3. Prüfen ob korrekte Artikel-IDs verwendet werden\n');
|
|
|
|
} catch (error) {
|
|
console.error('❌ Fehler:', error);
|
|
throw error;
|
|
} finally {
|
|
await prisma.$disconnect();
|
|
}
|
|
}
|
|
|
|
setupLexOfficeMapping();
|