From 63737e46eb30c575ecc91dc9b01003af06faf8b7 Mon Sep 17 00:00:00 2001 From: Richard Toth Date: Fri, 5 Jun 2026 14:40:26 +0200 Subject: [PATCH] feat(pilot): remove TOs from court and add them to the waiting list --- src/app/tab1/tab1.page.html | 30 ++++++++++++++++-- src/app/tab1/tab1.page.ts | 61 ++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 4 deletions(-) diff --git a/src/app/tab1/tab1.page.html b/src/app/tab1/tab1.page.html index e19358b..d2d832a 100644 --- a/src/app/tab1/tab1.page.html +++ b/src/app/tab1/tab1.page.html @@ -19,8 +19,17 @@ P - Játékvezető - Adogatásbíró + + + Játékvezető + + + + + Adogatásbíró + + + @for (item of [].constructor(settings()?.numberOfCourts); track $index) { @@ -68,6 +77,21 @@ } + + + + + + + + + } @@ -84,7 +108,7 @@ - + Pihenők diff --git a/src/app/tab1/tab1.page.ts b/src/app/tab1/tab1.page.ts index 7d21f91..60a3e1d 100644 --- a/src/app/tab1/tab1.page.ts +++ b/src/app/tab1/tab1.page.ts @@ -9,7 +9,10 @@ import { IonRow, IonList, IonItem, - IonLabel + IonLabel, + IonIcon, + IonButton, + AlertController } from '@ionic/angular/standalone'; import { SettingsService } from '../services/settings-service'; import { UmpireService } from '../services/umpire.service'; @@ -27,12 +30,17 @@ import { import { CommonModule } from '@angular/common'; import { CourtUmpireService } from '../services/court.umpire.service'; import { CourtServiceJudgeService } from '../services/court.service.judge.service'; +import { addIcons } from 'ionicons'; +import { exitOutline } from 'ionicons/icons'; @Component({ selector: 'app-tab1', templateUrl: 'tab1.page.html', styleUrls: ['tab1.page.scss'], + providers: [FullnamePipe], imports: [ + IonButton, + IonIcon, IonLabel, IonItem, IonList, @@ -52,6 +60,10 @@ import { CourtServiceJudgeService } from '../services/court.service.judge.servic ] }) export class Tab1Page { + constructor() { + addIcons({ exitOutline }); + } + readonly settingsService = inject(SettingsService); readonly umpireService = inject(UmpireService); readonly waitingUmpireService = inject(WaitingUmpiresService); @@ -59,6 +71,9 @@ export class Tab1Page { readonly courtUmpireService = inject(CourtUmpireService); readonly courtServiceJudgeService = inject(CourtServiceJudgeService); + private alertController = inject(AlertController); + private fullnamePipe = inject(FullnamePipe); + /** * Raw signals from services */ @@ -358,4 +373,48 @@ export class Tab1Page { ): boolean => { return drop.data.length === 0; }; + + public async showRemoveConfirmation(courtNo: number) { + const umpire = this.umpireByCourt().get(courtNo); + const serviceJudge = this.serviceJudgeByCourt().get(courtNo); + + if (typeof umpire === 'undefined' || typeof serviceJudge === 'undefined') { + return; + } + + const alert = await this.alertController.create({ + header: `Pálya ${courtNo}`, + subHeader: 'Biztos leveszed őket pályáról?', + message: `${this.fullnamePipe.transform(umpire)} - ${this.fullnamePipe.transform(serviceJudge)}`, + buttons: [ + { + text: 'Nem', + role: 'cancel' + }, + { + text: 'Igen', + role: 'confirm', + handler: () => { + this.removeUmpiresFromCourt(courtNo); + } + } + ] + }); + + await alert.present(); + } + + private async removeUmpiresFromCourt(courtNo: number) { + const umpire = this.umpireByCourt().get(courtNo); + const serviceJudge = this.serviceJudgeByCourt().get(courtNo); + + if (typeof umpire === 'undefined' || typeof serviceJudge === 'undefined') { + return; + } + + await this.courtUmpireService.removeByUmpireId(umpire.id); + await this.courtServiceJudgeService.removeByUmpireId(serviceJudge.id); + await this.waitingUmpireService.add(serviceJudge.id); + await this.waitingServiceJudgeService.add(umpire.id); + } }