feat(officialTournament): add auto-registration for tournament participants
- Implemented a new endpoint to automatically register participants for official tournaments using the Click-TT service. - Added a corresponding method in the frontend to trigger the auto-registration process, enhancing user experience by simplifying participant management. - Updated the official tournament controller and routes to support the new functionality.
This commit is contained in:
@@ -125,6 +125,9 @@
|
||||
<div class="top-actions">
|
||||
<button class="btn-secondary" @click="openMemberDialog" :disabled="!parsed || !activeMembers.length">{{ $t('officialTournaments.selectMembers') }}</button>
|
||||
<button class="btn-primary" :disabled="!selectedMemberIds.length" @click="generateMembersPdf">{{ $t('officialTournaments.pdfForSelectedMembers') }}</button>
|
||||
<button class="btn-primary" :disabled="!uploadedId || !pendingAutoRegistrationCount || autoRegistering" @click="autoRegisterParticipants">
|
||||
{{ autoRegistering ? 'Anmeldung läuft...' : 'Automatisch anmelden' }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="tabs">
|
||||
<button :class="['tab', activeTab==='competitions' ? 'active' : '']" @click="activeTab='competitions'" :title="$t('officialTournaments.showCompetitions')">{{ $t('officialTournaments.competitions') }}</button>
|
||||
@@ -444,6 +447,7 @@ export default {
|
||||
participationRange: 'all',
|
||||
editingTournamentId: null,
|
||||
editingTitle: '',
|
||||
autoRegistering: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -564,6 +568,11 @@ export default {
|
||||
}
|
||||
groups.sort((a, b) => this.collator.compare(a.memberName, b.memberName));
|
||||
return groups;
|
||||
},
|
||||
pendingAutoRegistrationCount() {
|
||||
return Object.values(this.participationMap || {}).filter((entry) =>
|
||||
entry?.wants && !entry?.registered && !entry?.participated
|
||||
).length;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -869,6 +878,31 @@ export default {
|
||||
await this.showInfo('Fehler', message, '', 'error');
|
||||
}
|
||||
},
|
||||
async autoRegisterParticipants() {
|
||||
if (!this.uploadedId || !this.pendingAutoRegistrationCount || this.autoRegistering) return;
|
||||
this.autoRegistering = true;
|
||||
try {
|
||||
const response = await apiClient.post(
|
||||
`/official-tournaments/${this.currentClub}/${this.uploadedId}/auto-register`
|
||||
);
|
||||
await this.reload();
|
||||
await this.showInfo(
|
||||
'Erfolg',
|
||||
response?.data?.message || 'Die gewünschten Teilnehmer wurden automatisch in click-TT angemeldet.',
|
||||
'',
|
||||
'success'
|
||||
);
|
||||
} catch (error) {
|
||||
await this.showInfo(
|
||||
'Fehler',
|
||||
getSafeMessage(error) || 'Die automatische click-TT-Anmeldung ist fehlgeschlagen.',
|
||||
getSafeErrorMessage(error),
|
||||
'error'
|
||||
);
|
||||
} finally {
|
||||
this.autoRegistering = false;
|
||||
}
|
||||
},
|
||||
async reload() {
|
||||
if (!this.uploadedId) return;
|
||||
const t = await apiClient.get(`/official-tournaments/${this.currentClub}/${this.uploadedId}`);
|
||||
@@ -1534,4 +1568,3 @@ th, td { border-bottom: 1px solid var(--border-color); padding: 0.5rem; text-ali
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user