feat: handle service judge setting on the UI
This commit is contained in:
1 parent
1d84985a76
commit
07f6919617
3 files changed
+87
-15
No files matched your search
@@ -15,6 +15,8 @@ import {
|
||||
import { SettingsService } from '../services/settings-service';
|
||||
import { CourtUmpireService } from '../services/court.umpire.service';
|
||||
import { CourtServiceJudgeService } from '../services/court.service.judge.service';
|
||||
import { CourtServiceJudge } from 'db';
|
||||
import { WaitingServiceJudgesService } from '../services/waiting-service-judges.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-tab3',
|
||||
@@ -38,6 +40,7 @@ export class Tab3Page {
|
||||
readonly settingsService = inject(SettingsService);
|
||||
readonly courtUmpireService = inject(CourtUmpireService);
|
||||
readonly courtServiceJudgeService = inject(CourtServiceJudgeService);
|
||||
readonly waitingServiceJudgeService = inject(WaitingServiceJudgesService);
|
||||
|
||||
readonly settings = this.settingsService.settings;
|
||||
|
||||
@@ -69,6 +72,17 @@ export class Tab3Page {
|
||||
await this.settingsService.update({
|
||||
withServiceJudge: event.detail.checked
|
||||
});
|
||||
|
||||
if (!event.detail.checked) {
|
||||
this.courtServiceJudgeService.umpires().map((csj: CourtServiceJudge) => {
|
||||
this.courtServiceJudgeService.delete(csj.id);
|
||||
});
|
||||
|
||||
|
||||
this.waitingServiceJudgeService.waitingServiceJudges().map((wsj) => {
|
||||
this.waitingServiceJudgeService.remove(wsj.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async updateShowAlert(event: CustomEvent): Promise<void> {
|
||||
|
||||
Reference in new issue
Block a user