fix(DiaryView): update plan status badge rendering logic
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 45s

- Enhanced the condition for displaying the plan status badge to ensure it only renders when a valid label is present, improving clarity in the activity display.
- Refactored the loading of the training plan to use a dedicated method, streamlining the data fetching process and improving code organization.
- Initialized activity member maps after loading the training plan to ensure accurate member tracking for activities.
This commit is contained in:
Torsten Schulz (local)
2026-05-12 09:49:48 +02:00
parent be9caf92a4
commit 27f8af559b

View File

@@ -433,7 +433,7 @@
<div v-for="item in row.sharedItems" :key="`shared-${item.id}`" class="plan-cell-item">
<div class="plan-activity-main">
<span @click="startActivityEdit(item)" class="clickable activity-label">{{ getPlanItemDisplayLabel(item) }}</span>
<span v-if="!isStructuralPlanItem(item)" class="plan-status-badge" :class="`plan-status-badge-${getPlanItemStatus(item).tone}`">
<span v-if="!isStructuralPlanItem(item) && getPlanItemStatus(item).label" class="plan-status-badge" :class="`plan-status-badge-${getPlanItemStatus(item).tone}`">
{{ getPlanItemStatus(item).label }}
</span>
</div>
@@ -451,7 +451,7 @@
<div v-for="item in (row.groupItems[group.id] || [])" :key="`group-item-${item.id}`" class="plan-cell-item">
<div class="plan-activity-main">
<span @click="startActivityEdit(item)" class="clickable activity-label">{{ getPlanItemDisplayLabel(item) }}</span>
<span v-if="!isStructuralPlanItem(item)" class="plan-status-badge" :class="`plan-status-badge-${getPlanItemStatus(item).tone}`">
<span v-if="!isStructuralPlanItem(item) && getPlanItemStatus(item).label" class="plan-status-badge" :class="`plan-status-badge-${getPlanItemStatus(item).tone}`">
{{ getPlanItemStatus(item).label }}
</span>
</div>
@@ -494,7 +494,7 @@
: (item.predefinedActivity ? item.predefinedActivity.name :
item.activity) }}
</span>
<span v-if="!isStructuralPlanItem(item)" class="plan-status-badge" :class="`plan-status-badge-${getPlanItemStatus(item).tone}`" :title="getPlanItemStatus(item).reason || ''">
<span v-if="!isStructuralPlanItem(item) && getPlanItemStatus(item).label" class="plan-status-badge" :class="`plan-status-badge-${getPlanItemStatus(item).tone}`" :title="getPlanItemStatus(item).reason || ''">
{{ getPlanItemStatus(item).label }}
</span>
</div>
@@ -589,7 +589,7 @@
? groupItem.groupPredefinedActivity.code
: groupItem.groupPredefinedActivity.name }}
</span>
<span v-if="!isStructuralPlanItem(groupItem)" class="plan-status-badge" :class="`plan-status-badge-${getPlanItemStatus(groupItem).tone}`" :title="getPlanItemStatus(groupItem).reason || ''">
<span v-if="!isStructuralPlanItem(groupItem) && getPlanItemStatus(groupItem).label" class="plan-status-badge" :class="`plan-status-badge-${getPlanItemStatus(groupItem).tone}`" :title="getPlanItemStatus(groupItem).reason || ''">
{{ getPlanItemStatus(groupItem).label }}
</span>
</div>
@@ -1640,10 +1640,7 @@ export default {
await this.loadMembers();
await this.loadParticipants(dateId);
await this.loadActivities(dateId);
this.trainingPlan = await apiClient
.get(`/diary-date-activities/${this.currentClub}/${this.date.id}`)
.then(response => response.data);
this.calculateIntermediateTimes();
await this.loadTrainingPlan();
this.initializeSortable();
await this.loadGroups();
this.activeOverviewPanel = this.isDiaryDayConfigured() ? null : 'trainingDay';
@@ -3547,6 +3544,9 @@ export default {
try {
this.trainingPlan = await apiClient.get(`/diary-date-activities/${this.currentClub}/${this.date.id}`).then(response => response.data);
this.calculateIntermediateTimes();
this.activityMembersMap = {};
this.groupActivityMembersMap = {};
await this.loadAllActivityMembers();
} catch (error) {
console.error('Fehler beim Laden des Trainingsplans:', error);
}
@@ -3637,7 +3637,7 @@ export default {
: this.presentMembers.filter(member => this.isAssignedToActivity(item.id, member.id)).length;
if (assignedCount > 0) {
return { key: 'ready', label: this.$t('diary.statusReadyShort'), tone: 'ready' };
return { key: 'ready', label: '', tone: 'ready' };
}
return { key: 'open', label: this.$t('diary.statusOpenShort'), tone: 'open' };