First steps for tournament
This commit is contained in:
@@ -82,15 +82,16 @@
|
||||
<th> </th>
|
||||
<th>Begegnung</th>
|
||||
<th>Sätze</th>
|
||||
<th>Ergebnis</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="match in matches" :key="match.id">
|
||||
<td>{{ match.groupId ? "Gr " + match.groupId : match.round }}</td>
|
||||
<td>{{ getPlayerName(match.player1) }} - {{ getPlayerName(match.player2) }}</td>
|
||||
<td><input size="5" type="text" v-model="match.result" @keyup.enter="saveMatchResult(match, match.result)" /></td>
|
||||
<td></td>
|
||||
<td v-for="result in match.tournamentResults">{{ result.pointsPlayer1 }}:{{ result.pointsPlayer2 }}</td>
|
||||
<td><input size="5" type="text" v-model="match.result" @keyup.enter="saveMatchResult(match, match.tournamentResults.length + 1, match.result)" /></td>
|
||||
<td v-if="match.isFinished">{{ match.result ?? '0:0' }}</td>
|
||||
<td v-else><button @click="finishMatch(match)">Abschließen</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -249,19 +250,32 @@ export default {
|
||||
getPlayerName(player) {
|
||||
return player.member.firstName + ' ' + player.member.lastName;
|
||||
},
|
||||
async saveMatchResult(match, result) {
|
||||
async saveMatchResult(match, set, result) {
|
||||
try {
|
||||
await apiClient.post('/tournament/match/result', {
|
||||
clubId: this.currentClub,
|
||||
tournamentId: this.selectedDate,
|
||||
matchId: match.matchId,
|
||||
matchId: match.id,
|
||||
set,
|
||||
result: result,
|
||||
});
|
||||
match.result = result; // Aktualisiere das Match in der UI
|
||||
this.fetchGroups();
|
||||
} catch (error) {
|
||||
console.error('Error saving match result:', error);
|
||||
}
|
||||
}
|
||||
},
|
||||
async finishMatch(match) {
|
||||
try {
|
||||
await apiClient.post('/tournament/match/finish', {
|
||||
clubId: this.currentClub,
|
||||
tournamentId: this.selectedDate,
|
||||
matchId: match.id,
|
||||
});
|
||||
this.fetchGroups();
|
||||
} catch (error) {
|
||||
console.error('Error finishing match:', error);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user