WIP: substitutions
Some checks failed
Gitea/swiss-client/pipeline/head There was a failure building this commit
Some checks failed
Gitea/swiss-client/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Component, inject, Input, OnInit} from '@angular/core';
|
||||
import {CurrencyPipe} from "@angular/common";
|
||||
import {MatSlideToggle, MatSlideToggleChange} from "@angular/material/slide-toggle";
|
||||
import {TournamentService} from "../../service/tournament.service";
|
||||
@@ -6,13 +6,25 @@ import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {Tournament} from "../../model/tournament";
|
||||
import {FormsModule} from "@angular/forms";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {MatIcon} from "@angular/material/icon";
|
||||
import {MatIconButton} from "@angular/material/button";
|
||||
import {MatMenu, MatMenuItem, MatMenuTrigger} from "@angular/material/menu";
|
||||
import {CourtSelectionComponent} from "../court-selection/court-selection.component";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {SubstituteSelectionComponent} from "../substitute-selection/substitute-selection.component";
|
||||
import {TournamentPlayer} from "../../model/tournamentPlayer";
|
||||
|
||||
@Component({
|
||||
selector: 'app-tournament-players',
|
||||
imports: [
|
||||
CurrencyPipe,
|
||||
MatSlideToggle,
|
||||
FormsModule
|
||||
FormsModule,
|
||||
MatIcon,
|
||||
MatIconButton,
|
||||
MatMenu,
|
||||
MatMenuItem,
|
||||
MatMenuTrigger
|
||||
],
|
||||
templateUrl: './tournament-players.component.html',
|
||||
standalone: true,
|
||||
@@ -49,4 +61,25 @@ export class TournamentPlayersComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
substituteSelectionDialog = inject(MatDialog);
|
||||
|
||||
findSubstitute(player: TournamentPlayer) {
|
||||
this.substituteSelectionDialog.open(SubstituteSelectionComponent, {
|
||||
data: {
|
||||
player: player,
|
||||
availablePlayers: this.tournament.tournamentPlayers
|
||||
},
|
||||
minWidth: '800px',
|
||||
minHeight: '250px'
|
||||
}).afterClosed().subscribe(result => {
|
||||
if (result != undefined) {
|
||||
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.tournament = data;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user