diff --git a/README.md b/README.md index 07be01d..3ffd157 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ This project was generated with [Angular CLI](https://github.com/angular/angular ## Development server +Run npm install + Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. ## Code scaffolding diff --git a/src/app/components/fiche-contact/fiche-contact.component.html b/src/app/components/fiche-contact/fiche-contact.component.html index 6c65a73..5499a7d 100644 --- a/src/app/components/fiche-contact/fiche-contact.component.html +++ b/src/app/components/fiche-contact/fiche-contact.component.html @@ -1 +1,18 @@ -

fiche-contact works!

+
+ + + +

{{ personne.prenom }} {{ personne.nom }}

+

+ {{ personne.telephone }}

+

+ {{ personne.email }}

+

+ {{ personne.dateNaissance }}

+

+ {{ personne.adresse }}

+
diff --git a/src/app/components/fiche-contact/fiche-contact.component.scss b/src/app/components/fiche-contact/fiche-contact.component.scss index e69de29..d0f4200 100644 --- a/src/app/components/fiche-contact/fiche-contact.component.scss +++ b/src/app/components/fiche-contact/fiche-contact.component.scss @@ -0,0 +1,8 @@ +.btn-secondary { + color: #fff; + background-color: #5a1e63 !important; + width: 100%; + max-width: 330px; + padding: 15px; + margin: auto; +} diff --git a/src/app/components/fiche-contact/fiche-contact.component.ts b/src/app/components/fiche-contact/fiche-contact.component.ts index 7496ca9..25ae576 100644 --- a/src/app/components/fiche-contact/fiche-contact.component.ts +++ b/src/app/components/fiche-contact/fiche-contact.component.ts @@ -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 {} } diff --git a/src/app/models/contact.ts b/src/app/models/contact.ts new file mode 100644 index 0000000..2c632a4 --- /dev/null +++ b/src/app/models/contact.ts @@ -0,0 +1,8 @@ +export interface Contact { + nom: string; + prenom: string; + telephone: string; + email: string; + adresse: string; + dateNaissance: Date; +} diff --git a/src/app/models/menu.ts b/src/app/models/menu.ts new file mode 100644 index 0000000..990f122 --- /dev/null +++ b/src/app/models/menu.ts @@ -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; +} diff --git a/src/app/models/to-do-list.ts b/src/app/models/to-do-list.ts new file mode 100644 index 0000000..48fba0f --- /dev/null +++ b/src/app/models/to-do-list.ts @@ -0,0 +1,7 @@ +import { Team } from './team'; + +export interface ToDoList { + nom: string; + team: Team; + tache: string; +} diff --git a/src/app/pages/page-add-member/page-add-member.component.html b/src/app/pages/page-add-member/page-add-member.component.html index e91fa55..8614282 100644 --- a/src/app/pages/page-add-member/page-add-member.component.html +++ b/src/app/pages/page-add-member/page-add-member.component.html @@ -1 +1,109 @@ + +
+
+
+

J'inscris un nouveau membre

+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +

+ Value : {{ addMemberForm.value | json }} +

+

+ Form valid : {{ addMemberForm.valid }} +

+ +
+
diff --git a/src/app/pages/page-add-member/page-add-member.component.scss b/src/app/pages/page-add-member/page-add-member.component.scss index e69de29..333e617 100644 --- a/src/app/pages/page-add-member/page-add-member.component.scss +++ b/src/app/pages/page-add-member/page-add-member.component.scss @@ -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; +} diff --git a/src/app/pages/page-add-member/page-add-member.component.ts b/src/app/pages/page-add-member/page-add-member.component.ts index a77f630..426a262 100644 --- a/src/app/pages/page-add-member/page-add-member.component.ts +++ b/src/app/pages/page-add-member/page-add-member.component.ts @@ -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,92 @@ 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, + profil: profilValue, + 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); + } + }; + } } diff --git a/src/app/pages/page-repertoire/page-repertoire.component.html b/src/app/pages/page-repertoire/page-repertoire.component.html index 2d3d7d1..8919361 100644 --- a/src/app/pages/page-repertoire/page-repertoire.component.html +++ b/src/app/pages/page-repertoire/page-repertoire.component.html @@ -1,2 +1,32 @@ - \ No newline at end of file + + +
+ + + + +
+ + +
+ +
+
+ +
+ +

{{ personne.prenom }} {{ personne.nom }}

+
+
+ +
diff --git a/src/app/pages/page-repertoire/page-repertoire.component.scss b/src/app/pages/page-repertoire/page-repertoire.component.scss index e69de29..6634178 100644 --- a/src/app/pages/page-repertoire/page-repertoire.component.scss +++ b/src/app/pages/page-repertoire/page-repertoire.component.scss @@ -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; +} diff --git a/src/app/pages/page-repertoire/page-repertoire.component.ts b/src/app/pages/page-repertoire/page-repertoire.component.ts index 5e2707e..c4fff1b 100644 --- a/src/app/pages/page-repertoire/page-repertoire.component.ts +++ b/src/app/pages/page-repertoire/page-repertoire.component.ts @@ -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; + } } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index debe9a4..13732dd 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -58,6 +58,7 @@ export class AuthService { return this.http.post(`${this.apiUrl}/forgot-psw`, body); } + creationTeam(team: Team): Observable { console.log(team); @@ -65,6 +66,7 @@ export class AuthService { } + addMember(membre: Membre): Observable { console.log(membre); diff --git a/src/app/services/organizee.service.spec.ts b/src/app/services/organizee.service.spec.ts new file mode 100644 index 0000000..6148a1d --- /dev/null +++ b/src/app/services/organizee.service.spec.ts @@ -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(); + }); +}); diff --git a/src/app/services/organizee.service.ts b/src/app/services/organizee.service.ts new file mode 100644 index 0000000..3e88f65 --- /dev/null +++ b/src/app/services/organizee.service.ts @@ -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; + } +} diff --git a/src/app/services/repertoire.service.spec.ts b/src/app/services/repertoire.service.spec.ts new file mode 100644 index 0000000..bc77b79 --- /dev/null +++ b/src/app/services/repertoire.service.spec.ts @@ -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(); + }); +}); diff --git a/src/app/services/repertoire.service.ts b/src/app/services/repertoire.service.ts new file mode 100644 index 0000000..2c5c5ec --- /dev/null +++ b/src/app/services/repertoire.service.ts @@ -0,0 +1,28 @@ +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 { + return this.http.get(`${this.apiUrl}/contacts/team/1`); + } + + //sur le component fiche contact de la page repertoire + // sur clic de btn modifier ou supproimer ca renvois vers page modifier contact + //page modifier contact faire un get by id du contact en question + // appeler methode/ update /delette/ add et contact by id +} diff --git a/src/assets/images/adresse.jpg b/src/assets/images/adresse.jpg new file mode 100644 index 0000000..deca31c Binary files /dev/null and b/src/assets/images/adresse.jpg differ diff --git a/src/assets/images/contact-1.png b/src/assets/images/contact-1.png new file mode 100644 index 0000000..cf254af Binary files /dev/null and b/src/assets/images/contact-1.png differ diff --git a/src/assets/images/gateau.png b/src/assets/images/gateau.png new file mode 100644 index 0000000..b97d3b3 Binary files /dev/null and b/src/assets/images/gateau.png differ diff --git a/src/assets/images/logo-gmail.png b/src/assets/images/logo-gmail.png new file mode 100644 index 0000000..1b91717 Binary files /dev/null and b/src/assets/images/logo-gmail.png differ diff --git a/src/assets/images/phone.png b/src/assets/images/phone.png new file mode 100644 index 0000000..2d41a02 Binary files /dev/null and b/src/assets/images/phone.png differ