diff --git a/src/content/admin/WorshipManagement.vue b/src/content/admin/WorshipManagement.vue
index ef499b8..6e2b508 100644
--- a/src/content/admin/WorshipManagement.vue
+++ b/src/content/admin/WorshipManagement.vue
@@ -72,8 +72,29 @@
{{ error }}
+
+
+ Importierter Zeitraum: {{ importedDateRangeLabel }}
+
+
+
+
+
+
+
+ Angezeigt: {{ filteredImportedWorships.length }} von {{ importedWorships.length }}
+
+
-
+
Gottesdienst {{ index + 1 }}
NEU
@@ -197,7 +218,7 @@
Selbstinformation
-
+
@@ -373,6 +394,8 @@ export default {
importedWorships: [],
importErrors: [],
hasNewsletterPreview: false,
+ importFilterFrom: '',
+ importFilterTo: '',
};
},
computed: {
@@ -410,6 +433,34 @@ export default {
}
return filtered;
+ },
+ filteredImportedWorships() {
+ return this.importedWorships.filter((w) => {
+ const dateValue = this.normalizeDateOnly(w.date);
+ if (!dateValue) return false;
+
+ // 1) Vergangene Termine grundsätzlich ausblenden.
+ const today = new Date();
+ today.setHours(0, 0, 0, 0);
+ const worshipDate = new Date(dateValue);
+ worshipDate.setHours(0, 0, 0, 0);
+ if (worshipDate < today) return false;
+
+ // 2) Zusätzlicher Von/Bis-Filter.
+ if (this.importFilterFrom && dateValue < this.importFilterFrom) return false;
+ if (this.importFilterTo && dateValue > this.importFilterTo) return false;
+ return true;
+ });
+ },
+ importedDateRangeLabel() {
+ const dates = this.importedWorships
+ .map((w) => this.normalizeDateOnly(w.date))
+ .filter(Boolean)
+ .sort();
+ if (dates.length === 0) return '-';
+ const from = dates[0];
+ const to = dates[dates.length - 1];
+ return `${this.formatDate(from)} bis ${this.formatDate(to)}`;
}
},
watch: {
@@ -430,6 +481,20 @@ export default {
this.applyNewsletterDraft();
},
methods: {
+ normalizeDateOnly(value) {
+ if (!value) return '';
+ if (typeof value === 'string') return value.split('T')[0];
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) return '';
+ const y = date.getFullYear();
+ const m = String(date.getMonth() + 1).padStart(2, '0');
+ const d = String(date.getDate()).padStart(2, '0');
+ return `${y}-${m}-${d}`;
+ },
+ clearImportDateFilter() {
+ this.importFilterFrom = '';
+ this.importFilterTo = '';
+ },
goBackToNewsletterImport() {
this.$router.push('/admin/newsletter-import');
},
@@ -459,6 +524,7 @@ export default {
_oldValues: {},
_isUpdate: false,
_isNew: true,
+ _tempId: `bulk-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
};
});
this.importErrors = [];
@@ -904,6 +970,7 @@ export default {
_importChoice: w._importChoice || (w._hasDayPlaceConflict ? 'keepExisting' : 'import'),
neighborInvitation: !!w.neighborInvitation,
selfInformation: !!w.selfInformation,
+ _tempId: `imp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
_selectedOrganizer: this.resolveImportOrganizerOption(w.organizer || '')
};
});
@@ -924,13 +991,17 @@ export default {
this.showImportDialog = false;
this.importedWorships = [];
this.importErrors = [];
+ this.clearImportDateFilter();
this.selectedFile = null;
if (this.$refs.fileInput) {
this.$refs.fileInput.value = '';
}
},
- removeWorship(index) {
- this.importedWorships.splice(index, 1);
+ removeWorship(worshipToRemove) {
+ const index = this.importedWorships.findIndex((w) => w === worshipToRemove || (w._tempId && w._tempId === worshipToRemove._tempId));
+ if (index >= 0) {
+ this.importedWorships.splice(index, 1);
+ }
},
handleImportNeighborInvitationChange(worship) {
if (worship?.neighborInvitation) {
@@ -938,12 +1009,13 @@ export default {
}
},
async saveImportedWorships() {
- if (this.importedWorships.length === 0) {
+ const worshipsForSave = this.filteredImportedWorships;
+ if (worshipsForSave.length === 0) {
alert('Keine Gottesdienste zum Speichern vorhanden.');
return;
}
- const invalidWorship = this.importedWorships.find(w => {
+ const invalidWorship = worshipsForSave.find(w => {
if (w._hasDayPlaceConflict && w._importChoice === 'keepExisting') {
return false;
}
@@ -958,7 +1030,7 @@ export default {
this.isImporting = true;
// Daten für das Backend vorbereiten
- const worshipsToSave = this.importedWorships.map(w => {
+ const worshipsToSave = worshipsForSave.map(w => {
// Stelle sicher, dass das Datum im richtigen Format ist (YYYY-MM-DD)
let dateStr = w.date;
if (w.date instanceof Date) {