Enhance official tournament listing and upload functionality

This commit updates the `listOfficialTournaments` function to ensure it returns an empty array if no tournaments are found, improving data handling. Additionally, the frontend `OfficialTournaments.vue` is enhanced with a file upload feature for PDF documents, along with improved error handling in the tournament list loading process. These changes enhance user experience by providing clearer feedback and functionality for managing official tournaments.
This commit is contained in:
Torsten Schulz (local)
2025-11-15 21:25:03 +01:00
parent 54ce09e9a9
commit f1321b18bb
4 changed files with 209 additions and 9 deletions

View File

@@ -1,7 +1,13 @@
<template>
<div class="official-tournaments">
<h2>Turnierteilnahmen</h2>
<div v-if="list && list.length" class="list">
<div class="uploader">
<input type="file" accept="application/pdf" @change="onFile" />
<button class="btn-primary" :disabled="!selectedFile" @click="upload">PDF hochladen</button>
</div>
<div v-if="list && list.length > 0" class="list">
<div class="tabs">
<button :class="['tab', topActiveTab==='events' ? 'active' : '']" @click="switchTopTab('events')" title="Gespeicherte Veranstaltungen anzeigen">Veranstaltungen</button>
<button :class="['tab', topActiveTab==='participations' ? 'active' : '']" @click="switchTopTab('participations')" title="Turnierbeteiligungen anzeigen">Turnierbeteiligungen</button>
@@ -17,11 +23,13 @@
<button class="btn-secondary" @click.prevent="removeTournament(t)" title="Löschen">🗑</button>
</li>
</ul>
<div class="uploader">
<input type="file" accept="application/pdf" @change="onFile" />
<button class="btn-primary" :disabled="!selectedFile" @click="upload">PDF hochladen</button>
</div>
</div>
<div v-if="!list || list.length === 0" class="empty-state">
<p>Noch keine Veranstaltungen vorhanden. Laden Sie ein PDF hoch, um zu beginnen.</p>
</div>
<div v-if="parsed">
<div class="meta">
<div><strong>Titel:</strong> {{ parsed.parsedData.title || '' }}</div>
@@ -913,8 +921,14 @@ export default {
this.members = m.data;
},
async loadList() {
const r = await apiClient.get(`/official-tournaments/${this.currentClub}`);
this.list = r.data;
try {
const r = await apiClient.get(`/official-tournaments/${this.currentClub}`);
this.list = Array.isArray(r.data) ? r.data : [];
} catch (error) {
console.error('[loadList] Error:', error);
this.list = [];
// Fehler wird nicht angezeigt, damit die Seite trotzdem funktioniert
}
},
buildParticipationMap(entries) {
const map = {};