Invallers

This commit is contained in:
2025-09-23 20:47:11 +02:00
parent 6a9ea43e23
commit 181aebf16a
6 changed files with 62 additions and 21 deletions

View File

@@ -25,16 +25,8 @@
<mat-icon>settings</mat-icon>
&nbsp;Beheer
</ng-template>
<mat-tab-group animationDuration="0ms" disableRipple="true">
<mat-tab>
<ng-template mat-tab-label>
<mat-icon>group</mat-icon>
&nbsp;Spelerslijst
</ng-template>
<app-tournament-players [tournament]="tournament"></app-tournament-players>
</mat-tab>
</mat-tab-group>
</mat-tab>
}
@if (tournament.status == 'DIVIDED') {
@@ -117,16 +109,8 @@
<mat-icon>settings</mat-icon>
&nbsp;Beheer
</ng-template>
<mat-tab-group animationDuration="0ms" disableRipple="true">
<mat-tab>
<ng-template mat-tab-label>
<mat-icon>group</mat-icon>
&nbsp;Spelerslijst
</ng-template>
<app-tournament-players [tournament]="tournament"></app-tournament-players>
</mat-tab>
</mat-tab-group>
</mat-tab>
}
@if (tournament.status == 'ONGOING') {
@@ -270,7 +254,20 @@
<tbody>
@for (match of round.matches; track match.id) {
<tr>
<td class="align-middle w-team">{{ match.team1 | teamText }}</td>
<td class="align-middle w-team">
@if (playerHasSubstituteForEvent(match.team1.player1, event)) {
<span class="has-substitute" matTooltip="Valt in voor {{ match.team1.player1 | fullName }}" matTooltipPosition="below">
{{ getSubstituteForEvent(match.team1.player1, event) }}
</span>
} @else {
{{ match.team1.player1 | fullName }}
}
@if (event.doublesEvent && match.team1.player2 != null) {
<span [ngClass]="playerHasSubstituteForEvent(match.team1.player2, event) ? 'has-substitute' : ''">
/ {{ match.team1.player2 | fullName }}
</span>
}
</td>
<td class="align-middle w-sep">-</td>
<td class="align-middle w-team">{{ match.team2 | teamText }}</td>
<td class="align-middle w-fill"></td>

View File

@@ -35,7 +35,11 @@ td.w-fill {
width: 95% !important;
}
.mat-menu-panel {
z-index: 1000 !important;
}
.has-substitute {
text-decoration-line: underline;
text-decoration-style: dotted;
}

View File

@@ -26,13 +26,14 @@ import {MatDialog} from "@angular/material/dialog";
import {MatchResultPipe} from "../../pipes/match-result-pipe";
import {Event} from "../../model/event";
import {TournamentValidateComponent} from "../tournament-validate/tournament-validate.component";
import {Strength} from "../../model/player";
import {Player, Strength} from "../../model/player";
import {MatSnackBar} from "@angular/material/snack-bar";
import {CourtSelectionComponent} from "../court-selection/court-selection.component";
import {Standings} from "../../model/standings";
import {HeaderService} from "../../service/header.service";
import {TournamentPlayersComponent} from "../tournament-players/tournament-players.component";
import {TournamentPlayer} from "../../model/tournamentPlayer";
import {MatTooltip} from "@angular/material/tooltip";
@Component({
selector: 'app-tournament-manage',
@@ -62,6 +63,7 @@ import {TournamentPlayer} from "../../model/tournamentPlayer";
TournamentValidateComponent,
TournamentPlayersComponent,
MatExpansionPanelActionRow,
MatTooltip,
],
providers: [
FullNamePipe,
@@ -412,6 +414,35 @@ export class TournamentManageComponent implements OnInit, OnDestroy {
}
return count;
}
playerHasSubstituteForEvent(player: Player, event: Event) : boolean {
return this.getSubstituteForEvent(player, event) != undefined;
}
getSubstituteForEvent(player: Player, event: Event) : string | undefined {
var tournamentPlayer = this.getTournamentPlayerFromPlayer(player);
if (tournamentPlayer === null) return undefined;
if (tournamentPlayer.name == 'Inge Brehler') console.log(tournamentPlayer.name);
for (let substitution of tournamentPlayer.substitutions) {
if (substitution.event == event.type) {
var substitute = this.tournament.tournamentPlayers.find(p => p.id == substitution.substitute);
return substitute?.name;
}
}
return undefined;
}
getTournamentPlayerFromPlayer(player: Player) : TournamentPlayer | null {
for (let tournamentPlayer of this.tournament.tournamentPlayers) {
if (tournamentPlayer.playerId == player.id) {
return tournamentPlayer;
}
}
return null;
}
}
class ActiveMatch {

View File

@@ -68,6 +68,7 @@
<th>Naam</th>
<th>Wedstrijden geteld</th>
<th>Onderdelen</th>
<th>Invallers</th>
<th></th>
</tr>
</thead>
@@ -81,6 +82,7 @@
{{ event }}&nbsp;
}
</td>
<td>{{ hasSubstitutes(tournamentPlayer) ? 'Ja' : 'Nee' }}</td>
<td>
<button mat-icon-button [matMenuTriggerFor]="dividedTournamentMenu" class="menu-button">
<mat-icon>more_vert</mat-icon>

View File

@@ -1,3 +1,7 @@
td, th {
background-color: transparent !important;
}
td {
vertical-align: middle;
}

View File

@@ -90,4 +90,7 @@ export class TournamentPlayersComponent implements OnInit {
}
hasSubstitutes(tournamentPlayer: TournamentPlayer) {
return tournamentPlayer.substitutions.filter(s => s.substitute != null && s.substitute >= 0).length > 0;
}
}