Add matchesadd
This commit is contained in:
parent
5a73a70e02
commit
7782d6f50a
4 changed files with 123 additions and 8 deletions
|
|
@ -5,16 +5,30 @@
|
|||
</div>
|
||||
<form (ngSubmit)="onSubmit()" class="login-form">
|
||||
<div class="input-group">
|
||||
<input type="email" name="email" [(ngModel)]="email" placeholder="Nom utilisateur" required />
|
||||
<input
|
||||
type="email"
|
||||
name="email"
|
||||
[(ngModel)]="email"
|
||||
placeholder="Nom utilisateur"
|
||||
value="user@test.com"
|
||||
required
|
||||
/>
|
||||
<label class="icon">👤</label>
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="password" name="password" [(ngModel)]="password" placeholder="Mot de passe" required />
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
[(ngModel)]="password"
|
||||
placeholder="Mot de passe"
|
||||
value="password123"
|
||||
required
|
||||
/>
|
||||
<label class="icon">🔒</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="login-btn">Connexion</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1 +1,102 @@
|
|||
<p>matches-add works!</p>
|
||||
<h2>Ajouter un match</h2>
|
||||
|
||||
<form (ngSubmit)="onSubmit()">
|
||||
<fieldset>
|
||||
<legend>Joueur 1</legend>
|
||||
<label>Prénom :</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="formData.player1FirstName"
|
||||
name="player1FirstName"
|
||||
required
|
||||
/>
|
||||
|
||||
<label>Nom :</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="formData.player1Name"
|
||||
name="player1Name"
|
||||
required
|
||||
/>
|
||||
|
||||
<label>Club :</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="formData.player1Club"
|
||||
name="player1Club"
|
||||
required
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Joueur 2</legend>
|
||||
<label>Prénom :</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="formData.player2FirstName"
|
||||
name="player2FirstName"
|
||||
required
|
||||
/>
|
||||
|
||||
<label>Nom :</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="formData.player2Name"
|
||||
name="player2Name"
|
||||
required
|
||||
/>
|
||||
|
||||
<label>Club :</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="formData.player2Club"
|
||||
name="player2Club"
|
||||
required
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Arbitre</legend>
|
||||
<label>Prénom :</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="formData.refereeFirstName"
|
||||
name="refereeFirstName"
|
||||
required
|
||||
/>
|
||||
|
||||
<label>Nom :</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="formData.refereeName"
|
||||
name="refereeName"
|
||||
required
|
||||
/>
|
||||
|
||||
<label>Niveau :</label>
|
||||
<select [(ngModel)]="formData.refereelevel" name="refereelevel" required>
|
||||
<option [value]="0">Départemental</option>
|
||||
<option [value]="1">Régional</option>
|
||||
<option [value]="2">National</option>
|
||||
<option [value]="3">International</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Match</legend>
|
||||
<label>Ville :</label>
|
||||
<input type="text" [(ngModel)]="formData.city" name="city" required />
|
||||
|
||||
<label>Pays :</label>
|
||||
<input type="text" [(ngModel)]="formData.country" name="country" required />
|
||||
|
||||
<label>Arme :</label>
|
||||
<select [(ngModel)]="formData.weapon" name="weapon" required>
|
||||
<option value="Épée">Épée</option>
|
||||
<option value="Sabre">Sabre</option>
|
||||
<option value="Fleuret">Fleuret</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<button type="submit">Créer le match</button>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Matches, 'id'>): Observable<Matches> {
|
||||
const newMatch: Matches = {
|
||||
...match,
|
||||
id: this.nextId++,
|
||||
id: this.nextMatchId++,
|
||||
};
|
||||
|
||||
this.matches.push(newMatch);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue