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,7 +14,8 @@
</mat-checkbox> </mat-checkbox>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<ng-container *ngIf="eventRegistration.doublesEvent"> @if (eventRegistration.doublesEvent) {
<ng-container>
<mat-form-field appearance="fill"> <mat-form-field appearance="fill">
<mat-label>Partner</mat-label> <mat-label>Partner</mat-label>
<mat-select [value]="eventRegistration.partner" [disabled]="!tournamentRegistration.editable || !eventRegistration.registered" [(ngModel)]="eventRegistration.partner"> <mat-select [value]="eventRegistration.partner" [disabled]="!tournamentRegistration.editable || !eventRegistration.registered" [(ngModel)]="eventRegistration.partner">
@@ -25,12 +26,14 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</ng-container> </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) {
<mat-card-actions>
<button mat-button (click)="saveRegistration(tournamentRegistration, $event)" [disabled]="waitingForBackend"> <button mat-button (click)="saveRegistration(tournamentRegistration, $event)" [disabled]="waitingForBackend">
<mat-icon>save</mat-icon> <mat-icon>save</mat-icon>
Opslaan Opslaan
@@ -40,11 +43,14 @@
Annuleren Annuleren
</a> </a>
</mat-card-actions> </mat-card-actions>
}
</mat-card> </mat-card>
<button mat-button (click)="this.showAll = true" *ngIf="!this.showAll"> @if (!this.showAll) {
<button mat-button (click)="this.showAll = true">
<mat-icon>search</mat-icon> <mat-icon>search</mat-icon>
Toon oude toernooien Toon oude toernooien
</button> </button>
}
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
} }

View File

@@ -1,4 +1,5 @@
<mat-card appearance="outlined" *ngIf="tournament"> @if (tournament) {
<mat-card appearance="outlined">
<mat-card-header> <mat-card-header>
<h5>Indeling voor {{ tournament.name }}</h5> <h5>Indeling voor {{ tournament.name }}</h5>
</mat-card-header> </mat-card-header>
@@ -21,9 +22,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>
@@ -31,9 +34,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>
@@ -43,3 +48,4 @@
</mat-card> </mat-card>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
}

View File

@@ -1,4 +1,5 @@
<mat-card appearance="outlined" *ngIf="tournament"> @if (tournament) {
<mat-card appearance="outlined">
<mat-card-header> <mat-card-header>
<h5>Loting voor {{ tournament.name }}</h5> <h5>Loting voor {{ tournament.name }}</h5>
</mat-card-header> </mat-card-header>
@@ -37,4 +38,4 @@
</mat-card> </mat-card>
</mat-card-content> </mat-card-content>
</mat-card> </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) {
<tr>
<td class="align-middle">{{ tournament.id }}</td> <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"><a [routerLink]="['/tournaments', tournament.id, 'manage']">{{ tournament.name }}</a></td>
<td class="align-middle">{{ tournament.date }}</td> <td class="align-middle">{{ tournament.date }}</td>
<td class="align-middle">{{ Tournament.getStatus(tournament) }}</td> <td class="align-middle">{{ Tournament.getStatus(tournament) }}</td>
<td class="align-middle"> <td class="align-middle">
<a mat-button [routerLink]="['/tournaments', tournament.id, 'edit']" *ngIf="Tournament.getStatus(tournament) != 'Afgerond'"> @if (Tournament.getStatus(tournament) != 'Afgerond') {
<a mat-button [routerLink]="['/tournaments', tournament.id, 'edit']">
<mat-icon>edit</mat-icon> <mat-icon>edit</mat-icon>
Bewerk Bewerk
</a> </a>
}
<a mat-button [routerLink]="['/tournaments', tournament.id, 'registrations']"> <a mat-button [routerLink]="['/tournaments', tournament.id, 'registrations']">
<mat-icon>group</mat-icon> <mat-icon>group</mat-icon>
Inschrijvingen Inschrijvingen
</a> </a>
<a mat-button (click)="clearDraw(tournament)" *ngIf="Tournament.getStatus(tournament) == 'Geloot'"> @if (Tournament.getStatus(tournament) == 'Geloot') {
<a mat-button (click)="clearDraw(tournament)">
<mat-icon>safety_divider</mat-icon> <mat-icon>safety_divider</mat-icon>
Loting wissen Loting wissen
</a> </a>
}
</td> </td>
</tr> </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,4 +1,5 @@
<mat-card appearance="outlined" *ngIf="tournament"> @if (tournament) {
<mat-card appearance="outlined">
<mat-card-header> <mat-card-header>
<h5>Inschrijvingen voor {{ tournament.name }}</h5> <h5>Inschrijvingen voor {{ tournament.name }}</h5>
</mat-card-header> </mat-card-header>
@@ -13,16 +14,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?.club }}</td>
<td class="align-middle">{{ registration.partner | fullName }}</td>
}
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -30,3 +35,4 @@
</mat-card> </mat-card>
</mat-card-content> </mat-card-content>
</mat-card> </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";