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,15 +25,7 @@
<mat-icon>settings</mat-icon> <mat-icon>settings</mat-icon>
&nbsp;Beheer &nbsp;Beheer
</ng-template> </ng-template>
<mat-tab-group animationDuration="0ms" disableRipple="true"> <app-tournament-players [tournament]="tournament"></app-tournament-players>
<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> </mat-tab>
} }
@@ -117,15 +109,7 @@
<mat-icon>settings</mat-icon> <mat-icon>settings</mat-icon>
&nbsp;Beheer &nbsp;Beheer
</ng-template> </ng-template>
<mat-tab-group animationDuration="0ms" disableRipple="true"> <app-tournament-players [tournament]="tournament"></app-tournament-players>
<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> </mat-tab>
} }
@@ -270,7 +254,20 @@
<tbody> <tbody>
@for (match of round.matches; track match.id) { @for (match of round.matches; track match.id) {
<tr> <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-sep">-</td>
<td class="align-middle w-team">{{ match.team2 | teamText }}</td> <td class="align-middle w-team">{{ match.team2 | teamText }}</td>
<td class="align-middle w-fill"></td> <td class="align-middle w-fill"></td>

View File

@@ -35,7 +35,11 @@ td.w-fill {
width: 95% !important; width: 95% !important;
} }
.mat-menu-panel { .mat-menu-panel {
z-index: 1000 !important; 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 {MatchResultPipe} from "../../pipes/match-result-pipe";
import {Event} from "../../model/event"; import {Event} from "../../model/event";
import {TournamentValidateComponent} from "../tournament-validate/tournament-validate.component"; 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 {MatSnackBar} from "@angular/material/snack-bar";
import {CourtSelectionComponent} from "../court-selection/court-selection.component"; import {CourtSelectionComponent} from "../court-selection/court-selection.component";
import {Standings} from "../../model/standings"; import {Standings} from "../../model/standings";
import {HeaderService} from "../../service/header.service"; import {HeaderService} from "../../service/header.service";
import {TournamentPlayersComponent} from "../tournament-players/tournament-players.component"; import {TournamentPlayersComponent} from "../tournament-players/tournament-players.component";
import {TournamentPlayer} from "../../model/tournamentPlayer"; import {TournamentPlayer} from "../../model/tournamentPlayer";
import {MatTooltip} from "@angular/material/tooltip";
@Component({ @Component({
selector: 'app-tournament-manage', selector: 'app-tournament-manage',
@@ -62,6 +63,7 @@ import {TournamentPlayer} from "../../model/tournamentPlayer";
TournamentValidateComponent, TournamentValidateComponent,
TournamentPlayersComponent, TournamentPlayersComponent,
MatExpansionPanelActionRow, MatExpansionPanelActionRow,
MatTooltip,
], ],
providers: [ providers: [
FullNamePipe, FullNamePipe,
@@ -412,6 +414,35 @@ export class TournamentManageComponent implements OnInit, OnDestroy {
} }
return count; 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 { class ActiveMatch {

View File

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

View File

@@ -1,3 +1,7 @@
td, th { td, th {
background-color: transparent !important; 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;
}
} }