Merge pull request #3 from AlineRinquin/aline

mise en place du html et lien vers le back de repertoire
This commit is contained in:
AlineRinquin 2022-01-21 09:42:59 +01:00 committed by GitHub
commit 7ec0e3a7f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 221 additions and 14 deletions

View File

@ -1 +1,18 @@
<p>fiche-contact works!</p> <div>
<button class="w-100 btn btn-lg btn-rounded btn-secondary">
Modifier
</button>
<button class="w-100 btn btn-lg btn-rounded btn-secondary">
Supprimer
</button>
<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>

View File

@ -0,0 +1,8 @@
.btn-secondary {
color: #fff;
background-color: #5a1e63 !important;
width: 100%;
max-width: 330px;
padding: 15px;
margin: auto;
}

View File

@ -1,15 +1,14 @@
import { Component, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
@Component({ @Component({
selector: 'app-fiche-contact', selector: 'app-fiche-contact',
templateUrl: './fiche-contact.component.html', templateUrl: './fiche-contact.component.html',
styleUrls: ['./fiche-contact.component.scss'] styleUrls: ['./fiche-contact.component.scss'],
}) })
export class FicheContactComponent implements OnInit { export class FicheContactComponent implements OnInit {
@Input() personne: any;
constructor() { } constructor() {}
ngOnInit(): void {
}
ngOnInit(): void {}
} }

View File

@ -0,0 +1,8 @@
export interface Contact {
nom: string;
prenom: string;
telephone: string;
email: string;
adresse: string;
dateNaissance: Date;
}

10
src/app/models/menu.ts Normal file
View File

@ -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;
}

View File

@ -0,0 +1,7 @@
import { Team } from './team';
export interface ToDoList {
nom: string;
team: Team;
tache: string;
}

View File

@ -1,2 +1,32 @@
<app-header></app-header> <app-header></app-header>
<app-side-bar></app-side-bar> <app-side-bar></app-side-bar>
<div>
<button class="w-100 btn btn-lg btn-secondary "
type="submit">Tous les contacts
</button>
<button 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">
<!--<button class="btn btn-secondary" type="button">Rechercher</button>-->
</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>

View File

@ -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;
}

View File

@ -1,15 +1,50 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { RepertoireService } from 'src/app/services/repertoire.service';
@Component({ @Component({
selector: 'app-page-repertoire', selector: 'app-page-repertoire',
templateUrl: './page-repertoire.component.html', templateUrl: './page-repertoire.component.html',
styleUrls: ['./page-repertoire.component.scss'] styleUrls: ['./page-repertoire.component.scss'],
}) })
export class PageRepertoireComponent implements OnInit { export class PageRepertoireComponent implements OnInit {
public listContact: any[];
public listFull: any[];
keyword: any;
openDetails: any;
constructor() { } constructor(private repertoireService: RepertoireService) {
this.listContact = [];
ngOnInit(): void { 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;
}
} }

View File

@ -20,7 +20,7 @@ export class AuthService {
signup(membre: Membre): Observable<any> { signup(membre: Membre): Observable<any> {
console.log(membre); console.log(membre);
return this.http.post(`${this.apiUrl}/creation-compte`, membre); return this.http.post(`${this.apiUrl}/membres/sign-up`, membre);
} }
signin(email: string, password: string): Observable<any> { signin(email: string, password: string): Observable<any> {

View File

@ -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();
});
});

View File

@ -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;
}
}

View File

@ -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();
});
});

View File

@ -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<any> {
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
}

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

BIN
src/assets/images/phone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

View File

@ -4,7 +4,7 @@
export const environment = { export const environment = {
production: false, production: false,
apiUrl: 'http://localhost:3306', apiUrl: 'http://localhost:8088',
tokenKey: 'TOKEN-ORGANIZEE', tokenKey: 'TOKEN-ORGANIZEE',
}; };