Integrate PDF parsing functionality: Add 'pdf-parse' dependency to package.json and package-lock.json. Update worshipController to include logic for handling PDF imports, enhancing the event management process. Refactor routing to support new newsletter import features and improve event form handling for better user experience.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<template>
|
||||
<div class="worship-management">
|
||||
<h2>Gottesdienst Verwaltung</h2>
|
||||
<button v-if="hasNewsletterPreview" type="button" @click="goBackToNewsletterImport">
|
||||
Zurück zum Gemeindebrief-Import
|
||||
</button>
|
||||
<div class="action-buttons">
|
||||
<button type="button" @click="toggleImportSection" class="import-button">
|
||||
{{ showImportSection ? 'Import ausblenden' : 'Import' }}
|
||||
@@ -27,6 +30,7 @@
|
||||
{{ isImporting ? 'Importiere...' : 'Importieren' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-if="showExportSection" class="export-section">
|
||||
<h3>Gottesdienste exportieren</h3>
|
||||
@@ -323,6 +327,7 @@ export default {
|
||||
showImportDialog: false,
|
||||
importedWorships: [],
|
||||
importErrors: [],
|
||||
hasNewsletterPreview: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -375,8 +380,76 @@ export default {
|
||||
await this.fetchWorships();
|
||||
await this.fetchWorshipOptions();
|
||||
await this.fetchLiturgicalDays();
|
||||
this.hasNewsletterPreview = !!localStorage.getItem('newsletter_import_last_result');
|
||||
this.applyNewsletterDraft();
|
||||
},
|
||||
methods: {
|
||||
goBackToNewsletterImport() {
|
||||
this.$router.push('/admin/newsletter-import');
|
||||
},
|
||||
applyNewsletterDraft() {
|
||||
const bulkRaw = localStorage.getItem('newsletter_import_worship_bulk_draft');
|
||||
if (bulkRaw) {
|
||||
localStorage.removeItem('newsletter_import_worship_bulk_draft');
|
||||
try {
|
||||
const bulk = JSON.parse(bulkRaw);
|
||||
if (Array.isArray(bulk) && bulk.length > 0) {
|
||||
this.importedWorships = bulk.map((w) => {
|
||||
const eventPlace = this.eventPlaces.find((ep) => ep.id === w.eventPlaceId);
|
||||
return {
|
||||
date: w.date || '',
|
||||
dayName: w.dayName || '',
|
||||
time: w.time || '',
|
||||
title: w.title || '',
|
||||
organizer: w.organizer || '',
|
||||
collection: w.collection || '',
|
||||
sacristanService: w.sacristanService || '',
|
||||
organPlaying: w.organPlaying || '',
|
||||
approved: !!w.approved,
|
||||
eventPlace: eventPlace || null,
|
||||
eventPlaceId: w.eventPlaceId || null,
|
||||
_changedFields: [],
|
||||
_oldValues: {},
|
||||
_isUpdate: false,
|
||||
_isNew: true,
|
||||
};
|
||||
});
|
||||
this.importErrors = [];
|
||||
this.showImportDialog = true;
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Übernehmen des Gemeindebrief-Bulk-Entwurfs (Gottesdienst):', error);
|
||||
}
|
||||
}
|
||||
|
||||
const raw = localStorage.getItem('newsletter_import_worship_draft');
|
||||
if (!raw) return;
|
||||
localStorage.removeItem('newsletter_import_worship_draft');
|
||||
try {
|
||||
const draft = JSON.parse(raw);
|
||||
if (draft?.title) this.worshipData.title = draft.title;
|
||||
if (draft?.date) this.worshipData.date = draft.date;
|
||||
if (draft?.time) this.worshipData.time = draft.time;
|
||||
if (draft?.organizer) {
|
||||
this.selectedOrganizers = draft.organizer.split(',').map((name) => ({ name: name.trim() })).filter((x) => x.name);
|
||||
}
|
||||
if (draft?.collection) this.worshipData.collection = draft.collection;
|
||||
if (typeof draft?.selfInformation === 'boolean') this.worshipData.selfInformation = draft.selfInformation;
|
||||
if (typeof draft?.neighborInvitation === 'boolean') this.worshipData.neighborInvitation = draft.neighborInvitation;
|
||||
if (draft?.eventPlaceId) {
|
||||
this.selectedEventPlace = this.eventPlaces.find((ep) => ep.id === draft.eventPlaceId) || null;
|
||||
}
|
||||
if (draft?.sourceText && !this.worshipData.introLine) {
|
||||
this.worshipData.introLine = draft.sourceText;
|
||||
}
|
||||
if (this.worshipData.date) {
|
||||
this.updateDayNameFromDate();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Übernehmen des Gemeindebrief-Entwurfs (Gottesdienst):', error);
|
||||
}
|
||||
},
|
||||
isFieldChanged(worship, fieldName) {
|
||||
return worship._changedFields && worship._changedFields.includes(fieldName);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user