Merge branch 'dev' into cecile
This commit is contained in:
commit
6623310501
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"workbench.colorCustomizations": {
|
||||
"titleBar.activeBackground": "#4950a1"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -25,7 +25,7 @@
|
|||
"zone.js": "~0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~13.0.3",
|
||||
"@angular-devkit/build-angular": "^13.1.4",
|
||||
"@angular/cli": "~13.0.3",
|
||||
"@angular/compiler-cli": "~13.0.0",
|
||||
"@types/jasmine": "~3.10.0",
|
||||
|
|
|
@ -4,6 +4,8 @@ import { PageAccountComponent } from './pages/page-account/page-account.componen
|
|||
import { PageAccueilComponent } from './pages/page-accueil/page-accueil.component';
|
||||
import { PageAddMemberComponent } from './pages/page-add-member/page-add-member.component';
|
||||
import { PageAgendaComponent } from './pages/page-agenda/page-agenda.component';
|
||||
import { PageAjoutContactComponent } from './pages/page-ajout-contact/page-ajout-contact.component';
|
||||
import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component';
|
||||
import { PageDashboardComponent } from './pages/page-dashboard/page-dashboard.component';
|
||||
import { PageDeleteMemberComponent } from './pages/page-delete-member/page-delete-member.component';
|
||||
import { PageForgotPasswordComponent } from './pages/page-forgot-password/page-forgot-password.component';
|
||||
|
@ -30,6 +32,9 @@ const routes: Routes = [
|
|||
{ path: 'creation-compte', component: PageSignupComponent },
|
||||
{ path: 'to-do-list', component: PageToDoListComponent },
|
||||
{ path: 'modifier-membre', component: PageUpdateMemberComponent },
|
||||
{ path: 'ajouter-contact', component: PageAjoutContactComponent },
|
||||
{ path: 'modifier-contact', component: PageAjoutContactComponent },
|
||||
{ path: 'creation-team', component : PageCreationTeamComponent},
|
||||
{ path: '**', component: PageNotFoundComponent },
|
||||
];
|
||||
|
||||
|
|
|
@ -33,6 +33,9 @@ import { PaginationComponent } from './components/pagination/pagination.componen
|
|||
import { CreneauComponent } from './components/creneau/creneau.component';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { PageAjoutContactComponent } from './pages/page-ajout-contact/page-ajout-contact.component';
|
||||
import { PageModifierContactComponent } from './pages/page-modifier-contact/page-modifier-contact.component';
|
||||
import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
@ -65,6 +68,9 @@ import { HttpClientModule } from '@angular/common/http';
|
|||
FicheContactComponent,
|
||||
PaginationComponent,
|
||||
CreneauComponent,
|
||||
PageAjoutContactComponent,
|
||||
PageModifierContactComponent,
|
||||
PageCreationTeamComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
|
|
@ -1 +1,29 @@
|
|||
<p>fiche-contact works!</p>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<button class="w-100 btn btn-lg btn-rounded btn-secondary">
|
||||
Modifier
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<button class="w-100 btn btn-lg btn-rounded btn-secondary">
|
||||
Supprimer
|
||||
</button>
|
||||
</div>
|
||||
<div class="row align-items-center">
|
||||
<div class="col-md-6 offset-md-3">
|
||||
<img style="max-height: 12% ; max-width: 12%" src="../../../assets/images/contact-1.png"/>
|
||||
<p class="fiche-contact" >{{ personne.prenom }} {{ personne.nom }}</p>
|
||||
<p class="fiche-contact" ><img style="max-height: 12% ; max-width: 12%" src="../../../assets/images/phone.png"/>
|
||||
{{ personne.telephone }}</p>
|
||||
<p class="fiche-contact" ><img style="max-height: 12% ; max-width: 12%" src="../../../assets/images/logo-gmail.png"/>
|
||||
{{ personne.email }}</p>
|
||||
<p class="fiche-contact" ><img style="max-height: 12% ; max-width: 12%" src="../../../assets/images/gateau.png"/>
|
||||
{{ personne.dateNaissance }}</p>
|
||||
<p class="fiche-contact" >
|
||||
{{ personne.adresse }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
.btn-secondary {
|
||||
color: #fff;
|
||||
background-color: #5a1e63 !important;
|
||||
width: 100%;
|
||||
max-width: 150px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.container {
|
||||
border: 1px solid 8c2e9b;
|
||||
padding: 10px;
|
||||
box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px,
|
||||
rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
|
||||
max-height: 1200px;
|
||||
max-width: 350px;
|
||||
}
|
|
@ -1,15 +1,14 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-fiche-contact',
|
||||
templateUrl: './fiche-contact.component.html',
|
||||
styleUrls: ['./fiche-contact.component.scss']
|
||||
styleUrls: ['./fiche-contact.component.scss'],
|
||||
})
|
||||
export class FicheContactComponent implements OnInit {
|
||||
@Input() personne: any;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
export interface Contact {
|
||||
nom: string;
|
||||
prenom: string;
|
||||
telephone: string;
|
||||
email: string;
|
||||
adresse: string;
|
||||
dateNaissance: Date;
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
export interface Membre {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
nom: string;
|
||||
prenom: string;
|
||||
email: string;
|
||||
password: string;
|
||||
dateNaissance: Date;
|
||||
teamName: string;
|
||||
profil: boolean;
|
||||
passwordConfirm: string;
|
||||
roleList: string[];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { Membre } from './membre';
|
||||
import { Team } from './team';
|
||||
|
||||
export interface Menu {
|
||||
libelle: string;
|
||||
dateMenu: Date;
|
||||
membre: Membre;
|
||||
team: Team;
|
||||
validationProposition: boolean;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
export interface Team {
|
||||
nom : string;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import { Team } from './team';
|
||||
|
||||
export interface ToDoList {
|
||||
nom: string;
|
||||
team: Team;
|
||||
tache: string;
|
||||
}
|
|
@ -1,2 +1,7 @@
|
|||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button button type="button" class="btn btn-primary btn-lg"
|
||||
routerLink="../creation-team"
|
||||
routerLinkActive="active-custom">Créer ma team</button>
|
||||
</div>
|
||||
|
|
|
@ -1 +1,109 @@
|
|||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
<div class="signup-form text-center">
|
||||
<main class="form-signup">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm">
|
||||
<h1>J'inscris un nouveau membre</h1>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputlastName"
|
||||
placeholder=""
|
||||
name="lastName"
|
||||
formControlName="lastNameFc"
|
||||
[ngClass]="{'is-valid' : addMemberForm.controls['lastNameFc'].touched && addMemberForm.controls['lastNameFc'].valid,
|
||||
'is-invalid': addMemberForm.controls['lastNameFc'].touched && !addMemberForm.controls['lastNameFc'].valid}">
|
||||
<label for="floatingInputlastName">Avatar</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputlastName"
|
||||
placeholder=""
|
||||
name="lastName"
|
||||
formControlName="lastNameFc"
|
||||
[ngClass]="{'is-valid' : addMemberForm.controls['lastNameFc'].touched && addMemberForm.controls['lastNameFc'].valid,
|
||||
'is-invalid': addMemberForm.controls['lastNameFc'].touched && !addMemberForm.controls['lastNameFc'].valid}">
|
||||
<label for="floatingInputlastName">Nom</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputfirstName"
|
||||
placeholder=""
|
||||
name="firstName"
|
||||
formControlName="firstNameFc"
|
||||
[ngClass]="{'is-valid' : addMemberForm.controls['firstNameFc'].touched && addMemberForm.controls['firstNameFc'].valid,
|
||||
'is-invalid': addMemberForm.controls['firstNameFc'].touched && !addMemberForm.controls['firstNameFc'].valid}">
|
||||
<label for="floatingInputfirstName">Prénom</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="date"
|
||||
class="form-control"
|
||||
id="floatingInputdateNaissance"
|
||||
placeholder=""
|
||||
name="dateNaissance"
|
||||
formControlName="dateNaissanceFc"
|
||||
[ngClass]="{'is-valid' : addMemberForm.controls['dateNaissanceFc'].touched && addMemberForm.controls['dateNaissanceFc'].valid,
|
||||
'is-invalid': addMemberForm.controls['dateNaissanceFc'].touched && !addMemberForm.controls['dateNaissanceFc'].valid}">
|
||||
<label for="floatingInputfirstName">Date de naissance</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<select type="text"
|
||||
class="form-control"
|
||||
id="floatingInputprofil"
|
||||
name="profil"
|
||||
formControlName="profilFc"
|
||||
[ngClass]="{'is-valid' : addMemberForm.controls['profilFc'].touched && addMemberForm.controls['profilFc'].valid,
|
||||
'is-invalid': addMemberForm.controls['profilFc'].touched && !addMemberForm.controls['profilFc'].valid}">
|
||||
<option>Adulte</option>
|
||||
<option>Enfant</option>
|
||||
</select>
|
||||
<label for="floatingInputfirstName">Profil</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="email"
|
||||
class="form-control"
|
||||
id="floatingInput"
|
||||
placeholder=""
|
||||
name="email"
|
||||
formControlName="emailFc"
|
||||
[ngClass]="{'is-valid' : addMemberForm.controls['emailFc'].touched && addMemberForm.controls['emailFc'].valid,
|
||||
'is-invalid': addMemberForm.controls['emailFc'].touched && !addMemberForm.controls['emailFc'].valid}">
|
||||
<label for="floatingInput">Adresse email</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="password"
|
||||
class="form-control"
|
||||
id="floatingPassword"
|
||||
placeholder=""
|
||||
name="password"
|
||||
formControlName="passwordFc"
|
||||
[ngClass]="{'is-valid' : addMemberForm.controls['passwordFc'].touched && addMemberForm.controls['passwordFc'].valid,
|
||||
'is-invalid': addMemberForm.controls['passwordFc'].touched && !addMemberForm.controls['passwordFc'].valid}">
|
||||
<label for="floatingPassword">Mot de passe</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="passwordConfirm"
|
||||
class="form-control"
|
||||
id="floatingpasswordConfirm"
|
||||
placeholder=""
|
||||
name="passwordConfirm"
|
||||
formControlName="passwordConfirmFc"
|
||||
[ngClass]="{'is-valid' : addMemberForm.controls['passwordConfirmFc'].touched && addMemberForm.controls['passwordConfirmFc'].valid,
|
||||
'is-invalid': addMemberForm.controls['passwordConfirmFc'].touched && !addMemberForm.controls['passwordConfirmFc'].valid}">
|
||||
<label for="floatingPassword">Confirmer mot de passe</label>
|
||||
</div>
|
||||
|
||||
<button class="w-100 btn btn-lg btn-success"
|
||||
type="submit"
|
||||
[disabled]="addMemberForm.invalid">Je confirme l'ajout de ce membre à ma team !</button>
|
||||
<p>
|
||||
Value : {{ addMemberForm.value | json }}
|
||||
</p>
|
||||
<p>
|
||||
Form valid : {{ addMemberForm.valid }}
|
||||
</p>
|
||||
|
||||
</form>
|
||||
</main>
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
.login-form {
|
||||
height: 100vh;
|
||||
padding-top: 40px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.form-signup {
|
||||
width: 100%;
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.form-signup .checkbox {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.form-signup .form-floating:focus-within {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.form-signup input[type="email"] {
|
||||
margin-bottom: -1px;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.form-signup input[type="password"] {
|
||||
margin-bottom: 10px;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
|
@ -1,4 +1,8 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { Membre } from 'src/app/models/membre';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-add-member',
|
||||
|
@ -7,9 +11,91 @@ import { Component, OnInit } from '@angular/core';
|
|||
})
|
||||
export class PageAddMemberComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
public addMemberForm: FormGroup;
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private fb: FormBuilder
|
||||
) {
|
||||
this.addMemberForm = new FormGroup({});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// *********************************pensser a changer group car déprécié********************************
|
||||
this.addMemberForm = this.fb.group(
|
||||
{
|
||||
firstNameFc: new FormControl('', [Validators.required]),
|
||||
lastNameFc: new FormControl('', [Validators.required]),
|
||||
dateNaissanceFc: new FormControl('', [Validators.required]),
|
||||
profilFc: new FormControl('', [Validators.required]),
|
||||
emailFc: new FormControl('', [
|
||||
Validators.email,
|
||||
Validators.required,
|
||||
Validators.pattern(/^([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/gim),
|
||||
]), // chercher une meilleure regex
|
||||
passwordFc: new FormControl('', [
|
||||
Validators.minLength(8),
|
||||
Validators.required,
|
||||
]),
|
||||
passwordConfirmFc: new FormControl('', [
|
||||
Validators.minLength(8),
|
||||
Validators.required,
|
||||
]),
|
||||
},
|
||||
{
|
||||
validator: this.ConfirmedValidator('passwordFc', 'passwordConfirmFc'),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public onSubmit(): void {
|
||||
console.log('value : ', this.addMemberForm.value);
|
||||
console.log('form : ', this.addMemberForm);
|
||||
const firstNameValue = this.addMemberForm.value['firstNameFc'];
|
||||
const lastNameValue = this.addMemberForm.value['lastNameFc'];
|
||||
const emailValue = this.addMemberForm.value['emailFc'];
|
||||
const passwordValue = this.addMemberForm.value['passwordFc'];
|
||||
const dateNaissanceValue = this.addMemberForm.value['dateNaissanceFc'];
|
||||
const teamNameValue = this.addMemberForm.value['teamNameFc'];
|
||||
const profilValue = this.addMemberForm.value['profilFc'];
|
||||
const passwordConfirmValue = this.addMemberForm.value['passwordConfirmFc'];
|
||||
const teamValue = [''];
|
||||
|
||||
const membre: Membre = {
|
||||
nom: firstNameValue,
|
||||
prenom: lastNameValue,
|
||||
email: emailValue,
|
||||
password: passwordValue,
|
||||
dateNaissance: dateNaissanceValue,
|
||||
passwordConfirm: passwordConfirmValue,
|
||||
roleList: ["ROLE_PARENT"]
|
||||
};
|
||||
|
||||
|
||||
if (membre.email !== '' && membre.password !== '') {
|
||||
this.authService.signup(membre).subscribe((resp) => {
|
||||
this.router.navigate(['account/signin']);
|
||||
});
|
||||
} else {
|
||||
// affichage erreur
|
||||
}
|
||||
}
|
||||
|
||||
ConfirmedValidator(controlName: string, matchingControlName: string) {
|
||||
return (formGroup: FormGroup) => {
|
||||
const control = formGroup.controls[controlName];
|
||||
const matchingControl = formGroup.controls[matchingControlName];
|
||||
if (
|
||||
matchingControl.errors &&
|
||||
!matchingControl.errors['confirmedValidator']
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (control.value !== matchingControl.value) {
|
||||
matchingControl.setErrors({ confirmedValidator: true });
|
||||
} else {
|
||||
matchingControl.setErrors(null);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
<div>
|
||||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
<div class="ajoutContact-form text-center">
|
||||
<main class="form-ajoutContact">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="ajoutContactForm">
|
||||
<h1>Ajouter un contact</h1>
|
||||
|
||||
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputlastName"
|
||||
placeholder=""
|
||||
name="lastName"
|
||||
formControlName="lastNameFc">
|
||||
<label for="floatingInputlastName">Nom</label>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputfirstName"
|
||||
placeholder=""
|
||||
name="firstName"
|
||||
formControlName="firstNameFc">
|
||||
<label for="floatingInputfirstName">Prénom</label>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputTelephone"
|
||||
placeholder=""
|
||||
name="telephone"
|
||||
formControlName="telephoneFc">
|
||||
<label for="floatingInputfirstName">Téléphone</label>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="email"
|
||||
class="form-control"
|
||||
id="floatingInput"
|
||||
placeholder=""
|
||||
name="email"
|
||||
formControlName="emailFc">
|
||||
<label for="floatingInput">Adresse email</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-floating">
|
||||
<input type="date"
|
||||
class="form-control"
|
||||
id="floatingInputdateNaissance"
|
||||
placeholder=""
|
||||
name="dateNaissance"
|
||||
formControlName="dateNaissanceFc">
|
||||
<label for="floatingInputfirstName">Date de naissance</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputAdresse"
|
||||
placeholder=""
|
||||
name="adresse"
|
||||
formControlName="adresseFc">
|
||||
<label for="floatingInputfirstName">Adresse</label>
|
||||
</div>
|
||||
|
||||
<button class="w-100 btn btn-lg btn-success"
|
||||
type="submit"
|
||||
[disabled]="ajoutContactForm.invalid">Valider</button>
|
||||
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
|
@ -0,0 +1,26 @@
|
|||
.login-form {
|
||||
height: 100vh;
|
||||
padding-top: 40px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.form-ajoutContact {
|
||||
width: 100%;
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.form-ajoutContact .checkbox {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.form-ajoutContact .form-floating:focus-within {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.form-ajoutContact input[type="email"] {
|
||||
margin-bottom: -1px;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PageAjoutContactComponent } from './page-ajout-contact.component';
|
||||
|
||||
describe('PageAjoutContactComponent', () => {
|
||||
let component: PageAjoutContactComponent;
|
||||
let fixture: ComponentFixture<PageAjoutContactComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PageAjoutContactComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PageAjoutContactComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,71 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {
|
||||
FormBuilder,
|
||||
FormControl,
|
||||
FormGroup,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { Contact } from '../../models/contact';
|
||||
import { RepertoireService } from '../../services/repertoire.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-ajout-contact',
|
||||
templateUrl: './page-ajout-contact.component.html',
|
||||
styleUrls: ['./page-ajout-contact.component.scss'],
|
||||
})
|
||||
export class PageAjoutContactComponent implements OnInit {
|
||||
public ajoutContactForm: FormGroup;
|
||||
|
||||
constructor(
|
||||
private repertoireService: RepertoireService,
|
||||
private router: Router,
|
||||
private fb: FormBuilder
|
||||
) {
|
||||
this.ajoutContactForm = new FormGroup({});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// *********************************pensser a changer group car déprécié********************************
|
||||
this.ajoutContactForm = this.fb.group({
|
||||
lastNameFc: new FormControl('', [Validators.required]),
|
||||
firstNameFc: new FormControl('', [Validators.required]),
|
||||
telephoneFc: new FormControl('', [Validators.required]),
|
||||
emailFc: new FormControl('', [
|
||||
Validators.email,
|
||||
Validators.required,
|
||||
Validators.pattern(/^([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/gim),
|
||||
]), // chercher une meilleure regex
|
||||
dateNaissanceFc: new FormControl('', [Validators.required]),
|
||||
adresseFc: new FormControl('', [Validators.required]),
|
||||
});
|
||||
}
|
||||
|
||||
public onSubmit(): void {
|
||||
console.log('value : ', this.ajoutContactForm.value);
|
||||
console.log('form : ', this.ajoutContactForm);
|
||||
const firstNameValue = this.ajoutContactForm.value['firstNameFc'];
|
||||
const lastNameValue = this.ajoutContactForm.value['lastNameFc'];
|
||||
const telephoneValue = this.ajoutContactForm.value['telephoneFc'];
|
||||
const emailValue = this.ajoutContactForm.value['emailFc'];
|
||||
const dateNaissanceValue = this.ajoutContactForm.value['dateNaissanceFc'];
|
||||
const adresseValue = this.ajoutContactForm.value['adresseFc'];
|
||||
|
||||
const contact: Contact = {
|
||||
nom: lastNameValue,
|
||||
prenom: firstNameValue,
|
||||
telephone: telephoneValue,
|
||||
email: emailValue,
|
||||
dateNaissance: dateNaissanceValue,
|
||||
adresse: adresseValue,
|
||||
};
|
||||
|
||||
if (contact.nom !== '') {
|
||||
this.repertoireService.addContact(contact).subscribe((resp) => {
|
||||
this.router.navigate(['repertoire/']);
|
||||
});
|
||||
} else {
|
||||
// affichage erreur
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
<div class="signup-form text-center">
|
||||
<main class="form-signup">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="teamForm">
|
||||
<h1>Créer votre team!</h1>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputName"
|
||||
placeholder=""
|
||||
name="name"
|
||||
formControlName="nameFc"
|
||||
[ngClass]="{'is-valid' : teamForm.controls['nameFc'].touched && teamForm.controls['nameFc'].valid,
|
||||
'is-invalid': teamForm.controls['nameFc'].touched && !teamForm.controls['nameFc'].valid}">
|
||||
<label for="floatingInputName">Nom</label>
|
||||
</div>
|
||||
<button class="w-100 btn btn-lg btn-success"
|
||||
type="submit"
|
||||
[disabled]="teamForm.invalid">Je crée ma team</button>
|
||||
<p>
|
||||
Value : {{ teamForm.value | json }}
|
||||
</p>
|
||||
<p>
|
||||
Form valid : {{ teamForm.valid }}
|
||||
</p>
|
||||
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
|
@ -0,0 +1,32 @@
|
|||
.login-form {
|
||||
height: 100vh;
|
||||
padding-top: 40px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.form-signup {
|
||||
width: 100%;
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.form-signup .checkbox {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.form-signup .form-floating:focus-within {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.form-signup input[type="email"] {
|
||||
margin-bottom: -1px;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.form-signup input[type="password"] {
|
||||
margin-bottom: 10px;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PageCreationTeamComponent } from './page-creation-team.component';
|
||||
|
||||
describe('PageCreationTeamComponent', () => {
|
||||
let component: PageCreationTeamComponent;
|
||||
let fixture: ComponentFixture<PageCreationTeamComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PageCreationTeamComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PageCreationTeamComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,72 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {
|
||||
FormBuilder,
|
||||
FormControl,
|
||||
FormGroup,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { Team } from 'src/app/models/team';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-creation-team',
|
||||
templateUrl: './page-creation-team.component.html',
|
||||
styleUrls: ['./page-creation-team.component.scss'],
|
||||
})
|
||||
export class PageCreationTeamComponent implements OnInit {
|
||||
public teamForm: FormGroup;
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private fb: FormBuilder
|
||||
) {
|
||||
this.teamForm = new FormGroup({});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// *********************************penser a changer group car déprécié********************************
|
||||
this.teamForm = new FormGroup({
|
||||
nameFc : new FormControl('', [Validators.required])
|
||||
});
|
||||
}
|
||||
|
||||
public onSubmit(): void {
|
||||
console.log('value : ', this.teamForm.value);
|
||||
console.log('form : ', this.teamForm);
|
||||
const nameValue = this.teamForm.value['nameFc'];
|
||||
|
||||
const team: Team = {
|
||||
nom : nameValue,
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (team.nom !== '' ) {
|
||||
this.authService.creationTeam(team).subscribe((resp) => {
|
||||
this.router.navigate(['compte']);
|
||||
});
|
||||
} else {
|
||||
// affichage erreur
|
||||
}
|
||||
}
|
||||
|
||||
ConfirmedValidator(controlName: string, matchingControlName: string) {
|
||||
return (formGroup: FormGroup) => {
|
||||
const control = formGroup.controls[controlName];
|
||||
const matchingControl = formGroup.controls[matchingControlName];
|
||||
if (
|
||||
matchingControl.errors &&
|
||||
!matchingControl.errors['confirmedValidator']
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (control.value !== matchingControl.value) {
|
||||
matchingControl.setErrors({ confirmedValidator: true });
|
||||
} else {
|
||||
matchingControl.setErrors(null);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +1,23 @@
|
|||
<app-header></app-header>
|
||||
<div class="signin-form text-center">
|
||||
<main class="form-forgot">
|
||||
<form (ngSubmit)="onSubmit(forgotForm)" #forgotForm="ngForm">
|
||||
<div class="form-floating">
|
||||
<input type="email" class="form-control" id="floatingInput" placeholder="" name="email" ngModel required
|
||||
[ngClass]="{'is-valid': forgotForm.form.touched && forgotForm.form.value['email'] != '' ,
|
||||
'is-invalid': forgotForm.form.touched && forgotForm.form.value['email'] == ''}">
|
||||
<label for="floatingInput">Adresse email</label>
|
||||
</div>
|
||||
|
||||
<button class="w-100 btn btn-lg btn-success" type="submit" [disabled]="forgotForm.invalid" routerLink="../reinitialisation-password"
|
||||
routerLinkActive="active-custom">Ré-initialiser mon mot de passe</button>
|
||||
|
||||
</form>
|
||||
|
||||
<div *ngIf="errorForm">
|
||||
<p class="text-danger">Il manque des informations dans le formulaire...</p>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
.forgot-form {
|
||||
height: 100vh;
|
||||
padding-top: 40px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.form-forgot {
|
||||
width: 100%;
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
.checkbox {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.form-floating:focus-within {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
input[type="email"] {
|
||||
margin-bottom: -1px;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,12 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
import {
|
||||
FormBuilder,
|
||||
FormControl,
|
||||
FormGroup,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-forgot-password',
|
||||
|
@ -6,10 +14,25 @@ import { Component, OnInit } from '@angular/core';
|
|||
styleUrls: ['./page-forgot-password.component.scss']
|
||||
})
|
||||
export class PageForgotPasswordComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
public errorForm: boolean;
|
||||
constructor(private authService: AuthService, private router: Router) {
|
||||
this.errorForm = false;
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
public onSubmit(submittedForm: any): void {
|
||||
console.log(submittedForm.form.value);
|
||||
const email = submittedForm.form.value['email'];
|
||||
if (email !== '') {
|
||||
this.authService.forgotPassword(email).subscribe((resp) => {
|
||||
console.log('Component : PageForgotPassword ', resp);
|
||||
this.router.navigate(['reinitialisation-password']);
|
||||
});
|
||||
} else {
|
||||
// afficher une erreur à l'utilisateur
|
||||
this.errorForm = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<p>page-modifier-contact works!</p>
|
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PageModifierContactComponent } from './page-modifier-contact.component';
|
||||
|
||||
describe('PageModifierContactComponent', () => {
|
||||
let component: PageModifierContactComponent;
|
||||
let fixture: ComponentFixture<PageModifierContactComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PageModifierContactComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PageModifierContactComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-modifier-contact',
|
||||
templateUrl: './page-modifier-contact.component.html',
|
||||
styleUrls: ['./page-modifier-contact.component.scss']
|
||||
})
|
||||
export class PageModifierContactComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
|
@ -1,2 +1,31 @@
|
|||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
|
||||
<div>
|
||||
<button class="w-100 btn btn-lg btn-secondary "
|
||||
type="submit">Tous les contacts
|
||||
</button>
|
||||
|
||||
<button routerLink="/ajouter-contact" class="w-100 btn btn-lg btn-rounded btn-secondary">
|
||||
Ajouter un contact
|
||||
</button>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control"
|
||||
placeholder="Rechercher un contact"
|
||||
aria-label="Rechercher un contact"
|
||||
aria-describedby="basic-addon2"
|
||||
#word
|
||||
(keyup)="onSearchChange(word.value)">
|
||||
|
||||
<div class="input-group-append">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngFor="let personne of listContact" (click)="onClick(personne)" >
|
||||
<img style="max-height: 12% ; max-width: 12%" src="../../../assets/images/contact-1.png"/>
|
||||
<p class="fiche-contact" >{{ personne.prenom }} {{ personne.nom }}</p>
|
||||
</div>
|
||||
<div *ngIf="openDetails"><app-fiche-contact [personne]="openDetails"></app-fiche-contact></div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
.btn-secondary {
|
||||
color: #fff;
|
||||
background-color: #5a1e63 !important;
|
||||
width: 100%;
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.input-group mb-3 {
|
||||
width: 100%;
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
}
|
|
@ -1,15 +1,50 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { RepertoireService } from 'src/app/services/repertoire.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-repertoire',
|
||||
templateUrl: './page-repertoire.component.html',
|
||||
styleUrls: ['./page-repertoire.component.scss']
|
||||
styleUrls: ['./page-repertoire.component.scss'],
|
||||
})
|
||||
export class PageRepertoireComponent implements OnInit {
|
||||
public listContact: any[];
|
||||
public listFull: any[];
|
||||
keyword: any;
|
||||
openDetails: any;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
constructor(private repertoireService: RepertoireService) {
|
||||
this.listContact = [];
|
||||
this.listFull = [];
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.repertoireService.getContact().subscribe((listContact: any[]) => {
|
||||
console.log(listContact);
|
||||
this.listContact = listContact;
|
||||
this.listFull = listContact;
|
||||
});
|
||||
}
|
||||
|
||||
// Méthode pour récuper ce qui est saisi dans l'input
|
||||
onSearchChange(prenom: string): void {
|
||||
this.keyword = prenom;
|
||||
if (prenom == '') {
|
||||
this.listContact = this.listFull;
|
||||
} else {
|
||||
this.applyFilter(prenom);
|
||||
}
|
||||
}
|
||||
|
||||
// Méthode qui applique un filtre sur ce qui est récupéré de l'input sur le prénom
|
||||
applyFilter(filter: any) {
|
||||
let prenom = this.listFull.filter((contact) =>
|
||||
contact.prenom.toLowerCase().includes(filter.toLowerCase())
|
||||
);
|
||||
this.listContact = prenom;
|
||||
}
|
||||
|
||||
onClick(personne: any) {
|
||||
console.log(personne);
|
||||
this.openDetails = personne;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,26 @@
|
|||
<app-header></app-header>
|
||||
<div class="signin-form text-center">
|
||||
<main class="form-signin">
|
||||
<form (ngSubmit)="onSubmit(resetForm)" #resetForm="ngForm">
|
||||
<div class="form-floating">
|
||||
<input type="email" class="form-control" id="floatingEmail" placeholder="" name="email" ngModel required
|
||||
[ngClass]="{'is-valid': resetForm.form.touched && resetForm.form.value['email'] != '' ,
|
||||
'is-invalid': resetForm.form.touched && resetForm.form.value['email'] == ''}">
|
||||
<label for="floatingEmail">Email</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="password" class="form-control" id="floatingPassword" placeholder="" name="password" ngModel
|
||||
required [ngClass]="{'is-valid': resetForm.form.touched && resetForm.form.value['password'] != '' ,
|
||||
'is-invalid': resetForm.form.touched && resetForm.form.value['password'] == ''}">
|
||||
<label for="floatingPassword">Mot de passe</label>
|
||||
</div>
|
||||
|
||||
<button class="w-100 btn btn-lg btn-success" type="submit" [disabled]="resetForm.invalid">Se connecter</button>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -6,10 +6,21 @@ import { Component, OnInit } from '@angular/core';
|
|||
styleUrls: ['./page-reset-password.component.scss']
|
||||
})
|
||||
export class PageResetPasswordComponent implements OnInit {
|
||||
authService: any;
|
||||
router: any;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
ngOnInit(): void {}
|
||||
|
||||
public onSubmit(submittedForm: any): void {
|
||||
console.log(submittedForm.form.value);
|
||||
const password = submittedForm.form.value['password'];
|
||||
const email = submittedForm.form.value['email'];
|
||||
console.log(email);
|
||||
this.authService.resetPassword(email, password).subscribe((resp: any) => {
|
||||
this.router.navigate(['tableau-de-bord']);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,108 +2,129 @@
|
|||
<div class="signup-form text-center">
|
||||
<main class="form-signup">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
|
||||
<h1>Merci de vous inscrire</h1>
|
||||
<h1>Inscrivez-vous !</h1>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="floatingInputlastName"
|
||||
placeholder=""
|
||||
name="lastName"
|
||||
formControlName="lastNameFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['lastNameFc'].touched && signupForm.controls['lastNameFc'].valid,
|
||||
'is-invalid': signupForm.controls['lastNameFc'].touched && !signupForm.controls['lastNameFc'].valid}">
|
||||
[ngClass]="{
|
||||
'is-valid':
|
||||
signupForm.controls['lastNameFc'].touched &&
|
||||
signupForm.controls['lastNameFc'].valid,
|
||||
'is-invalid':
|
||||
signupForm.controls['lastNameFc'].touched &&
|
||||
!signupForm.controls['lastNameFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputlastName">Nom</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="floatingInputfirstName"
|
||||
placeholder=""
|
||||
name="firstName"
|
||||
formControlName="firstNameFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['firstNameFc'].touched && signupForm.controls['firstNameFc'].valid,
|
||||
'is-invalid': signupForm.controls['firstNameFc'].touched && !signupForm.controls['firstNameFc'].valid}">
|
||||
[ngClass]="{
|
||||
'is-valid':
|
||||
signupForm.controls['firstNameFc'].touched &&
|
||||
signupForm.controls['firstNameFc'].valid,
|
||||
'is-invalid':
|
||||
signupForm.controls['firstNameFc'].touched &&
|
||||
!signupForm.controls['firstNameFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputfirstName">Prénom</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="date"
|
||||
<input
|
||||
type="date"
|
||||
class="form-control"
|
||||
id="floatingInputdateNaissance"
|
||||
placeholder=""
|
||||
name="dateNaissance"
|
||||
formControlName="dateNaissanceFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['dateNaissanceFc'].touched && signupForm.controls['dateNaissanceFc'].valid,
|
||||
'is-invalid': signupForm.controls['dateNaissanceFc'].touched && !signupForm.controls['dateNaissanceFc'].valid}">
|
||||
[ngClass]="{
|
||||
'is-valid':
|
||||
signupForm.controls['dateNaissanceFc'].touched &&
|
||||
signupForm.controls['dateNaissanceFc'].valid,
|
||||
'is-invalid':
|
||||
signupForm.controls['dateNaissanceFc'].touched &&
|
||||
!signupForm.controls['dateNaissanceFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputfirstName">Date de naissance</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputteamName"
|
||||
placeholder=""
|
||||
name="teamName"
|
||||
formControlName="teamNameFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['teamNameFc'].touched && signupForm.controls['teamNameFc'].valid,
|
||||
'is-invalid': signupForm.controls['teamNameFc'].touched && !signupForm.controls['teamNameFc'].valid}">
|
||||
<label for="floatingInputfirstName">Ma team</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<select type="text"
|
||||
class="form-control"
|
||||
id="floatingInputprofil"
|
||||
name="profil"
|
||||
formControlName="profilFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['profilFc'].touched && signupForm.controls['profilFc'].valid,
|
||||
'is-invalid': signupForm.controls['profilFc'].touched && !signupForm.controls['profilFc'].valid}">
|
||||
<option>Adulte</option>
|
||||
<option>Enfant</option>
|
||||
</select>
|
||||
<label for="floatingInputfirstName">Profil</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="email"
|
||||
<input
|
||||
type="email"
|
||||
class="form-control"
|
||||
id="floatingInput"
|
||||
placeholder=""
|
||||
name="email"
|
||||
formControlName="emailFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['emailFc'].touched && signupForm.controls['emailFc'].valid,
|
||||
'is-invalid': signupForm.controls['emailFc'].touched && !signupForm.controls['emailFc'].valid}">
|
||||
[ngClass]="{
|
||||
'is-valid':
|
||||
signupForm.controls['emailFc'].touched &&
|
||||
signupForm.controls['emailFc'].valid,
|
||||
'is-invalid':
|
||||
signupForm.controls['emailFc'].touched &&
|
||||
!signupForm.controls['emailFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInput">Adresse email</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="password"
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
id="floatingPassword"
|
||||
placeholder=""
|
||||
name="password"
|
||||
formControlName="passwordFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['passwordFc'].touched && signupForm.controls['passwordFc'].valid,
|
||||
'is-invalid': signupForm.controls['passwordFc'].touched && !signupForm.controls['passwordFc'].valid}">
|
||||
[ngClass]="{
|
||||
'is-valid':
|
||||
signupForm.controls['passwordFc'].touched &&
|
||||
signupForm.controls['passwordFc'].valid,
|
||||
'is-invalid':
|
||||
signupForm.controls['passwordFc'].touched &&
|
||||
!signupForm.controls['passwordFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingPassword">Mot de passe</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="passwordConfirm"
|
||||
<input
|
||||
type="passwordConfirm"
|
||||
class="form-control"
|
||||
id="floatingpasswordConfirm"
|
||||
placeholder=""
|
||||
name="passwordConfirm"
|
||||
formControlName="passwordConfirmFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['passwordConfirmFc'].touched && signupForm.controls['passwordConfirmFc'].valid,
|
||||
'is-invalid': signupForm.controls['passwordConfirmFc'].touched && !signupForm.controls['passwordConfirmFc'].valid}">
|
||||
[ngClass]="{
|
||||
'is-valid':
|
||||
signupForm.controls['passwordConfirmFc'].touched &&
|
||||
signupForm.controls['passwordConfirmFc'].valid,
|
||||
'is-invalid':
|
||||
signupForm.controls['passwordConfirmFc'].touched &&
|
||||
!signupForm.controls['passwordConfirmFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingPassword">Confirmer mot de passe</label>
|
||||
</div>
|
||||
|
||||
<button class="w-100 btn btn-lg btn-success"
|
||||
<button
|
||||
class="w-100 btn btn-lg btn-success"
|
||||
type="submit"
|
||||
[disabled]="signupForm.invalid">Je m'inscris !</button>
|
||||
<p>
|
||||
Value : {{ signupForm.value | json }}
|
||||
</p>
|
||||
<p>
|
||||
Form valid : {{ signupForm.valid }}
|
||||
</p>
|
||||
|
||||
[disabled]="signupForm.invalid"
|
||||
>
|
||||
Je m'inscris !
|
||||
</button>
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
FormGroup,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { Membre } from '../../models/membre';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
|
||||
|
@ -31,8 +31,7 @@ export class PageSignupComponent implements OnInit {
|
|||
firstNameFc: new FormControl('', [Validators.required]),
|
||||
lastNameFc: new FormControl('', [Validators.required]),
|
||||
dateNaissanceFc: new FormControl('', [Validators.required]),
|
||||
teamNameFc: new FormControl('', [Validators.required]),
|
||||
profilFc: new FormControl('', [Validators.required]),
|
||||
roleFc: new FormControl(''),
|
||||
emailFc: new FormControl('', [
|
||||
Validators.email,
|
||||
Validators.required,
|
||||
|
@ -56,29 +55,27 @@ export class PageSignupComponent implements OnInit {
|
|||
public onSubmit(): void {
|
||||
console.log('value : ', this.signupForm.value);
|
||||
console.log('form : ', this.signupForm);
|
||||
const firstNameValue = this.signupForm.value['firstNameFc'];
|
||||
const lastNameValue = this.signupForm.value['lastNameFc'];
|
||||
const prenomValue = this.signupForm.value['firstNameFc'];
|
||||
const nomValue = this.signupForm.value['lastNameFc'];
|
||||
const emailValue = this.signupForm.value['emailFc'];
|
||||
const passwordValue = this.signupForm.value['passwordFc'];
|
||||
const dateNaissanceValue = this.signupForm.value['dateNaissanceFc'];
|
||||
const teamNameValue = this.signupForm.value['teamNameFc'];
|
||||
const profilValue = this.signupForm.value['profilFc'];
|
||||
const passwordConfirmValue = this.signupForm.value['passwordConfirmFc'];
|
||||
const roleValue = ['ROLE_PARENT'];
|
||||
|
||||
const membre: Membre = {
|
||||
firstName: firstNameValue,
|
||||
lastName: lastNameValue,
|
||||
nom: nomValue,
|
||||
prenom: prenomValue,
|
||||
email: emailValue,
|
||||
password: passwordValue,
|
||||
dateNaissance: dateNaissanceValue,
|
||||
teamName: teamNameValue,
|
||||
profil: profilValue,
|
||||
passwordConfirm: passwordConfirmValue,
|
||||
roleList: roleValue,
|
||||
};
|
||||
|
||||
if (membre.email !== '' && membre.password !== '') {
|
||||
this.authService.signup(membre).subscribe((resp) => {
|
||||
this.router.navigate(['account/signin']);
|
||||
this.router.navigate(['accueil']);
|
||||
});
|
||||
} else {
|
||||
// affichage erreur
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { identifierModuleUrl } from '@angular/compiler';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { map, Observable } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Membre } from '../models/membre';
|
||||
import { Team } from '../models/team';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
|
@ -20,9 +22,11 @@ export class AuthService {
|
|||
signup(membre: Membre): Observable<any> {
|
||||
console.log(membre);
|
||||
|
||||
return this.http.post(`${this.apiUrl}/membres/signup`, membre);
|
||||
return this.http.post(`${this.apiUrl}/membres/sign-up`, membre);
|
||||
|
||||
}
|
||||
|
||||
|
||||
signin(email: string, password: string): Observable<any> {
|
||||
const body = {
|
||||
email: email,
|
||||
|
@ -35,7 +39,7 @@ export class AuthService {
|
|||
// - pour pouvoir stocker dans le localstorage notre accesstoken
|
||||
// - Sous la clé "TOKEN-LBP"
|
||||
|
||||
return this.http.post(`${this.apiUrl}/login`, body).pipe(
|
||||
return this.http.post(`${this.apiUrl}/membres/sign-in`, body).pipe(
|
||||
map((x: any) => {
|
||||
console.log('Service : ', x.accessToken);
|
||||
// Modification à faire ici
|
||||
|
@ -45,14 +49,31 @@ export class AuthService {
|
|||
);
|
||||
}
|
||||
|
||||
forgotPassword(email: string, password: string): Observable<any> {
|
||||
forgotPassword(email: string): Observable<any> {
|
||||
const body = {
|
||||
email: email,
|
||||
password: password,
|
||||
};
|
||||
|
||||
console.log('Mon body : ', body);
|
||||
|
||||
return this.http.post(`${this.apiUrl}/forgot-psw`, body);
|
||||
return this.http.post(`${this.apiUrl}/membres/forgot-password`, body);
|
||||
}
|
||||
|
||||
resetPassword(email: string, password: string): Observable<any> {
|
||||
const body = password;
|
||||
console.log(password);
|
||||
return this.http.post(`${this.apiUrl}/membres/reset-password/${email}`, body);
|
||||
}
|
||||
|
||||
creationTeam(team: Team): Observable<any> {
|
||||
console.log(team);
|
||||
|
||||
return this.http.post(`${this.apiUrl}/teams/add`, team);
|
||||
}
|
||||
|
||||
|
||||
|
||||
addMember(membre: Membre): Observable<any> {
|
||||
console.log(membre);
|
||||
|
||||
return this.http.post(`${this.apiUrl}/tableau-de-bord`, membre);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { OrganizeeService } from './organizee.service';
|
||||
|
||||
describe('OrganizeeService', () => {
|
||||
let service: OrganizeeService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(OrganizeeService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,18 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { map, Observable } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class OrganizeeService {
|
||||
apiUrl: string;
|
||||
tokenKey: string;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
// On se sert des variables d'environnement de notre application
|
||||
this.apiUrl = environment.apiUrl;
|
||||
this.tokenKey = environment.tokenKey;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RepertoireService } from './repertoire.service';
|
||||
|
||||
describe('RepertoireService', () => {
|
||||
let service: RepertoireService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(RepertoireService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,37 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { map, Observable } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Contact } from '../models/contact';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class RepertoireService {
|
||||
apiUrl: string;
|
||||
tokenKey: string;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
// On se sert des variables d'environnement de notre application
|
||||
this.apiUrl = environment.apiUrl;
|
||||
this.tokenKey = environment.tokenKey;
|
||||
}
|
||||
|
||||
getContact(): Observable<any> {
|
||||
return this.http.get(`${this.apiUrl}/contacts/team/1`);
|
||||
}
|
||||
|
||||
addContact(contact: Contact): Observable<any> {
|
||||
console.log(contact);
|
||||
|
||||
return this.http.post(`${this.apiUrl}/contacts/add`, contact);
|
||||
}
|
||||
|
||||
deleteContact() {
|
||||
return this.http.delete(`${this.apiUrl}/contacts/delete`);
|
||||
}
|
||||
|
||||
// updateContact(){
|
||||
// return this.http.put(`${this.apiUrl}/contacts/update/1`);
|
||||
// }
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 914 B |
Binary file not shown.
After Width: | Height: | Size: 887 B |
|
@ -4,7 +4,7 @@
|
|||
|
||||
export const environment = {
|
||||
production: false,
|
||||
apiUrl: 'http://localhost:3306',
|
||||
apiUrl: 'http://localhost:8088',
|
||||
tokenKey: 'TOKEN-ORGANIZEE',
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue