diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index ac4db0b..848d613 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -4,6 +4,7 @@ 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 { 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 +31,8 @@ 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: '**', component: PageNotFoundComponent },
];
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 9b55ae7..ccc7884 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -33,6 +33,8 @@ 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';
@NgModule({
declarations: [
@@ -65,6 +67,8 @@ import { HttpClientModule } from '@angular/common/http';
FicheContactComponent,
PaginationComponent,
CreneauComponent,
+ PageAjoutContactComponent,
+ PageModifierContactComponent,
],
imports: [
BrowserModule,
diff --git a/src/app/components/fiche-contact/fiche-contact.component.html b/src/app/components/fiche-contact/fiche-contact.component.html
index 5499a7d..5672e50 100644
--- a/src/app/components/fiche-contact/fiche-contact.component.html
+++ b/src/app/components/fiche-contact/fiche-contact.component.html
@@ -1,18 +1,29 @@
-
-
-
-
-
{{ personne.prenom }} {{ personne.nom }}
-
- {{ personne.telephone }}
-
- {{ personne.email }}
-
- {{ personne.dateNaissance }}
-
- {{ personne.adresse }}
+
+
+
+
+
+
+
+
+
+
+
+
{{ 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 d0f4200..85d641e 100644
--- a/src/app/components/fiche-contact/fiche-contact.component.scss
+++ b/src/app/components/fiche-contact/fiche-contact.component.scss
@@ -2,7 +2,16 @@
color: #fff;
background-color: #5a1e63 !important;
width: 100%;
- max-width: 330px;
+ 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;
+}
diff --git a/src/app/pages/page-ajout-contact/page-ajout-contact.component.html b/src/app/pages/page-ajout-contact/page-ajout-contact.component.html
new file mode 100644
index 0000000..30c5a21
--- /dev/null
+++ b/src/app/pages/page-ajout-contact/page-ajout-contact.component.html
@@ -0,0 +1,82 @@
+
+
\ No newline at end of file
diff --git a/src/app/pages/page-ajout-contact/page-ajout-contact.component.scss b/src/app/pages/page-ajout-contact/page-ajout-contact.component.scss
new file mode 100644
index 0000000..ca7893e
--- /dev/null
+++ b/src/app/pages/page-ajout-contact/page-ajout-contact.component.scss
@@ -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;
+}
diff --git a/src/app/pages/page-ajout-contact/page-ajout-contact.component.spec.ts b/src/app/pages/page-ajout-contact/page-ajout-contact.component.spec.ts
new file mode 100644
index 0000000..5025b7b
--- /dev/null
+++ b/src/app/pages/page-ajout-contact/page-ajout-contact.component.spec.ts
@@ -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
;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ PageAjoutContactComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(PageAjoutContactComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/pages/page-ajout-contact/page-ajout-contact.component.ts b/src/app/pages/page-ajout-contact/page-ajout-contact.component.ts
new file mode 100644
index 0000000..2bb57b1
--- /dev/null
+++ b/src/app/pages/page-ajout-contact/page-ajout-contact.component.ts
@@ -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
+ }
+ }
+}
diff --git a/src/app/pages/page-modifier-contact/page-modifier-contact.component.html b/src/app/pages/page-modifier-contact/page-modifier-contact.component.html
new file mode 100644
index 0000000..f63276c
--- /dev/null
+++ b/src/app/pages/page-modifier-contact/page-modifier-contact.component.html
@@ -0,0 +1 @@
+page-modifier-contact works!
diff --git a/src/app/pages/page-modifier-contact/page-modifier-contact.component.scss b/src/app/pages/page-modifier-contact/page-modifier-contact.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/pages/page-modifier-contact/page-modifier-contact.component.spec.ts b/src/app/pages/page-modifier-contact/page-modifier-contact.component.spec.ts
new file mode 100644
index 0000000..ee8afe0
--- /dev/null
+++ b/src/app/pages/page-modifier-contact/page-modifier-contact.component.spec.ts
@@ -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;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ PageModifierContactComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(PageModifierContactComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/pages/page-modifier-contact/page-modifier-contact.component.ts b/src/app/pages/page-modifier-contact/page-modifier-contact.component.ts
new file mode 100644
index 0000000..b5c46df
--- /dev/null
+++ b/src/app/pages/page-modifier-contact/page-modifier-contact.component.ts
@@ -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 {
+ }
+
+}
diff --git a/src/app/pages/page-repertoire/page-repertoire.component.html b/src/app/pages/page-repertoire/page-repertoire.component.html
index 8919361..662c241 100644
--- a/src/app/pages/page-repertoire/page-repertoire.component.html
+++ b/src/app/pages/page-repertoire/page-repertoire.component.html
@@ -6,7 +6,7 @@
type="submit">Tous les contacts
-
diff --git a/src/app/services/repertoire.service.ts b/src/app/services/repertoire.service.ts
index 2c5c5ec..eb07eda 100644
--- a/src/app/services/repertoire.service.ts
+++ b/src/app/services/repertoire.service.ts
@@ -21,8 +21,17 @@ export class RepertoireService {
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
+ addContact(contact: Contact): Observable {
+ 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`);
+ // }
}