Invallers
All checks were successful
Gitea/swiss-client/pipeline/head This commit looks good

This commit is contained in:
2025-09-11 23:43:28 +02:00
parent 929fd6b581
commit 5c846a6351
6 changed files with 146 additions and 100 deletions

View File

@@ -1,10 +1,14 @@
<h2 mat-dialog-title>Kies een invaller voor {{ data.player.name }}:</h2>
<mat-dialog-content> <mat-dialog-content>
<h3>Kies een invaller voor {{ data.player.name }}:</h3> @for (substitution of data.player.substitutions; track $index) {
<div class="row mt-3">
<div class="col-md-3">
<h5>{{ Event.getType(substitution.event) }}</h5>
</div>
<div class="col-md-6"> <div class="col-md-6">
<mat-form-field appearance="fill"> <mat-form-field appearance="fill">
<mat-label>Invaller</mat-label> <mat-label>Invaller</mat-label>
<mat-select [(ngModel)]="substitute"> <mat-select [(ngModel)]="substitution.substitute">
<mat-option>Geen</mat-option> <mat-option>Geen</mat-option>
@for (player of data.availablePlayers; track player.playerId) { @for (player of data.availablePlayers; track player.playerId) {
<mat-option [value]="player"> <mat-option [value]="player">
@@ -14,10 +18,12 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
</div>
}
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions>
@if (substitute) { <!-- @if (substitute) {-->
<button mat-button [mat-dialog-close]="{substitute: substitute}">Invaller selecteren</button> <button mat-button [mat-dialog-close]="{substitutions: data.player.substitutions}">Opslaan</button>
} <!-- }-->
<button mat-button (click)="onAnnulerenClick()">Annuleren</button> <button mat-button (click)="onAnnulerenClick()">Annuleren</button>
</mat-dialog-actions> </mat-dialog-actions>

View File

@@ -5,33 +5,35 @@ import {
MatDialogActions, MatDialogActions,
MatDialogClose, MatDialogClose,
MatDialogContent, MatDialogContent,
MatDialogRef MatDialogRef, MatDialogTitle
} from "@angular/material/dialog"; } from "@angular/material/dialog";
import {MatFormField} from "@angular/material/form-field"; import {MatFormField} from "@angular/material/form-field";
import {MatLabel} from "@angular/material/form-field"; import {MatLabel} from "@angular/material/form-field";
import {MatOption, MatSelect} from "@angular/material/select"; import {MatOption, MatSelect} from "@angular/material/select";
import {TournamentPlayer} from "../../model/tournamentPlayer"; import {TournamentPlayer} from "../../model/tournamentPlayer";
import {FormsModule} from "@angular/forms"; import {FormsModule} from "@angular/forms";
import {Event} from "../../model/event";
@Component({ @Component({
selector: 'app-substitute-selection', selector: 'app-substitute-selection',
imports: [ imports: [
MatButton, MatButton,
MatDialogActions, MatDialogActions,
MatDialogTitle,
MatDialogContent, MatDialogContent,
MatFormField, MatFormField,
MatLabel, MatLabel,
MatOption, MatOption,
MatSelect, MatSelect,
FormsModule, FormsModule,
MatDialogClose MatDialogClose,
], ],
templateUrl: './substitute-selection.component.html', templateUrl: './substitute-selection.component.html',
styleUrl: './substitute-selection.component.scss' styleUrl: './substitute-selection.component.scss'
}) })
export class SubstituteSelectionComponent { export class SubstituteSelectionComponent {
substitute: TournamentPlayer; substitute: TournamentPlayer[];
readonly dialogRef = inject(MatDialogRef<SubstituteSelectionComponent>); readonly dialogRef = inject(MatDialogRef<SubstituteSelectionComponent>);
@@ -43,4 +45,6 @@ export class SubstituteSelectionComponent {
onAnnulerenClick() { onAnnulerenClick() {
this.dialogRef.close(); this.dialogRef.close();
} }
protected readonly Event = Event;
} }

View File

@@ -445,16 +445,8 @@
<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">
<mat-tab>
<ng-template mat-tab-label>
<mat-icon>group</mat-icon>
&nbsp;Spelerslijst
</ng-template>
<app-tournament-players [tournament]="tournament"></app-tournament-players> <app-tournament-players [tournament]="tournament"></app-tournament-players>
</mat-tab> </mat-tab>
</mat-tab-group>
</mat-tab>
} }
</mat-tab-group> </mat-tab-group>
</mat-card-content> </mat-card-content>

View File

@@ -1,17 +1,20 @@
@if (tournament) { @if (tournament) {
<mat-tab-group animationDuration="0ms" disableRipple="true">
<mat-tab>
<ng-template mat-tab-label>
<mat-icon>euro</mat-icon>
&nbsp;Administratie
</ng-template>
<table class="table table-hover w-75 m-4"> <table class="table table-hover w-75 m-4">
<thead> <thead>
<tr> <tr>
<th>Naam</th> <th>Naam</th>
@if (tournament.status == 'ONGOING') {
<th>Wedstrijden geteld</th>
}
<th>Onderdelen</th> <th>Onderdelen</th>
<th>Kosten</th> <th>Kosten</th>
<th>Betaald</th> <th>Betaald</th>
@if (tournament.status == 'ONGOING') { @if (tournament.status == 'ONGOING') {
<th>Aanwezig</th> <th>Aanwezig</th>
<th></th>
} }
</tr> </tr>
</thead> </thead>
@@ -19,9 +22,6 @@
@for (tournamentPlayer of tournament.tournamentPlayers; track tournamentPlayer.playerId) { @for (tournamentPlayer of tournament.tournamentPlayers; track tournamentPlayer.playerId) {
<tr> <tr>
<td>{{ tournamentPlayer.name }}</td> <td>{{ tournamentPlayer.name }}</td>
@if (tournament.status == 'ONGOING') {
<td>{{ tournamentPlayer.counts }}</td>
}
<td> <td>
@for (event of tournamentPlayer.events; track event) { @for (event of tournamentPlayer.events; track event) {
{{ event }}&nbsp; {{ event }}&nbsp;
@@ -49,6 +49,38 @@
} }
</mat-slide-toggle> </mat-slide-toggle>
</td> </td>
}
</tr>
}
</tbody>
</table>
</mat-tab>
@if (tournament.status == 'ONGOING') {
<mat-tab>
<ng-template mat-tab-label>
<mat-icon>group</mat-icon>
&nbsp;Tellers en invallers
</ng-template>
<table class="table table-hover w-75 m-4">
<thead>
<tr>
<th>Naam</th>
<th>Wedstrijden geteld</th>
<th>Onderdelen</th>
<th></th>
</tr>
</thead>
<tbody>
@for (tournamentPlayer of tournament.tournamentPlayers; track tournamentPlayer.playerId) {
<tr>
<td>{{ tournamentPlayer.name }}</td>
<td>{{ tournamentPlayer.counts }}</td>
<td>
@for (event of tournamentPlayer.events; track event) {
{{ event }}&nbsp;
}
</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>
@@ -63,11 +95,12 @@
Deelname stoppen Deelname stoppen
</button> </button>
</mat-menu> </mat-menu>
</td> </td>
}
</tr> </tr>
} }
</tbody> </tbody>
</table> </table>
</mat-tab>
}
</mat-tab-group>
} }

View File

@@ -13,6 +13,7 @@ import {CourtSelectionComponent} from "../court-selection/court-selection.compon
import {MatDialog} from "@angular/material/dialog"; import {MatDialog} from "@angular/material/dialog";
import {SubstituteSelectionComponent} from "../substitute-selection/substitute-selection.component"; import {SubstituteSelectionComponent} from "../substitute-selection/substitute-selection.component";
import {TournamentPlayer} from "../../model/tournamentPlayer"; import {TournamentPlayer} from "../../model/tournamentPlayer";
import {MatTab, MatTabGroup, MatTabLabel} from "@angular/material/tabs";
@Component({ @Component({
selector: 'app-tournament-players', selector: 'app-tournament-players',
@@ -24,7 +25,10 @@ import {TournamentPlayer} from "../../model/tournamentPlayer";
MatIconButton, MatIconButton,
MatMenu, MatMenu,
MatMenuItem, MatMenuItem,
MatMenuTrigger MatMenuTrigger,
MatTab,
MatTabGroup,
MatTabLabel
], ],
templateUrl: './tournament-players.component.html', templateUrl: './tournament-players.component.html',
standalone: true, standalone: true,
@@ -74,7 +78,7 @@ export class TournamentPlayersComponent implements OnInit {
}).afterClosed().subscribe(result => { }).afterClosed().subscribe(result => {
if (result != undefined) { if (result != undefined) {
console.log('Substitute selected for ' + player.name + ', namely: ' + result.substitute.name); console.log('Substitute selected for ' + player.name + ', namely: ' + result.substitute.name);
this.tournamentService.startMatch(this.tournament.id, match.id, result.court, result.counter.playerId).subscribe(data => { this.tournamentService.playerSubstitute(this.tournament.id, player.playerId, result.substitute.playerId).subscribe(data => {
this.tournament = data; this.tournament = data;
}); });
} }

View File

@@ -7,4 +7,11 @@ export class TournamentPlayer {
present: boolean; present: boolean;
counting: boolean; counting: boolean;
counts: number; counts: number;
substitutions: TournamentPlayerSubstitution[];
}
export class TournamentPlayerSubstitution {
substitutionId: number;
event: string;
substitute: TournamentPlayer;
} }