diff --git a/frontend/src/views/DiaryView.vue b/frontend/src/views/DiaryView.vue
index 9bc3b2a..2b611ea 100644
--- a/frontend/src/views/DiaryView.vue
+++ b/frontend/src/views/DiaryView.vue
@@ -8,7 +8,7 @@
-
+
@@ -534,6 +534,20 @@ export default {
return this.newMember.firstName.trim() !== '' &&
(this.newMember.gender === 'male' || this.newMember.gender === 'female' || this.newMember.gender === 'diverse');
},
+
+ canDeleteCurrentDate() {
+ if (!this.date || this.date === 'new') return false;
+
+ // Prüfe ob keine Inhalte vorhanden sind
+ const hasTrainingPlan = this.trainingPlan && this.trainingPlan.length > 0;
+ const hasParticipants = this.participants && this.participants.length > 0;
+ const hasActivities = this.activities && this.activities.length > 0;
+ const hasAccidents = this.accidents && this.accidents.length > 0;
+ const hasNotes = this.notes && this.notes.length > 0;
+
+ // Kann gelöscht werden wenn alle Listen leer sind
+ return !hasTrainingPlan && !hasParticipants && !hasActivities && !hasAccidents && !hasNotes;
+ },
},
methods: {
drawingDataFor(pa) {
@@ -1044,9 +1058,8 @@ export default {
},
async deleteCurrentDate() {
- if (!this.date || this.date === 'new') return;
- if (this.trainingPlan.length > 0) {
- alert('Datum kann nicht gelöscht werden: Es sind bereits Aktivitäten vorhanden.');
+ if (!this.canDeleteCurrentDate) {
+ alert('Datum kann nicht gelöscht werden: Es sind noch Inhalte vorhanden (Trainingplan, Teilnehmer, Aktivitäten, Unfälle oder Notizen).');
return;
}
if (!confirm('Dieses Datum wirklich löschen?')) return;