diff --git a/frontend/src/views/DiaryView.vue b/frontend/src/views/DiaryView.vue
index 24f58f5..f37a517 100644
--- a/frontend/src/views/DiaryView.vue
+++ b/frontend/src/views/DiaryView.vue
@@ -69,19 +69,15 @@
-
Teilnehmer
- zuordnen
+
+ Teilnehmer zuordnen
+
+
+
+
+
+
📝
🖼
ℹ️
@@ -457,8 +477,7 @@ export default {
renderModalData: null,
groups: [],
currentTimeBlockId: null,
- newGroupName: '',
- newGroupLead: '',
+ newGroupCount: 2,
addtype: 'activity',
addNewItem: false,
addNewGroupActivity: false,
@@ -497,6 +516,8 @@ export default {
// Aktivitäts-Teilnehmer
activityMembersOpenId: null,
activityMembersMap: {}, // key: activityId, value: Set(participantIds)
+ activityGroupsMap: {}, // key: activityId, value: groupId
+ memberGroupsMap: {}, // key: memberId, value: groupId
// Schnell hinzufügen Dialog
showQuickAddDialog: false,
newMember: {
@@ -1335,18 +1356,23 @@ export default {
currentTime = this.addDurationToTime(currentTime, item.duration);
});
},
- async addGroup() {
+ async createGroups() {
try {
- const form = {
- clubid: this.currentClub,
- dateid: this.date.id,
- name: this.newGroupName,
- lead: this.newGroupLead,
+ // Erstelle die gewünschte Anzahl Gruppen mit Namen 1 bis X
+ for (let i = 1; i <= this.newGroupCount; i++) {
+ const form = {
+ clubid: this.currentClub,
+ dateid: this.date.id,
+ name: i.toString(),
+ lead: '', // Leiter wird leer gelassen
+ }
+ await apiClient.post('/group', form);
}
- await apiClient.post('/group', form);
await this.loadGroups();
+ this.showInfo('Erfolg', `${this.newGroupCount} Gruppen wurden erfolgreich erstellt!`, '', 'success');
} catch (error) {
-
+ console.error('Fehler beim Erstellen der Gruppen:', error);
+ this.showInfo('Fehler', 'Fehler beim Erstellen der Gruppen', '', 'error');
}
},
parentIsTimeblock() {
@@ -1709,6 +1735,88 @@ export default {
}
},
+ // Gruppenzuordnung für Aktivitäten
+ hasActivityMembers(activityId) {
+ const setIds = this.activityMembersMap[activityId];
+ return setIds && setIds.size > 0;
+ },
+
+ getActivityGroup(activityId) {
+ return this.activityGroupsMap[activityId] || '';
+ },
+
+ async updateActivityGroup(activityId, groupId) {
+ try {
+ // Hier würde normalerweise ein API-Call gemacht werden
+ // Für jetzt speichern wir es nur lokal
+ this.activityGroupsMap[activityId] = groupId || '';
+
+ // TODO: API-Call zum Speichern der Gruppenzuordnung
+ // await apiClient.put(`/diary-date-activities/${activityId}/group`, { groupId });
+
+ this.showInfo('Erfolg', 'Gruppenzuordnung aktualisiert', '', 'success');
+ } catch (error) {
+ console.error('Fehler beim Aktualisieren der Gruppenzuordnung:', error);
+ this.showInfo('Fehler', 'Fehler beim Aktualisieren der Gruppenzuordnung', '', 'error');
+ }
+ },
+
+ // Bulk-Zuordnungen für Aktivitäten
+ async assignAllMembersToActivity(activityId) {
+ try {
+ // Alle anwesenden Mitglieder zur Aktivität hinzufügen
+ for (const member of this.presentMembers) {
+ if (!this.isAssignedToActivity(activityId, member.id)) {
+ await this.toggleMemberForActivity(activityId, member.id, true);
+ }
+ }
+ } catch (error) {
+ console.error('Fehler beim Zuordnen aller Teilnehmer:', error);
+ this.showInfo('Fehler', 'Fehler beim Zuordnen aller Teilnehmer', '', 'error');
+ }
+ },
+
+ async assignGroupToActivity(activityId, groupId) {
+ if (!groupId) return; // Leere Auswahl ignorieren
+
+ try {
+ // Alle Mitglieder der gewählten Gruppe zur Aktivität hinzufügen
+ const groupMembers = this.presentMembers.filter(member =>
+ this.getMemberGroup(member.id) === groupId
+ );
+
+ for (const member of groupMembers) {
+ if (!this.isAssignedToActivity(activityId, member.id)) {
+ await this.toggleMemberForActivity(activityId, member.id, true);
+ }
+ }
+ } catch (error) {
+ console.error('Fehler beim Zuordnen der Gruppe:', error);
+ this.showInfo('Fehler', 'Fehler beim Zuordnen der Gruppe', '', 'error');
+ }
+ },
+
+ // Gruppenzuordnung für Teilnehmer
+ getMemberGroup(memberId) {
+ return this.memberGroupsMap[memberId] || '';
+ },
+
+ async updateMemberGroup(memberId, groupId) {
+ try {
+ // Hier würde normalerweise ein API-Call gemacht werden
+ // Für jetzt speichern wir es nur lokal
+ this.memberGroupsMap[memberId] = groupId || '';
+
+ // TODO: API-Call zum Speichern der Teilnehmer-Gruppenzuordnung
+ // await apiClient.put(`/participants/${this.date.id}/${memberId}/group`, { groupId });
+
+ console.log(`Teilnehmer ${memberId} wurde Gruppe ${groupId} zugewiesen`);
+ } catch (error) {
+ console.error('Fehler beim Aktualisieren der Teilnehmer-Gruppenzuordnung:', error);
+ this.showInfo('Fehler', 'Fehler beim Aktualisieren der Teilnehmer-Gruppenzuordnung', '', 'error');
+ }
+ },
+
// Schnell hinzufügen Dialog Methoden
openQuickAddDialog() {
this.showQuickAddDialog = true;