From 5a5c13400295e036268d53c93e250a582165dc70 Mon Sep 17 00:00:00 2001 From: Michel ten Voorde Date: Mon, 18 Aug 2025 23:28:15 +0200 Subject: [PATCH] Added match counter --- src/app/app.routes.ts | 11 +- .../court-selection.component.html | 27 +- .../court-selection.component.scss | 4 + .../court-selection.component.ts | 35 +- .../player-list/player-list.component.html | 2 +- .../player-registrations.component.html | 24 +- .../tournament-divide.component.html | 57 - .../tournament-divide.component.scss | 3 - .../tournament-divide.component.ts | 58 - .../tournament-manage.component.html | 89 +- .../tournament-manage.component.scss | 8 + .../tournament-manage.component.ts | 73 +- .../tournament-players.component.html | 92 +- .../tournament-players.component.scss | 3 + .../tournament-players.component.ts | 5 - .../tournament-validate.component.html | 4 +- .../tournament-validate.component.ts | 20 + src/app/model/match.ts | 2 + src/app/model/tournamentPlayer.ts | 2 + src/app/pipes/team-pipe.ts | 2 - src/app/service/tournament.service.ts | 4 +- yarn.lock | 2029 ++--------------- 22 files changed, 484 insertions(+), 2070 deletions(-) delete mode 100644 src/app/components/tournament-divide/tournament-divide.component.html delete mode 100644 src/app/components/tournament-divide/tournament-divide.component.scss delete mode 100644 src/app/components/tournament-divide/tournament-divide.component.ts diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 098c864..343ffb0 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -1,12 +1,9 @@ -import { Routes } from '@angular/router'; -import { PlayerListComponent} from "./components/player-list/player-list.component"; +import {Routes} from '@angular/router'; +import {PlayerListComponent} from "./components/player-list/player-list.component"; import {PlayerEditComponent} from "./components/player-edit/player-edit.component"; import {TournamentListComponent} from "./components/tournament-list/tournament-list.component"; import {TournamentEditComponent} from "./components/tournament-edit/tournament-edit.component"; import {PlayerRegistrationsComponent} from "./components/player-registrations/player-registrations.component"; -import {TournamentRegistrationsComponent} from "./components/tournament-registrations/tournament-registrations.component"; -import {TournamentValidateComponent} from "./components/tournament-validate/tournament-validate.component"; -import {TournamentDivideComponent} from "./components/tournament-divide/tournament-divide.component"; import {TournamentDrawComponent} from "./components/tournament-draw/tournament-draw.component"; import {TournamentManageComponent} from "./components/tournament-manage/tournament-manage.component"; import {MatchSheetsComponent} from "./components/match-sheets/match-sheets.component"; @@ -21,14 +18,12 @@ export const routes: Routes = [ { path: 'tournaments/add', component: TournamentEditComponent, canActivate: [AuthGuard], data: { header: 'Nieuw Toernooi' }}, { path: 'tournaments/:id/edit', component: TournamentEditComponent, canActivate: [AuthGuard], data: { header: 'Bewerk Toernooi' }}, { path: 'tournaments/:id/registrations', component: TournamentPlayersComponent, canActivate: [AuthGuard], data: { header: 'Inschrijvingen' }}, - { path: 'tournaments/:id/validate', component: TournamentValidateComponent, canActivate: [AuthGuard], data: { header: 'Toernooi' }}, - { path: 'tournaments/:id/divide', component: TournamentDivideComponent, canActivate: [AuthGuard], data: { header: 'Toernooi valideren' }}, { path: 'tournaments/:id/draw', component: TournamentDrawComponent, canActivate: [AuthGuard], data: { header: 'Toernooi loten' }}, { path: 'tournaments/:id/manage', component: TournamentManageComponent, canActivate: [AuthGuard]}, { path: 'tournaments/:id/manage/:tab', component: TournamentManageComponent, canActivate: [AuthGuard], data: { header: 'Toernooien' }}, { path: 'players', component: PlayerListComponent, canActivate: [AuthGuard], data: { header: 'Spelers' }}, { path: 'players/add', component: PlayerEditComponent, canActivate: [AuthGuard], data: { header: 'Nieuwe Speler' }}, - { path: 'players/edit/:id', component: PlayerEditComponent, canActivate: [AuthGuard], data: { header: 'Bewerk Speler' }}, + { path: 'players/:id/edit', component: PlayerEditComponent, canActivate: [AuthGuard], data: { header: 'Bewerk Speler' }}, { path: 'players/:id/registrations', component: PlayerRegistrationsComponent, canActivate: [AuthGuard]}, { path: 'tournaments/:id/rounds/:roundId/matchsheets', component: MatchSheetsComponent, canActivate: [AuthGuard]}, { path: 'tournaments/:id/rounds/:roundId/overview', component: RoundOverviewComponent, canActivate: [AuthGuard], data: { header: 'Rondeoverzicht' }}, diff --git a/src/app/components/court-selection/court-selection.component.html b/src/app/components/court-selection/court-selection.component.html index eb58825..6e75a13 100644 --- a/src/app/components/court-selection/court-selection.component.html +++ b/src/app/components/court-selection/court-selection.component.html @@ -1,13 +1,32 @@ -

Kies een baan:

- @for (item of [].constructor(data.totalCourts); track item) { - }
+

Kies een teller:

+
+ + Teller + + Geen + @for (player of data.availableCounters; track player.playerId) { + + {{ player.name }} + + } + + +
+ @if (court && counter) { + + } diff --git a/src/app/components/court-selection/court-selection.component.scss b/src/app/components/court-selection/court-selection.component.scss index e69de29..8a202a9 100644 --- a/src/app/components/court-selection/court-selection.component.scss +++ b/src/app/components/court-selection/court-selection.component.scss @@ -0,0 +1,4 @@ +button:disabled { + cursor: not-allowed; + pointer-events: all !important; +} diff --git a/src/app/components/court-selection/court-selection.component.ts b/src/app/components/court-selection/court-selection.component.ts index 61108e3..4c77074 100644 --- a/src/app/components/court-selection/court-selection.component.ts +++ b/src/app/components/court-selection/court-selection.component.ts @@ -3,37 +3,52 @@ import { MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, - MatDialogContent, MatDialogRef, - MatDialogTitle + MatDialogContent, + MatDialogRef } from "@angular/material/dialog"; import {Match} from "../../model/match"; import {MatButton} from "@angular/material/button"; +import {TournamentPlayer} from "../../model/tournamentPlayer"; +import {MatFormField, MatLabel} from "@angular/material/form-field"; +import {MatOption, MatSelect} from "@angular/material/select"; +import {FormsModule} from "@angular/forms"; @Component({ selector: 'app-court-selection', - imports: [ - MatDialogTitle, - MatDialogContent, - MatButton, - MatDialogClose, - MatDialogActions - ], + imports: [ + MatDialogContent, + MatButton, + MatDialogClose, + MatDialogActions, + MatFormField, + MatLabel, + MatOption, + MatSelect, + FormsModule, + + ], templateUrl: './court-selection.component.html', styleUrl: './court-selection.component.scss' }) export class CourtSelectionComponent { court: number; + counter: TournamentPlayer; readonly dialogRef = inject(MatDialogRef); constructor(@Inject(MAT_DIALOG_DATA) public data: { match: Match, availableCourts: number[], - totalCourts: number + totalCourts: number, + availableCounters: TournamentPlayer[] }) {} onAnnulerenClick() { this.dialogRef.close(); } + + selectCourt(selectedCourt: number) { + this.court = selectedCourt; + } } diff --git a/src/app/components/player-list/player-list.component.html b/src/app/components/player-list/player-list.component.html index 369d1e3..c45cded 100644 --- a/src/app/components/player-list/player-list.component.html +++ b/src/app/components/player-list/player-list.component.html @@ -25,7 +25,7 @@ - + edit Bewerk diff --git a/src/app/components/player-registrations/player-registrations.component.html b/src/app/components/player-registrations/player-registrations.component.html index b89cab2..7c97a10 100644 --- a/src/app/components/player-registrations/player-registrations.component.html +++ b/src/app/components/player-registrations/player-registrations.component.html @@ -16,19 +16,17 @@
@if (eventRegistration.doublesEvent) { - - - Partner - - Geen - @for (player of getRelevantPlayers(eventRegistration.type); track player.id) { - - {{ player | fullName }} - - } - - - + + Partner + + Geen + @for (player of getRelevantPlayers(eventRegistration.type); track player.id) { + + {{ player | fullName }} + + } + + }
diff --git a/src/app/components/tournament-divide/tournament-divide.component.html b/src/app/components/tournament-divide/tournament-divide.component.html deleted file mode 100644 index cd273c2..0000000 --- a/src/app/components/tournament-divide/tournament-divide.component.html +++ /dev/null @@ -1,57 +0,0 @@ -@if (tournament) { - - -
Indeling voor {{ tournament.name }}
-
- - @for (event of tournament.events; track event.id) { - - -
Indeling {{ TournamentEvent.getType(event.type) }}
-
- - - @for (group of event.groups; track group.id) { - - - - {{ group.name }} {{ group.teams.length }} - - - - - - - - - @if (event.doublesEvent) { - - - - } - - - - @for (team of group.teams; track team.id) { - - - - - @if (event.doublesEvent) { - - - - } - - } - -
NaamClubSpeelsterktePartnerClubSpeelsterkte
{{ team.player1 | fullName }}{{ team.player1.club }}{{ getStrength(team.player1.strength.valueOf()) }}{{ team.player2 | fullName }}{{ team.player2?.club }}{{ team.player2 ? getStrength(team.player2!.strength.valueOf()) : '' }}
-
- } -
-
-
- } -
-
-} diff --git a/src/app/components/tournament-divide/tournament-divide.component.scss b/src/app/components/tournament-divide/tournament-divide.component.scss deleted file mode 100644 index 1f1c832..0000000 --- a/src/app/components/tournament-divide/tournament-divide.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -td, th { - background-color: transparent !important; -} diff --git a/src/app/components/tournament-divide/tournament-divide.component.ts b/src/app/components/tournament-divide/tournament-divide.component.ts deleted file mode 100644 index b0b6026..0000000 --- a/src/app/components/tournament-divide/tournament-divide.component.ts +++ /dev/null @@ -1,58 +0,0 @@ -import {Component, OnInit} from '@angular/core'; -import {Tournament} from "../../model/tournament"; -import {TournamentService} from "../../service/tournament.service"; -import {ActivatedRoute, Router} from "@angular/router"; -import {MatCard, MatCardContent, MatCardHeader} from "@angular/material/card"; -import { - MatAccordion, - MatExpansionPanel, - MatExpansionPanelHeader, - MatExpansionPanelTitle -} from "@angular/material/expansion"; -import {Event} from "../../model/event"; -import {Strength} from "../../model/player"; -import {FullNamePipe} from "../../pipes/fullname-pipe"; - -@Component({ - selector: 'app-tournament-divide', - imports: [ - MatCard, - MatCardHeader, - MatCardContent, - MatExpansionPanel, - MatExpansionPanelTitle, - MatExpansionPanelHeader, - FullNamePipe, - MatAccordion - ], - templateUrl: './tournament-divide.component.html', - styleUrl: './tournament-divide.component.scss' -}) -export class TournamentDivideComponent implements OnInit { - tournament?: Tournament; - - constructor( - private tournamentService: TournamentService, - private route: ActivatedRoute, - private router: Router - ) {} - - ngOnInit() { - const id = this.route.snapshot.paramMap.get('id'); - this.tournamentService.getById(Number(id)).subscribe(data => { - this.tournament = data; - }); - // this.tournamentService.getDivision(Number(id)).subscribe(data => { - // this.tournamentDivision = data; - // }); - } - - protected readonly TournamentEvent = Event; - - getStrength(strength: string) { - for (let [key, value] of Object.entries(Strength)) { - if (key == strength) return value; - } - return ""; - } -} diff --git a/src/app/components/tournament-manage/tournament-manage.component.html b/src/app/components/tournament-manage/tournament-manage.component.html index c72a6bf..481cece 100644 --- a/src/app/components/tournament-manage/tournament-manage.component.html +++ b/src/app/components/tournament-manage/tournament-manage.component.html @@ -1,10 +1,5 @@ @if (tournament) { - @@ -108,56 +103,43 @@ play_arrow -  Actieve wedstrijden -   +  Actieve wedstrijden   @if (this.activeMatches().length > 0) { {{ this.activeMatches().length }} } @if (this.activeMatches().length > 0) { - - - - - - - - - - - - @for (activeMatch of this.activeMatches(); track activeMatch.match.id) { - - - - - - - - - - } - -
WedstrijdOnderdeel/RondeStartBaan
{{ activeMatch.match.team1 | teamText }}-{{ activeMatch.match.team2 | teamText }}{{ activeMatch.group.name }} {{ activeMatch.round.name }}{{ activeMatch.match.startTime | date: 'HH:mm' }}{{ activeMatch.match.court }} - - -
- - - - - - +
Actieve wedstrijden
+ @for (activeMatch of this.activeMatches(); track activeMatch.match.id) { + + +
Baan {{ activeMatch.match.court }}
+
{{ activeMatch.match.team1 | teamText }}
+
-
+
{{ activeMatch.match.team2 | teamText }}
+
{{ activeMatch.group.name }} {{ activeMatch.round.name }}
+
+
+
Teller: {{ activeMatch.match.counter | fullName }}
+
+
Starttijd: {{ activeMatch.match.startTime | date: 'HH:mm' }}
+
Duur: {{ getDuration(activeMatch.match.startTime) | date: 'mm:ss' }}
+
+ + + + +
+
+ } } @else {
Geen actieve wedstrijden
} @@ -223,11 +205,11 @@ play_arrow Ronde starten - } +