Compare commits

..

2 Commits

Author SHA1 Message Date
af96ecda32 Removed *ngIf
All checks were successful
Gitea/swiss-client/pipeline/head This commit looks good
2025-08-11 22:50:33 +02:00
f20d9dfc92 Added tournament active/inactive option 2025-08-11 22:50:09 +02:00
11 changed files with 263 additions and 183 deletions

View File

@@ -14,37 +14,43 @@
</mat-checkbox> </mat-checkbox>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<ng-container *ngIf="eventRegistration.doublesEvent"> @if (eventRegistration.doublesEvent) {
<mat-form-field appearance="fill"> <ng-container>
<mat-label>Partner</mat-label> <mat-form-field appearance="fill">
<mat-select [value]="eventRegistration.partner" [disabled]="!tournamentRegistration.editable || !eventRegistration.registered" [(ngModel)]="eventRegistration.partner"> <mat-label>Partner</mat-label>
<mat-option>Geen</mat-option> <mat-select [value]="eventRegistration.partner" [disabled]="!tournamentRegistration.editable || !eventRegistration.registered" [(ngModel)]="eventRegistration.partner">
<mat-option *ngFor="let player of getRelevantPlayers(eventRegistration.type)" [value]="player.id"> <mat-option>Geen</mat-option>
{{ player | fullName }} <mat-option *ngFor="let player of getRelevantPlayers(eventRegistration.type)" [value]="player.id">
</mat-option> {{ player | fullName }}
</mat-select> </mat-option>
</mat-form-field> </mat-select>
</ng-container> </mat-form-field>
</ng-container>
}
</div> </div>
<div class="col-6"></div> <div class="col-6"></div>
</div> </div>
</ng-container> </ng-container>
</mat-card-content> </mat-card-content>
<mat-card-actions *ngIf="tournamentRegistration.editable"> @if (tournamentRegistration.editable) {
<button mat-button (click)="saveRegistration(tournamentRegistration, $event)" [disabled]="waitingForBackend"> <mat-card-actions>
<mat-icon>save</mat-icon> <button mat-button (click)="saveRegistration(tournamentRegistration, $event)" [disabled]="waitingForBackend">
Opslaan <mat-icon>save</mat-icon>
</button> Opslaan
<a mat-button routerLink="/players"> </button>
<mat-icon>cancel</mat-icon> <a mat-button routerLink="/players">
Annuleren <mat-icon>cancel</mat-icon>
</a> Annuleren
</mat-card-actions> </a>
</mat-card-actions>
}
</mat-card> </mat-card>
<button mat-button (click)="this.showAll = true" *ngIf="!this.showAll"> @if (!this.showAll) {
<mat-icon>search</mat-icon> <button mat-button (click)="this.showAll = true">
Toon oude toernooien <mat-icon>search</mat-icon>
</button> Toon oude toernooien
</button>
}
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
} }

View File

@@ -1,45 +1,51 @@
<mat-card appearance="outlined" *ngIf="tournament"> @if (tournament) {
<mat-card-header> <mat-card appearance="outlined">
<h5>Indeling voor {{ tournament.name }}</h5> <mat-card-header>
</mat-card-header> <h5>Indeling voor {{ tournament.name }}</h5>
<mat-card-content> </mat-card-header>
<mat-card *ngFor="let event of tournament.events" appearance="outlined" class="m-3"> <mat-card-content>
<mat-card-header> <mat-card *ngFor="let event of tournament.events" appearance="outlined" class="m-3">
<h6>Indeling {{ TournamentEvent.getType(event.type) }}</h6> <mat-card-header>
</mat-card-header> <h6>Indeling {{ TournamentEvent.getType(event.type) }}</h6>
<mat-card-content> </mat-card-header>
<mat-accordion multi="true"> <mat-card-content>
<mat-expansion-panel *ngFor="let group of event.groups"> <mat-accordion multi="true">
<mat-expansion-panel-header> <mat-expansion-panel *ngFor="let group of event.groups">
<mat-panel-title> <mat-expansion-panel-header>
{{ group.name }}&nbsp;<span class="badge text-bg-success">{{ group.teams.length }}</span> <mat-panel-title>
</mat-panel-title> {{ group.name }}&nbsp;<span class="badge text-bg-success">{{ group.teams.length }}</span>
</mat-expansion-panel-header> </mat-panel-title>
<table class="table {{ event.doublesEvent ? 'w-100' : 'w-50' }}"> </mat-expansion-panel-header>
<thead class="thead-dark"> <table class="table {{ event.doublesEvent ? 'w-100' : 'w-50' }}">
<tr> <thead class="thead-dark">
<th scope="col" class="w-20">Naam</th> <tr>
<th scope="col" class="w-20">Club</th> <th scope="col" class="w-20">Naam</th>
<th scope="col" class="w-10">Speelsterkte</th> <th scope="col" class="w-20">Club</th>
<th *ngIf="event.doublesEvent" scope="col" class="w-20">Partner</th> <th scope="col" class="w-10">Speelsterkte</th>
<th *ngIf="event.doublesEvent" scope="col" class="w-20">Club</th> @if (event.doublesEvent) {
<th *ngIf="event.doublesEvent" scope="col" class="w-10">Speelsterkte</th> <th scope="col" class="w-20">Partner</th>
</tr> <th scope="col" class="w-20">Club</th>
</thead> <th scope="col" class="w-10">Speelsterkte</th>
<tbody> }
<tr *ngFor="let team of group.teams"> </tr>
<td class="align-middle">{{ team.player1 | fullName }}</td> </thead>
<td class="align-middle">{{ team.player1.club }}</td> <tbody>
<td class="align-middle">{{ getStrength(team.player1.strength.valueOf()) }}</td> <tr *ngFor="let team of group.teams">
<td *ngIf="event.doublesEvent" class="align-middle">{{ team.player2 | fullName }}</td> <td class="align-middle">{{ team.player1 | fullName }}</td>
<td *ngIf="event.doublesEvent" class="align-middle">{{ team.player2.club }}</td> <td class="align-middle">{{ team.player1.club }}</td>
<td *ngIf="event.doublesEvent" class="align-middle">{{ getStrength(team.player2.strength.valueOf()) }}</td> <td class="align-middle">{{ getStrength(team.player1.strength.valueOf()) }}</td>
</tr> @if (event.doublesEvent) {
</tbody> <td class="align-middle">{{ team.player2 | fullName }}</td>
</table> <td class="align-middle">{{ team.player2.club }}</td>
</mat-expansion-panel> <td class="align-middle">{{ getStrength(team.player2.strength.valueOf()) }}</td>
</mat-accordion> }
</mat-card-content> </tr>
</mat-card> </tbody>
</mat-card-content> </table>
</mat-card> </mat-expansion-panel>
</mat-accordion>
</mat-card-content>
</mat-card>
</mat-card-content>
</mat-card>
}

View File

@@ -1,40 +1,41 @@
<mat-card appearance="outlined" *ngIf="tournament"> @if (tournament) {
<mat-card-header> <mat-card appearance="outlined">
<h5>Loting voor {{ tournament.name }}</h5> <mat-card-header>
</mat-card-header> <h5>Loting voor {{ tournament.name }}</h5>
<mat-card-content> </mat-card-header>
<mat-card *ngFor="let event of tournament.events" appearance="outlined" class="m-3"> <mat-card-content>
<mat-card-header> <mat-card *ngFor="let event of tournament.events" appearance="outlined" class="m-3">
<h6>Loting {{ TournamentEvent.getType(event.type) }}</h6> <mat-card-header>
</mat-card-header> <h6>Loting {{ TournamentEvent.getType(event.type) }}</h6>
<mat-card-content> </mat-card-header>
<mat-accordion multi="true"> <mat-card-content>
<mat-expansion-panel *ngFor="let group of event.groups"> <mat-accordion multi="true">
<mat-expansion-panel-header> <mat-expansion-panel *ngFor="let group of event.groups">
<mat-panel-title> <mat-expansion-panel-header>
{{ group.name }}&nbsp;<span class="badge text-bg-success">{{ group.teams.length }}</span> <mat-panel-title>
</mat-panel-title> {{ group.name }}&nbsp;<span class="badge text-bg-success">{{ group.teams.length }}</span>
</mat-expansion-panel-header> </mat-panel-title>
<table class="table {{ event.doublesEvent ? 'w-100' : 'w-50' }}"> </mat-expansion-panel-header>
<thead class="thead-dark"> <table class="table {{ event.doublesEvent ? 'w-100' : 'w-50' }}">
<tr> <thead class="thead-dark">
<th scope="col" class="w-25">Team 1</th> <tr>
<th scope="col" style="width: 5%">-</th> <th scope="col" class="w-25">Team 1</th>
<th scope="col" class="w-25">Team 2</th> <th scope="col" style="width: 5%">-</th>
</tr> <th scope="col" class="w-25">Team 2</th>
</thead> </tr>
<tbody> </thead>
<tr *ngFor="let match of group.rounds[0].matches"> <tbody>
<td class="align-middle">{{ match.team1 | teamText }}</td> <tr *ngFor="let match of group.rounds[0].matches">
<td class="align-middle">-</td> <td class="align-middle">{{ match.team1 | teamText }}</td>
<td class="align-middle">{{ match.team2 | teamText }}</td> <td class="align-middle">-</td>
</tr> <td class="align-middle">{{ match.team2 | teamText }}</td>
</tbody> </tr>
</table> </tbody>
</mat-expansion-panel> </table>
</mat-accordion> </mat-expansion-panel>
</mat-card-content> </mat-accordion>
</mat-card> </mat-card-content>
</mat-card-content> </mat-card>
</mat-card> </mat-card-content>
</mat-card>
}

View File

@@ -26,6 +26,14 @@
</div> </div>
<div class="col-md-9"></div> <div class="col-md-9"></div>
</div> </div>
<div class="row">
<div class="col-md-3">
<mat-checkbox [(ngModel)]="tournament.active" name="active">
Actief
</mat-checkbox>
</div>
<div class="col-md-9"></div>
</div>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<label id="max-events-label">Max. aantal onderdelen per inschrijving</label> <label id="max-events-label">Max. aantal onderdelen per inschrijving</label>

View File

@@ -14,6 +14,7 @@ import nl from "@angular/common/locales/nl";
import {TitleService} from "../../service/title.service"; import {TitleService} from "../../service/title.service";
import {NgxMaskDirective} from "ngx-mask"; import {NgxMaskDirective} from "ngx-mask";
import {MatSnackBar} from "@angular/material/snack-bar"; import {MatSnackBar} from "@angular/material/snack-bar";
import {MatCheckbox} from "@angular/material/checkbox";
registerLocaleData(nl); registerLocaleData(nl);
@@ -34,7 +35,8 @@ registerLocaleData(nl);
MatRadioButton, MatRadioButton,
MatRadioGroup, MatRadioGroup,
MatHint, MatHint,
NgxMaskDirective NgxMaskDirective,
MatCheckbox
], ],
providers: [ providers: [
CurrencyPipe CurrencyPipe
@@ -92,4 +94,5 @@ export class TournamentEditComponent implements OnInit {
this.tournament.costsPerEvent[number] = Number(value); this.tournament.costsPerEvent[number] = Number(value);
} }
} }

View File

@@ -1,9 +1,4 @@
<mat-card appearance="outlined"> <mat-card appearance="outlined">
<!--
<mat-card-header>
<h5>Toernooien</h5>
</mat-card-header>
-->
<mat-card-content> <mat-card-content>
<table class="table table-hover"> <table class="table table-hover">
<thead class="thead-dark"> <thead class="thead-dark">
@@ -16,28 +11,68 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let tournament of tournaments"> @for (tournament of getActiveTournaments(); track tournament) {
<td class="align-middle">{{ tournament.id }}</td> <tr>
<td class="align-middle"><a [routerLink]="['/tournaments', tournament.id, 'manage']">{{ tournament.name }}</a></td> <td class="align-middle">{{ tournament.id }}</td>
<td class="align-middle">{{ tournament.date }}</td> <td class="align-middle"><a [routerLink]="['/tournaments', tournament.id, 'manage']">{{ tournament.name }}</a></td>
<td class="align-middle">{{ Tournament.getStatus(tournament) }}</td> <td class="align-middle">{{ tournament.date }}</td>
<td class="align-middle"> <td class="align-middle">{{ Tournament.getStatus(tournament) }}</td>
<a mat-button [routerLink]="['/tournaments', tournament.id, 'edit']" *ngIf="Tournament.getStatus(tournament) != 'Afgerond'"> <td class="align-middle">
<mat-icon>edit</mat-icon> @if (Tournament.getStatus(tournament) != 'Afgerond') {
Bewerk <a mat-button [routerLink]="['/tournaments', tournament.id, 'edit']">
</a> <mat-icon>edit</mat-icon>
<a mat-button [routerLink]="['/tournaments', tournament.id, 'registrations']"> Bewerk
<mat-icon>group</mat-icon> </a>
Inschrijvingen }
</a> <a mat-button [routerLink]="['/tournaments', tournament.id, 'registrations']">
<a mat-button (click)="clearDraw(tournament)" *ngIf="Tournament.getStatus(tournament) == 'Geloot'"> <mat-icon>group</mat-icon>
<mat-icon>safety_divider</mat-icon> Inschrijvingen
Loting wissen </a>
</a> @if (Tournament.getStatus(tournament) == 'Geloot') {
</td> <a mat-button (click)="clearDraw(tournament)">
</tr> <mat-icon>safety_divider</mat-icon>
Loting wissen
</a>
}
</td>
</tr>
}
@if (showInactive) {
@for (tournament of getInactiveTournaments(); track tournament) {
<tr>
<td class="align-middle">{{ tournament.id }}</td>
<td class="align-middle"><a [routerLink]="['/tournaments', tournament.id, 'manage']">{{ tournament.name }}</a></td>
<td class="align-middle">{{ tournament.date }}</td>
<td class="align-middle">{{ Tournament.getStatus(tournament) }}</td>
<td class="align-middle">
@if (Tournament.getStatus(tournament) != 'Afgerond') {
<a mat-button [routerLink]="['/tournaments', tournament.id, 'edit']">
<mat-icon>edit</mat-icon>
Bewerk
</a>
}
<a mat-button [routerLink]="['/tournaments', tournament.id, 'registrations']">
<mat-icon>group</mat-icon>
Inschrijvingen
</a>
@if (Tournament.getStatus(tournament) == 'Geloot') {
<a mat-button (click)="clearDraw(tournament)">
<mat-icon>safety_divider</mat-icon>
Loting wissen
</a>
}
</td>
</tr>
}
}
</tbody> </tbody>
</table> </table>
@if (!showInactive) {
<a mat-button (click)="showInactive = true">
<mat-icon>expand</mat-icon>
Toon inactief
</a>
}
<a mat-button routerLink="/tournaments/add"> <a mat-button routerLink="/tournaments/add">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
Nieuw toernooi Nieuw toernooi

View File

@@ -20,6 +20,7 @@ import {TitleService} from "../../service/title.service";
export class TournamentListComponent implements OnInit, AfterContentChecked { export class TournamentListComponent implements OnInit, AfterContentChecked {
tournaments: Tournament[]; tournaments: Tournament[];
showInactive: boolean = false;
constructor( constructor(
private tournamentService: TournamentService, private tournamentService: TournamentService,
@@ -46,4 +47,14 @@ export class TournamentListComponent implements OnInit, AfterContentChecked {
}) })
} }
getActiveTournaments(): Tournament[] {
if (!this.tournaments) return [];
return this.tournaments.filter(tournament => tournament.active);
}
getInactiveTournaments(): Tournament[] {
if (!this.tournaments) return [];
return this.tournaments.filter(tournament => !tournament.active);
}
} }

View File

@@ -71,9 +71,11 @@
<th scope="col" class="w-20">Naam</th> <th scope="col" class="w-20">Naam</th>
<th scope="col" class="w-20">Club</th> <th scope="col" class="w-20">Club</th>
<th scope="col" class="w-10">Speelsterkte</th> <th scope="col" class="w-10">Speelsterkte</th>
<th *ngIf="event.doublesEvent" scope="col" class="w-20">Partner</th> @if (event.doublesEvent) {
<th *ngIf="event.doublesEvent" scope="col" class="w-20">Club</th> <th scope="col" class="w-20">Partner</th>
<th *ngIf="event.doublesEvent" scope="col" class="w-10">Speelsterkte</th> <th scope="col" class="w-20">Club</th>
<th scope="col" class="w-10">Speelsterkte</th>
}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -81,9 +83,11 @@
<td class="align-middle">{{ team.player1 | fullName }}</td> <td class="align-middle">{{ team.player1 | fullName }}</td>
<td class="align-middle">{{ team.player1.club }}</td> <td class="align-middle">{{ team.player1.club }}</td>
<td class="align-middle">{{ getStrength(team.player1.strength.valueOf()) }}</td> <td class="align-middle">{{ getStrength(team.player1.strength.valueOf()) }}</td>
<td *ngIf="event.doublesEvent" class="align-middle">{{ team.player2 | fullName }}</td> @if (event.doublesEvent) {
<td *ngIf="event.doublesEvent" class="align-middle">{{ team.player2?.club }}</td> <td class="align-middle">{{ team.player2 | fullName }}</td>
<td *ngIf="event.doublesEvent" class="align-middle">{{ getStrength(team.player2?.strength?.valueOf()) }}</td> <td class="align-middle">{{ team.player2?.club }}</td>
<td class="align-middle">{{ getStrength(team.player2?.strength?.valueOf()) }}</td>
}
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@@ -1,32 +1,38 @@
<mat-card appearance="outlined" *ngIf="tournament"> @if (tournament) {
<mat-card-header> <mat-card appearance="outlined">
<h5>Inschrijvingen voor {{ tournament.name }}</h5> <mat-card-header>
</mat-card-header> <h5>Inschrijvingen voor {{ tournament.name }}</h5>
<mat-card-content> </mat-card-header>
<mat-card *ngFor="let event of tournament.events" appearance="outlined" class="m-3"> <mat-card-content>
<mat-card-header> <mat-card *ngFor="let event of tournament.events" appearance="outlined" class="m-3">
<h6>{{ TournamentEvent.getType(event.type) }} ({{ event.registrations.length}} inschrijvingen)</h6> <mat-card-header>
</mat-card-header> <h6>{{ TournamentEvent.getType(event.type) }} ({{ event.registrations.length}} inschrijvingen)</h6>
<mat-card-content> </mat-card-header>
<table class="table {{ event.doublesEvent ? 'w-100' : 'w-50' }}"> <mat-card-content>
<thead class="thead-dark"> <table class="table {{ event.doublesEvent ? 'w-100' : 'w-50' }}">
<tr> <thead class="thead-dark">
<th scope="col" class="w-25">Naam</th> <tr>
<th scope="col" class="w-25">Club</th> <th scope="col" class="w-25">Naam</th>
<th *ngIf="event.doublesEvent" scope="col" class="w-25">Partner</th> <th scope="col" class="w-25">Club</th>
<th *ngIf="event.doublesEvent" scope="col" class="w-25">Club</th> @if (event.doublesEvent) {
</tr> <th scope="col" class="w-25">Partner</th>
</thead> <th scope="col" class="w-25">Club</th>
<tbody> }
<tr *ngFor="let registration of event.registrations"> </tr>
<td class="align-middle">{{ registration.player | fullName }}</td> </thead>
<td class="align-middle">{{ registration.player.club }}</td> <tbody>
<td *ngIf="event.doublesEvent" class="align-middle">{{ registration.partner | fullName }}</td> <tr *ngFor="let registration of event.registrations">
<td *ngIf="event.doublesEvent" class="align-middle">{{ registration.partner?.club }}</td> <td class="align-middle">{{ registration.player | fullName }}</td>
</tr> <td class="align-middle">{{ registration.player.club }}</td>
</tbody> @if (event.doublesEvent) {
</table> <td class="align-middle">{{ registration.partner?.club }}</td>
</mat-card-content> <td class="align-middle">{{ registration.partner | fullName }}</td>
</mat-card> }
</mat-card-content> </tr>
</mat-card> </tbody>
</table>
</mat-card-content>
</mat-card>
</mat-card-content>
</mat-card>
}

View File

@@ -36,16 +36,20 @@
<tr> <tr>
<th scope="col" class="w-25">Naam</th> <th scope="col" class="w-25">Naam</th>
<th scope="col" class="w-25">Club</th> <th scope="col" class="w-25">Club</th>
<th *ngIf="event.doublesEvent" scope="col" class="w-25">Partner</th> @if (event.doublesEvent) {
<th *ngIf="event.doublesEvent" scope="col" class="w-25">Club</th> <th scope="col" class="w-25">Partner</th>
<th scope="col" class="w-25">Club</th>
}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let registration of event.registrations"> <tr *ngFor="let registration of event.registrations">
<td class="align-middle">{{ registration.player | fullName }}</td> <td class="align-middle">{{ registration.player | fullName }}</td>
<td class="align-middle">{{ registration.player.club }}</td> <td class="align-middle">{{ registration.player.club }}</td>
<td *ngIf="event.doublesEvent" class="align-middle">{{ registration.partner | fullName }}</td> @if (event.doublesEvent) {
<td *ngIf="event.doublesEvent" class="align-middle">{{ registration.partner?.club }}</td> <td class="align-middle">{{ registration.partner | fullName }}</td>
<td class="align-middle">{{ registration.partner?.club }}</td>
}
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -60,11 +64,6 @@
<li *ngFor="let validation of getEventValidation(event.id)?.validations"> <li *ngFor="let validation of getEventValidation(event.id)?.validations">
<mat-icon class="text-{{ getColorForSeverity(validation.severity) }}">{{ getIconForSeverity(validation.severity) }}</mat-icon> <mat-icon class="text-{{ getColorForSeverity(validation.severity) }}">{{ getIconForSeverity(validation.severity) }}</mat-icon>
<player-link [validationMessage]="validation.message"></player-link> <player-link [validationMessage]="validation.message"></player-link>
<!--
<div *ngIf="validation.message">
<app-player-link [validationMessage]="'validation.message'"></app-player-link>
</div>
-->
</li> </li>
</ul> </ul>
</mat-expansion-panel> </mat-expansion-panel>

View File

@@ -11,6 +11,7 @@ export class Tournament {
maxEvents: number; maxEvents: number;
costsPerEvent: number[] = [0, 0, 0]; costsPerEvent: number[] = [0, 0, 0];
courts: number; courts: number;
active: boolean;
static getStatus(tournament: Tournament): string { static getStatus(tournament: Tournament): string {
if (tournament.status == "CLOSED") return "Afgerond"; if (tournament.status == "CLOSED") return "Afgerond";