diff --git a/frontend/src/components/CourtDrawingDialog.vue b/frontend/src/components/CourtDrawingDialog.vue
index 02468fe..057cb99 100644
--- a/frontend/src/components/CourtDrawingDialog.vue
+++ b/frontend/src/components/CourtDrawingDialog.vue
@@ -46,6 +46,18 @@ export default {
initialDrawingData: {
type: Object,
default: null
+ },
+ initialCode: {
+ type: String,
+ default: null
+ },
+ initialName: {
+ type: String,
+ default: null
+ },
+ initialDescription: {
+ type: String,
+ default: null
}
},
emits: ['update:modelValue', 'close', 'ok'],
@@ -78,6 +90,14 @@ export default {
modelValue(newVal) {
// Wenn Dialog geöffnet wird, stelle sicher dass Tool neu gezeichnet wird
if (newVal) {
+ // Setze initiale Felder, falls vorhanden
+ if (this.initialCode || this.initialName || this.initialDescription) {
+ this.currentFields = {
+ code: this.initialCode || '',
+ name: this.initialName || '',
+ description: this.initialDescription || ''
+ };
+ }
this.$nextTick(() => {
// Warte bis der Dialog vollständig gerendert ist
setTimeout(() => {
@@ -86,6 +106,9 @@ export default {
}
}, 100);
});
+ } else {
+ // Dialog wird geschlossen - Felder zurücksetzen
+ this.currentFields = null;
}
}
},
diff --git a/frontend/src/views/DiaryView.vue b/frontend/src/views/DiaryView.vue
index 1d4bc55..337d7eb 100644
--- a/frontend/src/views/DiaryView.vue
+++ b/frontend/src/views/DiaryView.vue
@@ -321,6 +321,8 @@
|
+
@@ -402,6 +404,15 @@
+
@@ -664,8 +675,12 @@
@@ -879,6 +894,7 @@ export default {
memberGroupsMap: {}, // key: memberId, value: groupId
groupActivityMembersOpenId: null,
groupActivityMembersMap: {}, // key: groupActivityId, value: Set(participantIds)
+ editingGroupActivity: null, // Gruppenaktivität, die gerade bearbeitet wird
// Schnell hinzufügen Dialog
showQuickAddDialog: false,
newMember: {
@@ -2460,12 +2476,39 @@ export default {
async handleDrawingDialogOkForDiary(result) {
if (!result || !result.code) {
this.showInfo('Fehler', 'Keine Übungsdaten erhalten', '', 'error');
+ this.editingGroupActivity = null;
return;
}
try {
const code = result.code.trim();
+ // Wenn eine Gruppenaktivität bearbeitet wird
+ if (this.editingGroupActivity && this.editingGroupActivity.groupPredefinedActivity) {
+ const predefinedActivityId = this.editingGroupActivity.groupPredefinedActivity.id;
+
+ // Aktualisiere die PredefinedActivity
+ const updateData = {
+ name: result.name || (result.fields && result.fields.name) || this.editingGroupActivity.groupPredefinedActivity.name || '',
+ code: code,
+ description: result.description || (result.fields && result.fields.description) || this.editingGroupActivity.groupPredefinedActivity.description || '',
+ durationText: this.editingGroupActivity.groupPredefinedActivity.durationText || '',
+ duration: this.editingGroupActivity.groupPredefinedActivity.duration || null,
+ imageLink: this.editingGroupActivity.groupPredefinedActivity.imageLink || '',
+ drawingData: result.drawingData || null
+ };
+
+ await apiClient.put(`/predefined-activities/${predefinedActivityId}`, updateData);
+
+ // Lade den Trainingsplan neu
+ if (this.date && this.date.id) {
+ await this.loadTrainingPlan();
+ }
+
+ this.editingGroupActivity = null;
+ return;
+ }
+
// Suche nach existierender Aktivität mit diesem Code
const searchResults = await this.searchPredefinedActivities(code);
const existing = searchResults.find(a => a.code && a.code.trim().toLowerCase() === code.toLowerCase());
@@ -2522,8 +2565,19 @@ export default {
} catch (error) {
const msg = getSafeErrorMessage(error, 'Fehler beim Erstellen der Aktivität');
this.showInfo('Fehler', msg, '', 'error');
+ } finally {
+ this.editingGroupActivity = null;
}
},
+
+ editGroupActivity(groupItem) {
+ if (!groupItem || !groupItem.groupPredefinedActivity) {
+ this.showInfo('Fehler', 'Keine Aktivität zum Bearbeiten gefunden', '', 'error');
+ return;
+ }
+ this.editingGroupActivity = groupItem;
+ this.showDrawingDialog = true;
+ },
async loadTrainingPlan() {
try {
|