From db9e40437224712f3bb63c0523ea5baac87f1b70 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Sat, 4 Oct 2025 02:30:23 +0200 Subject: [PATCH] =?UTF-8?q?Aktualisiert=20die=20Logik=20zum=20L=C3=B6schen?= =?UTF-8?q?=20eines=20Datums=20in=20DiaryView.vue.=20Die=20Schaltfl=C3=A4c?= =?UTF-8?q?he=20zum=20L=C3=B6schen=20wird=20nun=20nur=20angezeigt,=20wenn?= =?UTF-8?q?=20keine=20Inhalte=20(Trainingplan,=20Teilnehmer,=20Aktivit?= =?UTF-8?q?=C3=A4ten,=20Unf=C3=A4lle=20oder=20Notizen)=20vorhanden=20sind.?= =?UTF-8?q?=20F=C3=BCgt=20eine=20neue=20Methode=20`canDeleteCurrentDate`?= =?UTF-8?q?=20hinzu,=20die=20diese=20=C3=9Cberpr=C3=BCfung=20durchf=C3=BCh?= =?UTF-8?q?rt,=20um=20die=20Benutzerfreundlichkeit=20zu=20verbessern=20und?= =?UTF-8?q?=20versehentliche=20L=C3=B6schungen=20zu=20verhindern.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/DiaryView.vue | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) 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;