Enhance addGroupActivity method to support predefined activities in diary date activities

This commit updates the addGroupActivity method in the DiaryDateActivityService to accept a predefinedActivityId, allowing for the retrieval or creation of predefined activities based on the provided ID or activity name. Additionally, the frontend DiaryView is modified to include predefinedActivityId in the new plan item, improving the handling of group activities.
This commit is contained in:
Torsten Schulz (local)
2025-11-16 22:12:11 +01:00
parent 9cc9db3a5a
commit 6896484e9e
3 changed files with 37 additions and 8 deletions

View File

@@ -817,6 +817,7 @@ export default {
duration: '',
durationText: '',
groupId: '',
predefinedActivityId: null,
isTimeBlock: false,
},
predefinedActivities: [],
@@ -1730,6 +1731,7 @@ export default {
clubId: this.currentClub,
diaryDateId: this.date.id,
activity: this.newPlanItem.activity,
predefinedActivityId: this.newPlanItem.predefinedActivityId,
groupId: Number(this.newPlanItem.groupId),
timeblockId: this.selectedTimeblockId,
});
@@ -1738,7 +1740,7 @@ export default {
this.addNewItem = false;
this.addNewGroupActivity = false;
this.selectedTimeblockId = null;
this.newPlanItem = { activity: '', duration: '', durationText: '', groupId: '' };
this.newPlanItem = { activity: '', duration: '', durationText: '', groupId: '', predefinedActivityId: null };
this.trainingPlan = await apiClient.get(`/diary-date-activities/${this.currentClub}/${this.date.id}`).then(response => response.data);
this.calculateIntermediateTimes();
} catch (error) {
@@ -2450,6 +2452,7 @@ export default {
this.newPlanItem.activity = (s.code && s.code.trim() !== '') ? s.code : s.name;
this.newPlanItem.durationText = s.durationText || '';
this.newPlanItem.duration = s.duration || '';
this.newPlanItem.predefinedActivityId = s.id || null;
this.newItemShowDropdown = false;
this.newItemSearchResults = [];
},