From 7782d6f50ab99f1a083088fa14a025c89d201a4e Mon Sep 17 00:00:00 2001 From: ExostFlash Date: Mon, 2 Jun 2025 19:00:03 +0200 Subject: [PATCH] Add matchesadd --- .../essentials/login/login.component.html | 20 +++- .../matches-add/matches-add.component.html | 103 +++++++++++++++++- .../matches-add/matches-add.component.ts | 4 +- .../app/services/matches/matches.service.ts | 4 +- 4 files changed, 123 insertions(+), 8 deletions(-) diff --git a/FencerJudgeFront/src/app/components/essentials/login/login.component.html b/FencerJudgeFront/src/app/components/essentials/login/login.component.html index c531f0b..2eca917 100644 --- a/FencerJudgeFront/src/app/components/essentials/login/login.component.html +++ b/FencerJudgeFront/src/app/components/essentials/login/login.component.html @@ -5,16 +5,30 @@
- +
- +
- \ No newline at end of file + diff --git a/FencerJudgeFront/src/app/components/match/matches-add/matches-add.component.html b/FencerJudgeFront/src/app/components/match/matches-add/matches-add.component.html index ad70c67..0e64f71 100644 --- a/FencerJudgeFront/src/app/components/match/matches-add/matches-add.component.html +++ b/FencerJudgeFront/src/app/components/match/matches-add/matches-add.component.html @@ -1 +1,102 @@ -

matches-add works!

+

Ajouter un match

+ +
+
+ Joueur 1 + + + + + + + + +
+ +
+ Joueur 2 + + + + + + + + +
+ +
+ Arbitre + + + + + + + + +
+ +
+ Match + + + + + + + + +
+ + +
diff --git a/FencerJudgeFront/src/app/components/match/matches-add/matches-add.component.ts b/FencerJudgeFront/src/app/components/match/matches-add/matches-add.component.ts index 1de2680..b0acd38 100644 --- a/FencerJudgeFront/src/app/components/match/matches-add/matches-add.component.ts +++ b/FencerJudgeFront/src/app/components/match/matches-add/matches-add.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { Router } from '@angular/router'; +import { FormsModule } from '@angular/forms'; import { MatchesService } from '@services/matches/matches.service'; import { MatchState } from '@interfaces/matches'; @@ -34,7 +35,6 @@ export class MatchesAddComponent { city: '', country: '', - date: '', weapon: '', }; @@ -82,7 +82,7 @@ export class MatchesAddComponent { country: this.formData.country, city: this.formData.city, weapon: this.formData.weapon, - date: new Date(this.formData.date), + date: new Date(), state: MatchState.NOT_STARTED, }; diff --git a/FencerJudgeFront/src/app/services/matches/matches.service.ts b/FencerJudgeFront/src/app/services/matches/matches.service.ts index 58e004c..9e00fca 100644 --- a/FencerJudgeFront/src/app/services/matches/matches.service.ts +++ b/FencerJudgeFront/src/app/services/matches/matches.service.ts @@ -45,7 +45,7 @@ export class MatchesService { state: MatchState.NOT_STARTED, }, ]; - private nextId = 1; + private nextMatchId = Math.max(...this.matches.map((m) => m.id)) + 1; constructor() { console.log('[MatchesService] Initial matches loaded:', this.matches); @@ -83,7 +83,7 @@ export class MatchesService { create(match: Omit): Observable { const newMatch: Matches = { ...match, - id: this.nextId++, + id: this.nextMatchId++, }; this.matches.push(newMatch);