-
+
+
+
-
+
-
-
-
-
-
{{ personne.prenom }} {{ personne.nom }}
-
-
-
-
+
\ No newline at end of file
diff --git a/src/app/pages/page-repertoire/page-repertoire.component.scss b/src/app/pages/page-repertoire/page-repertoire.component.scss
index 6634178..efd2ffb 100644
--- a/src/app/pages/page-repertoire/page-repertoire.component.scss
+++ b/src/app/pages/page-repertoire/page-repertoire.component.scss
@@ -7,9 +7,16 @@
margin: auto;
}
-.input-group mb-3 {
- width: 100%;
+.input-group.mb-3 {
+ width: 50%;
max-width: 330px;
padding: 15px;
margin: auto;
+ display: flex;
+ flex-direction: row;
}
+
+;h4 {
+ color: black;
+ font-weight: bold;
+}
\ No newline at end of file
diff --git a/src/app/pages/page-repertoire/page-repertoire.component.ts b/src/app/pages/page-repertoire/page-repertoire.component.ts
index 99e0f66..b147389 100644
--- a/src/app/pages/page-repertoire/page-repertoire.component.ts
+++ b/src/app/pages/page-repertoire/page-repertoire.component.ts
@@ -33,16 +33,6 @@ export class PageRepertoireComponent implements OnInit {
this.listContact = listContact;
this.listFull = listContact;
});
-
- this.personneid = this.route.snapshot.paramMap.get('id');
- console.log(this.personneid);
-
- this.repertoireService
- .getContactById(this.personneid)
- .subscribe((listContactInfo: any) => {
- console.log(listContactInfo);
- this.listContactInfo = listContactInfo;
- });
}
// Méthode pour récuper ce qui est saisi dans l'input
@@ -63,15 +53,20 @@ export class PageRepertoireComponent implements OnInit {
this.listContact = prenom;
}
- // Méthode qui au click va ouvrir les détails d'un contat
+ // Méthode qui au click va ouvrir les détails d'un contact
onClick(personne: any) {
console.log(personne);
this.openDetails = personne;
}
-
- onClickDelete(contact: Contact){
- this.repertoireService.deleteContact(contact).subscribe((resp) => {
+ // Méthode qui au click va supprimer un contact
+ onClickDelete(contactId: number){
+ this.repertoireService.deleteContact(contactId).subscribe((resp) => {
+ if(contactId) {
+ this.listContact.forEach(contactId => console.log(contactId))
+ }else{
+ window.alert("Le contact ne peut pas être supprimé!")
+ }
this.router.navigate(['repertoire/']);
});
}
diff --git a/src/app/pages/page-to-do-list/page-to-do-list.component.html b/src/app/pages/page-to-do-list/page-to-do-list.component.html
index 9eed39a..f58dc34 100644
--- a/src/app/pages/page-to-do-list/page-to-do-list.component.html
+++ b/src/app/pages/page-to-do-list/page-to-do-list.component.html
@@ -1,5 +1,9 @@
-
-
+
diff --git a/src/app/pages/page-to-do-list/page-to-do-list.component.ts b/src/app/pages/page-to-do-list/page-to-do-list.component.ts
index c7240b0..81ebd86 100644
--- a/src/app/pages/page-to-do-list/page-to-do-list.component.ts
+++ b/src/app/pages/page-to-do-list/page-to-do-list.component.ts
@@ -1,4 +1,7 @@
import { Component, OnInit } from '@angular/core';
+import { TodoService } from 'src/app/services/todo.service';
+
+
@Component({
selector: 'app-page-to-do-list',
@@ -6,10 +9,18 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./page-to-do-list.component.scss']
})
export class PageToDoListComponent implements OnInit {
+ public result : any;
- constructor() { }
+ constructor(private TodoService : TodoService) { }
ngOnInit(): void {
+ this.TodoService.getToDoListByTeamId().subscribe((data :any)=>{
+
+ this.result = data;
+ console.log(data);
+ });
+
+
}
}
diff --git a/src/app/services/repertoire.service.ts b/src/app/services/repertoire.service.ts
index a452854..8c85751 100644
--- a/src/app/services/repertoire.service.ts
+++ b/src/app/services/repertoire.service.ts
@@ -3,6 +3,8 @@ import { HttpClient } from '@angular/common/http';
import { map, Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Contact } from '../models/contact';
+import { Router } from '@angular/router';
+import { TokenService } from './token.service';
@Injectable({
providedIn: 'root',
@@ -11,14 +13,15 @@ export class RepertoireService {
apiUrl: string;
tokenKey: string;
- constructor(private http: HttpClient) {
+ constructor(private http: HttpClient, private router: Router, private tokenService: TokenService) {
// 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`);
+ const teamId = this.tokenService.getCurrentTeamId()
+ return this.http.get(`${this.apiUrl}/contacts/team/${teamId}`);
}
getContactById(id: any): Observable {
@@ -26,16 +29,15 @@ export class RepertoireService {
}
addContact(contact: Contact): Observable {
- console.log(contact);
-
+ const teamId = this.tokenService.getCurrentTeamId()
return this.http.post(`${this.apiUrl}/contacts/add`, contact);
}
- deleteContact(contact: Contact): Observable {
- return this.http.delete(`${this.apiUrl}/contacts/delete/1`);
+ deleteContact(contactId: number): Observable {
+ return this.http.delete(`${this.apiUrl}/contacts/delete/${contactId}`);
}
updateContact(contact: Contact): Observable {
- return this.http.put(`${this.apiUrl}/contacts/update/1`, contact);
+ return this.http.put(`${this.apiUrl}/contacts/update/`, contact);
}
}
diff --git a/src/app/services/todo-service.service.ts b/src/app/services/todo-service.service.ts
deleted file mode 100644
index e0d597a..0000000
--- a/src/app/services/todo-service.service.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-import { environment } from 'src/environments/environment';
-
-@Injectable({
- providedIn: 'root'
-})
-export class TodoServiceService {
- private toDoList: any;
- private apiUrl: string;
-
-
- constructor(private http: HttpClient) {
- this.apiUrl = environment.apiUrl;
- }
-
- //consulter toDoList
- getToDoList(){
- this.toDoList = this.http.get(`${this.apiUrl}/todolist/team/{team_id}`);
- return this.toDoList;
- console.log(this.toDoList)
-}
-
-//ajouter une tache
- addTitle(title:string){
- this.toDoList.push({
- title:title,
- isChecked: false
- });
- }
-// cocher et décocher la checkbox
- checkOrUnCheckTitle($key: string,flag: boolean){
- this.toDoList.update($key,{isChecked:flag});
- }
-
-//supprimer la tache
-removeTitle($key : string){
- this.toDoList.remove($key);
-}
-
-
-
-}
diff --git a/src/app/services/todo.service.spec.ts b/src/app/services/todo.service.spec.ts
new file mode 100644
index 0000000..41eb649
--- /dev/null
+++ b/src/app/services/todo.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { TodoService } from './todo.service';
+
+describe('TodoService', () => {
+ let service: TodoService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(TodoService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/services/todo.service.ts b/src/app/services/todo.service.ts
new file mode 100644
index 0000000..d6adca3
--- /dev/null
+++ b/src/app/services/todo.service.ts
@@ -0,0 +1,31 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { Observable } from 'rxjs';
+import { environment } from 'src/environments/environment';
+import { Tache } from '../models/tache';
+import { ToDoList } from '../models/to-do-list';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class TodoService {
+ private toDoList: any;
+ private apiUrl: string;
+
+ constructor(private http: HttpClient) {
+ this.apiUrl = environment.apiUrl;
+ }
+
+ getToDoListByTeamId(): Observable {
+ return this.http.get(`${this.apiUrl}/todolist/team/1`);
+ }
+
+ deleteTacheById(idTache: any): Observable {
+ return this.http.delete(`${this.apiUrl}/taches/delete/${idTache}`,{responseType:'text'});
+ }
+
+ addTache(newtache: Tache,idTodoList:number): Observable {
+ console.log(newtache +'gkggg');
+ return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache);
+ }
+}
diff --git a/src/app/todo-list.ts b/src/app/todo-list.ts
new file mode 100644
index 0000000..f99121f
--- /dev/null
+++ b/src/app/todo-list.ts
@@ -0,0 +1,2 @@
+export interface TodoList {
+}