Merge branch 'dev' into cecile

This commit is contained in:
AlineRinquin 2022-02-18 10:39:22 +01:00 committed by GitHub
commit 6504d28c4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
82 changed files with 3557 additions and 2862 deletions

4500
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@
"@angular/router": "~13.0.0",
"@ng-bootstrap/ng-bootstrap": "^12.0.0",
"bootstrap": "^5.1.3",
"bootstrap-icons": "^1.8.1",
"jwt-decode": "^3.1.2",
"ngx-autofocus-fix": "^1.0.4",
"rxjs": "~7.4.0",

View File

@ -7,6 +7,7 @@ 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 { PageDeleteAccountComponent } from './pages/page-delete-account/page-delete-account.component';
import { PageDeleteMemberComponent } from './pages/page-delete-member/page-delete-member.component';
import { PageForgotPasswordComponent } from './pages/page-forgot-password/page-forgot-password.component';
import { PageMenuSemaineComponent } from './pages/page-menu-semaine/page-menu-semaine.component';
@ -17,6 +18,7 @@ import { PageRepertoireComponent } from './pages/page-repertoire/page-repertoire
import { PageResetPasswordComponent } from './pages/page-reset-password/page-reset-password.component';
import { PageSignupComponent } from './pages/page-signup/page-signup.component';
import { PageToDoListComponent } from './pages/page-to-do-list/page-to-do-list.component';
import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component';
import { PageUpdateMemberComponent } from './pages/page-update-member/page-update-member.component';
import { FooterComponent } from './components/footer/footer.component';
@ -29,6 +31,7 @@ const routes: Routes = [
{ path: 'agenda', component: PageAgendaComponent },
{ path: 'tableau-de-bord', component: PageDashboardComponent },
{ path: 'supprimer-membre', component: PageDeleteMemberComponent },
{ path: 'supprimer-compte', component: PageDeleteAccountComponent },
{ path: 'password-oublie', component: PageForgotPasswordComponent },
{ path: 'menu', component: PageMenuSemaineComponent },
{ path: 'repertoire', component: PageRepertoireComponent },
@ -36,6 +39,7 @@ const routes: Routes = [
{ path: 'creation-compte', component: PageSignupComponent },
{ path: 'to-do-list', component: PageToDoListComponent },
{ path: 'modifier-membre', component: PageUpdateMemberComponent },
{ path: 'modifier-compte', component: PageUpdateAccountComponent },
{ path: 'ajouter-contact', component: PageAjoutContactComponent },
{ path: 'creation-team', component: PageCreationTeamComponent },
{ path: 'humeur', component: PageHumeurComponent },

View File

@ -22,7 +22,6 @@ import { SigninComponent } from './components/signin/signin.component';
import { PageDashboardComponent } from './pages/page-dashboard/page-dashboard.component';
import { MeteoComponent } from './components/meteo/meteo.component';
import { CalendrierComponent } from './components/calendrier/calendrier.component';
import { AvatarComponent } from './components/avatar/avatar.component';
import { CardMemberComponent } from './components/card-member/card-member.component';
import { ToDoListComponent } from './components/to-do-list/to-do-list.component';
import { TacheComponent } from './components/tache/tache.component';
@ -31,13 +30,16 @@ import { FicheContactComponent } from './components/fiche-contact/fiche-contact.
import { PaginationComponent } from './components/pagination/pagination.component';
import { CreneauComponent } from './components/creneau/creneau.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { HttpClientModule, HTTP_INTERCEPTORS } 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';
import { AutofocusFixModule } from 'ngx-autofocus-fix';
import { PageHumeurComponent } from './pages/page-humeur/page-humeur.component';
import { FooterComponent } from './components/footer/footer.component';
import { PageDeleteAccountComponent } from './pages/page-delete-account/page-delete-account.component';
import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component';
import { EmoticonComponent } from './emoticon/emoticon.component';
@ -64,7 +66,6 @@ import { FooterComponent } from './components/footer/footer.component';
MeteoComponent,
PageHumeurComponent,
CalendrierComponent,
AvatarComponent,
CardMemberComponent,
ToDoListComponent,
TacheComponent,
@ -77,6 +78,9 @@ import { FooterComponent } from './components/footer/footer.component';
PageCreationTeamComponent,
PageHumeurComponent,
FooterComponent,
PageDeleteAccountComponent,
PageUpdateAccountComponent,
EmoticonComponent,
],
imports: [
BrowserModule,
@ -86,7 +90,9 @@ import { FooterComponent } from './components/footer/footer.component';
FormsModule,
// AutofocusFixModule.forRoot(),
],
providers: [],
providers: [
],
bootstrap: [AppComponent],
})
export class AppModule {}

View File

@ -1 +0,0 @@
<p>avatar works!</p>

View File

@ -1,15 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-avatar',
templateUrl: './avatar.component.html',
styleUrls: ['./avatar.component.scss']
})
export class AvatarComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -1 +1,23 @@
<p>card-member works!</p>
<div class="container mt-5 membre">
<div class="row d-flex justify-content-center">
<div class="col-md-auto">
<div class="card p-3 py-4 align-items">
<!-- récuperer couleur du back-->
<div class="text-center"><div class="rounded-circle"id="couleur"[style.background-color]="membre.couleur"></div></div>
<div class="text-center mt-3">
<h3 class="mt-2 mb-0">{{membre.prenom }} {{membre.nom }}</h3>
<div class="buttons text-center"><button button type="button" class="btn btn-outline-primary px-4"
routerLink="../modifier-membre"
routerLinkActive="active-custom">
Modifier
</button><button button type="button" class="btn btn-primary px-4"
routerLink="../supprimer-membre"
routerLinkActive="active-custom">
Supprimer
</button>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,56 @@
#couleur{
width: 100px;
height: 100px;
margin: 0 auto;
background: black;
}
.card {
min-height: 22rem;
border: none;
position: relative;
overflow: hidden;
border-radius: 8px;
cursor: pointer
}
.fonts {
font-size: 11px
}
.buttons button:nth-child(1) {
margin-top: 5px;
border: 1px solid #7879F1 !important;
color: #7879F1;
height: 40px;
width: 150px;
}
.buttons button:nth-child(1):hover {
margin-top: 5px;
border: 1px solid #7879F1 !important;
color: #fff;
height: 40px;
width: 150px;
background-color: #7879F1
}
.buttons button:nth-child(2) {
margin-top: 5px;
border: 1px solid #7879F1 !important;
background-color: #7879F1;
color: #fff;
height: 40px;
width: 150px;
}
.buttons button:nth-child(2):hover {
margin-top: 5px;
border: 1px solid #bd4646 !important;
background-color: #bd4646;
color: #fff;
height: 40px;
width: 150px;
}

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
@Component({
selector: 'app-card-member',
@ -6,10 +6,12 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./card-member.component.scss']
})
export class CardMemberComponent implements OnInit {
@Input() membre: any;
constructor() { }
ngOnInit(): void {
}
}

View File

@ -1 +1,46 @@
<p>card-menu works!</p>
<div class="menu">
<div *ngFor="let menu of listMenus">
<p>{{ menu.dateMenu }} {{ menu.libelle }}</p>
</div>
<ng-template #content let-modal>
<div class="modal-header">
<h4 class="modal-title" id="modal-basic-title">
Ajouter un menu
</h4>
<button type="button" class="close" aria-label="Close" (click)="modal.dismiss('Cross click')">
<span aria-hidden="true">
×
</span>
</button>
</div>
<div class="modal-body">
<form [formGroup]="menuForm">
<div class="form-group">
<label for="dateMenu">
Date
</label>
<div class="input-group">
<input id="dateMenu" class="form-control" formControlName="dateMenuFc" placeholder="yyyy-mm-dd" name="date"
>
<input id="libelle" class="form-control" formControlName="libelleFc" placeholder="" name="libelle"
>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-dark" (click)="modal.close(saveMenu())">
Save
</button>
</div>
</ng-template>
<button class="btn btn-lg btn-outline-primary" (click)="open(content)">
Ajouter un menu
</button>
</div>

View File

@ -0,0 +1,3 @@
.menu {
margin-left: 500px;
}

View File

@ -1,4 +1,16 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Menu } from 'src/app/models/menu';
import { MenusService } from 'src/app/services/menus.service';
import {NgbModal, ModalDismissReasons} from '@ng-bootstrap/ng-bootstrap';
import {
FormBuilder,
FormControl,
FormGroup,
Validators,
} from '@angular/forms';
@Component({
selector: 'app-card-menu',
@ -6,10 +18,92 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./card-menu.component.scss']
})
export class CardMenuComponent implements OnInit {
closeResult = '';
public listMenus:any[];
public menuId : any;
public menuForm : FormGroup;
constructor(
private menusService: MenusService,
private router: Router,
private route: ActivatedRoute,
private modalService: NgbModal,
private fb: FormBuilder
) {
this.listMenus=[];
this.menuId=0;
this.menuForm = new FormGroup({});
}
//ajout d'un menu
saveMenu(): void {
const dateValue = this.menuForm.value['dateMenuFc'];
const libelleValue = this.menuForm.value['libelleFc'];
const menu: Menu = {
dateMenu: dateValue,
libelle: libelleValue,
};
// if (menu.dateMenu != undefined && menu.libelle != '') {
console.log(dateValue);
this.menusService.addMenu(menu)?.subscribe((resp) => {
this.router.navigate(['menu']);
});
// } else {
// this.router.navigate(['menu']);
// }
}
constructor() { }
ngOnInit(): void {
//affichage des menus d'une team
this.menusService.getMenu()?.subscribe((listMenus: any[])=>{
console.log(listMenus);
this.listMenus=listMenus;
});
this.menuForm = this.fb.group(
{
dateMenuFc: new FormControl('',[Validators.required]),
libelleFc: new FormControl('',[Validators.required]),
}
);
}
open(content: any) {
this.modalService.open(content,
{ariaLabelledBy: 'menu'}).result.then((result)=> {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
this.closeResult =
`Dismissed ${this.getDismissReason(reason)}`;
});
}
private getDismissReason(reason: any): string {
if (reason === ModalDismissReasons.ESC) {
return 'by pressing ESC';
} else if (reason === ModalDismissReasons.BACKDROP_CLICK) {
return 'by clicking on a backdrop';
} else {
return `with: ${reason}`;
}
}
}
//modif d'un menu
// this.menuId=this.route.snapshot.paramMap.get('id');
// this.menusService.getMenuById(this.menuId)
// .subscribe((this.listMenus:any)=>)
//delete d'un menu

View File

@ -1,29 +1,43 @@
<div class="container">
<div class="row">
<div class="col-sm">
<button routerLink="../modifier-contact/{{personne.id}}" 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 class="row d-flex justify-content-end align-items-center flex-row">
<div class="couleur col-7" [style.background-color]="personne.couleur"></div>
<div class="col-5">
<div class="col">
<button routerLink="../modifier-contact/{{personne.id}}"
class=" btn btn-sm btn-rounded btn-secondary mb-2">
Modifier
</button>
</div>
<div class="col">
<button class=" btn btn-sm btn-rounded btn-secondary" (click)="onClickDelete(personne.id)">
Supprimer
</button>
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-md-12">
<div class="row my-3 d-flex justify-content-center flex-row">
<span class="fiche-contact col-7">{{ personne.prenom }} {{ personne.nom }} </span>
</div>
<div class="row my-3 d-flex justify-content-center flex-row">
<span i class="col-4 bi bi-telephone-inbound"></span>
<span class="fiche-contact col-7">{{ personne.telephone }}</span>
</div>
<div class="row my-3 d-flex justify-content-center flex-row">
<i class="col-4 bi bi-envelope"></i>
<span class="fiche-contact col-7">{{ personne.email }}</span>
</div>
<div class="row my-3 d-flex justify-content-center flex-row">
<i class="col-4 bi bi-calendar-heart"></i>
<span class="fiche-contact col-7">{{ personne.dateNaissance }}</span>
</div>
<div class="row my-3 d-flex justify-content-center flex-row">
<i class="col-4 bi bi-map"></i>
<span class="fiche-contact col-7">{{ personne.adresse }}</span>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,10 +1,26 @@
.btn-secondary {
color: #fff;
background-color: #5a1e63 !important;
width: 100%;
max-width: 150px;
padding: 15px;
margin: auto;
min-width: 100px;
border-radius: 55px;
}
.couleur{
border: none;
border-radius: 50%;
width: 110px;
height: 110px;
}
.info{
display:flex;
justify-content: center;
}
.fiche-contact{
display:flex;
justify-content: center;
flex-direction: row;
}
.container {

View File

@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
@Component({
selector: 'app-fiche-contact',
@ -7,8 +7,14 @@ import { Component, Input, OnInit } from '@angular/core';
})
export class FicheContactComponent implements OnInit {
@Input() personne: any;
@Output() clickDelete = new EventEmitter();
constructor() {}
ngOnInit(): void {}
onClickDelete(numPerson: number){
window.alert("Le contact à bien été supprimé!")
this.clickDelete.emit(numPerson);
}
}

View File

@ -1,7 +1,4 @@
<div class="meteo">
<input type="text" id="ville">
<label for="ville">Entrez votre code postal</label>
<button id="meteo-button">Ok !</button>
<iframe id="widget_autocomplete_preview" width="150" height="300" frameborder="0"
<iframe id="widget_autocomplete_preview" width="400" height="150" frameborder="1" border-radius="5"
src="https://meteofrance.com/widget/prevision/751010"> </iframe>
</div>

View File

@ -1,11 +1,29 @@
<nav class="custom-side-bar flex-shrink-0 bg-white border-end">
<div id="navbarNavAltMarkup">
<div class="navbar-nav">
<a routerLink="../compte" routerLinkActive="active-custom" class="nav-link">Ma Team</a>
<a routerLink="../repertoire" routerLinkActive="active-custom" class="nav-link">Répertoire</a>
<a routerLink="../to-do-list" routerLinkActive="active-custom" class="nav-link">To-Do-List</a>
<a routerLink="../menu" routerLinkActive="active-custom" class="nav-link">Menus</a>
</div>
</div>
<nav class="wrapper md-auto position-fixed ">
<ul class="nav flex-column" id="sticky-sidebar">
<li class="nav-item" ngbNavItem="maTeam" >
<a routerLink="../compte" routerLinkActive="active-custom" class="nav-link">
<i class="bi bi-people-fill"></i>
Ma Team</a>
</li>
<li class="nav-item">
<a routerLink="/repertoire" routerLinkActive="active-custom" class="nav-link">
<i class="bi bi-person-rolodex"></i>
Répertoire</a>
</li>
<li class="nav-item">
<a routerLink="../to-do-list" routerLinkActive="active-custom" class="nav-link">
<i class="bi bi-check2-square"></i>
To-Do-List</a>
</li>
<li class="nav-item">
<a routerLink="../menu" routerLinkActive="active-custom" class="nav-link">
<i class='fas fa-pizza-slice'></i>
Menus</a>
</li>
<li class="nav-item">
<a routerLink="../agenda" routerLinkActive="active-custom" class="nav-link">
<i class="bi bi-calendar-event"></i>
Agenda</a>
</li>
</ul>
</nav>

View File

@ -0,0 +1,23 @@
.wrapper {
display: flex;
flex-direction: column;
align-items: left;
width: auto;
height: 100%;
position: absolute;
background-color: rgb(238, 238, 238);
}
.nav{
margin-top: 20px;
align-items: left;
}
li {
margin-bottom: 5px;
}
a{
color: black;
font-weight: bold;
}

View File

@ -1,40 +1,55 @@
<input
type="text"
class="todo-title"
placeholder="Titre"
value = "{{todo.nom}}"
/>
<div>
<button (click)="effacerList()">Effacer la To Do List</button>
</div>
<input
type="text"
class="todo-input"
placeholder="Ajoute une nouvelle Tâche"
placeholder="+ Nouvelle Tâche"
[(ngModel)]="todoTitle"
(keyup.enter)="addTitle()"
(keyup.enter)="addTache(todo.id)"
/>
<div class="element" *ngFor="let todo of todosFilter()">
<div class="element" *ngFor="let tache of todo.taches">
<div class="element-gauche">
<input
type="checkbox"
[(ngModel)]="todo.completed"
(change)="doneEdit(todo)"
[(ngModel)]="tache.etat"
(change)="doneEdit(tache)"
checked="checked"
/>
<div
*ngIf="!todo.editing; else editingTodo"
*ngIf="!tache.editing; else editingTodo"
class="nomTache"
[ngClass]="{ completed: todo.completed }"
(dblclick)="modifier(todo)"
[ngClass]="{ completed: tache.etat }"
(dblclick)="modifier(tache)"
>
{{ todo.title }}
{{ tache.texte }}
</div>
<ng-template #editingTodo>
<input
type="text"
class="modifier-element"
[(ngModel)]="todo.title"
(blur)="doneEdit(todo)"
(keyup.enter)="doneEdit(todo)"
(keyup.esc)="cancelEdit(todo)"
[(ngModel)]="tache.texte"
(blur)="doneEdit(tache)"
(keyup.enter)="doneEdit(tache)"
(keyup.esc)="cancelEdit(tache)"
autofocus
/>
</ng-template>
</div>
<div class="deleteTache" (click)="deleteTodo(todo.id)">&times;</div>
<div class="deleteTache" (click)="deleteTodo(tache.id)">&times;</div>
</div>
<div class="extra-container">
<div>
<label
@ -48,7 +63,7 @@
<div>{{ toDoRest() }} tâches</div>
</div>
<div class="extra-container">
<div>
<!-- <div>
<button [ngClass]="{ active: filter === 'tous' }" (click)="filter = 'tous'">
Toutes la To Do List
</button>
@ -65,8 +80,6 @@
Terminées
</button>
</div>
-->
<div>
<button (click)="effacerList()">Effacer la To Do List</button>
</div>
</div>

View File

@ -1,5 +1,15 @@
.todo-title {
width: 25%;
padding: 10px 18px;
font-size: xx-large;
margin-bottom: 16px;
&:focus {
outline: 0;
}
}
.todo-input {
width: 100%;
width: 20%;
padding: 10px 18px;
font-size: 18px;
margin-bottom: 16px;
@ -7,6 +17,8 @@
outline: 0;
}
}
.element {
margin-bottom: 12px;
display: flex;
@ -16,6 +28,7 @@
}
.deleteTache {
width: 75%;
cursor: pointer;
margin-left: 14px;
&:hover {
@ -40,11 +53,12 @@
margin-left: 12px;
width: 100%;
padding: 10px;
border: 1px solid #ccc; //override defaults
border: 1px solid rgb(204, 204, 204); //override defaults
font-family: 'Avenir', Helvetica, Arial, sans-serif;
&:focus {
outline: none;
background-color:aquamarine;
}
}
@ -53,15 +67,6 @@
color: grey;
}
.extra-container {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 16px;
border-top: 1px solid lightgrey;
padding-top: 14px;
margin-bottom: 14px;
}
button {
font-size: 14px;

View File

@ -1,5 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { Todo } from 'src/app/interfaces/todo';
import { Component, Input, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Tache} from 'src/app/models/tache';
import { ToDoList} from 'src/app/models/to-do-list';
import { TodoService } from 'src/app/services/todo.service';
import { TodoList } from 'src/app/todo-list';
@Component({
selector: 'app-to-do-list',
@ -7,22 +11,26 @@ import { Todo } from 'src/app/interfaces/todo';
styleUrls: ['./to-do-list.component.scss'],
})
export class ToDoListComponent implements OnInit {
@Input() todo!: ToDoList;
public beforeEditCache: string;
public todos: Todo[];
//public todos: ToDoList[];
public todoTitle: string;
public idTodo: number;
public filter : string;
public casesRestantes : boolean;
public masterSelected: boolean;
public result : any;
public tache : Tache [];
constructor() {
constructor(private TodoService : TodoService, private router: Router ) {
this.beforeEditCache = '';
this.todos = [];
//this.todos = [];
this.todoTitle = '';
this.idTodo = 0;
this.filter ='';
this.casesRestantes=true;
this.masterSelected= false;
this.tache = [];
}
ngOnInit(): void {
@ -31,89 +39,83 @@ export class ToDoListComponent implements OnInit {
this.filter='tous';
this.idTodo = 4;
this.todoTitle = '';
this.todos = [
{
id: 1,
title: 'Finish Angular Screencast',
completed: false,
editing: false,
},
{
id: 2,
title: 'Take over world',
completed: false,
editing: false,
},
{
id: 3,
title: 'One more thing',
completed: false,
editing: false,
},
];
}
//ajouter tache
addTitle(): void {
if (this.todoTitle.trim().length === 0) {
return;
addTache(idTodoList : number) {//idTodoList id que la todoList que l'on récupère
console.log(idTodoList);
const tache: Tache = {
id : 0,
texte: this.todoTitle,
etat : false,
editing : false,
}
this.todos.push({
id: this.idTodo,
title: this.todoTitle,
completed: false,
editing: false,
});
this.todoTitle = '';
this.idTodo++;
console.log(this.tache);
this.TodoService.addTache(tache,idTodoList).subscribe((resp)=>{
window.location.reload();
})
}
//modifier la tâche
modifier(todo: Todo): void {
this.beforeEditCache = todo.title;
todo.editing = true;
//modifier par l'input
modifier(tache: Tache): void {
this.beforeEditCache = tache.texte;
tache.editing = true;
}
// modifier l'apparence focus
doneEdit(todo: Todo): void {
if (todo.title.trim().length === 0) {
todo.title = this.beforeEditCache;
// ajouter la modification dans la liste
doneEdit(tache: Tache): void {
if (tache.texte.trim().length === 0) {
tache.texte = this.beforeEditCache;
}
this.casesRestantes= this.casesQuiRestes();
todo.editing = false;
tache.editing = false;
this.TodoService.updateTache(tache).subscribe((resp)=>{
console.log(tache);
window.location.reload();
})
}
// annuler la modification
cancelEdit(todo: Todo): void {
todo.title = this.beforeEditCache;
todo.editing = false;
cancelEdit(tache: Tache): void {
tache.texte = this.beforeEditCache;
tache.editing = false;
}
//supprimer la tache
deleteTodo(id: number): void {
this.todos = this.todos.filter((todo) => todo.id !== id);
}
deleteTodo(id: number) {
this.TodoService.deleteTacheById(id).subscribe(
resp =>{
window.location.reload();
}
);}
//nombre de tâches restantes
toDoRest(): number{
return this.todos.filter(todo=> !todo.completed).length;
return this.todo.taches.filter((tache: Tache)=> !tache.etat).length;
}
//Cocher toutes les tâches de la liste
listComplete(): boolean {
return this.todos.filter(todo=> todo.completed).length>0;
return this.todo.taches.filter((tache: Tache)=> tache).length>0;
}
//Effacer la to do list
effacerList(): void {
this.todos = [];
//this.todo = [];
}
//cocher toutes les cases de la todoList
cocherAllTodoList(): void {
for (var i = 0; i < this.todos.length; i++) {
this.todos[i].completed = this.masterSelected;
for (var i = 0; i < this.todo.taches.length; i++) {
this.todo.taches[i].etat = this.masterSelected;
}
this.cocherAllTodoList();
}
@ -123,16 +125,16 @@ export class ToDoListComponent implements OnInit {
}
//barre de filtre des tâches
todosFilter(): Todo[] {
/* todosFilter(): ToDoList[] {
if(this.filter === 'tous'){
return this.todos
return this.todo.taches
}else if (this.filter === 'active'){
return this.todos.filter(todo=> !todo.completed)
return this.todo.taches.filter((tache: Tache)=> !tache.etat)
}else if (this.filter === 'complete'){
return this.todos.filter(todo=>todo.completed)
}
return this.todos
return this.todo.taches.filter((tache: Tache)=>tache.etat)
}
return this.todo
} */
}

View File

@ -1,7 +1,7 @@
export interface Todo {
id : number,
title : string,
completed: boolean,
editing: boolean
texte : string,
etat: boolean,
// todoListId: number // FK
}

View File

@ -1,5 +1,6 @@
export interface Contact {
id: string;
couleur: string;
nom: string;
prenom: string;
telephone: string;

View File

@ -4,7 +4,4 @@ import { Team } from './team';
export interface Menu {
libelle: string;
dateMenu: Date;
membre: Membre;
team: Team;
validationProposition: boolean;
}

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

@ -0,0 +1,10 @@
import { ToDoList } from './to-do-list';
export interface Tache {
id : number,
texte: string,
etat : boolean,
editing : boolean
}

View File

@ -1,7 +1,11 @@
import { Tache } from './tache';
import { Team } from './team';
export interface ToDoList {
nom: string;
team: Team;
tache: string;
taches: Tache [];
id:number;
}

View File

@ -1,7 +1,31 @@
<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 class="container-fluid">
<div class="row">
<app-side-bar></app-side-bar>
<div class="col-9 offset-2" id="main">
<h1>Ma team</h1>
<div class="d-flex justify-content-center">
<button button type="button" class="btn btn-primary btn-lg"
routerLink="../modifier-compte"
routerLinkActive="active-custom">Modifier mon compte</button>
</div>
<div class="d-flex justify-content-center">
<button button type="button" class="btn btn-primary btn-lg"
routerLink="../supprimer-compte"
routerLinkActive="active-custom">Supprimer mon compte</button>
</div>
<div class="d-flex justify-content-center">
<button button type="button" class="btn btn-primary btn-lg"
routerLink="../ajout-membre"
routerLinkActive="active-custom">Ajouter un membre</button>
</div>
<div class="row">
<div class="col" *ngFor="let membreData of listMembres">
<app-card-member [membre]="membreData">
</app-card-member>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
button{
margin-bottom: 5px;
}

View File

@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { MembreService } from 'src/app/services/membre.service';
import { TeamService } from 'src/app/services/team.service';
@Component({
selector: 'app-page-account',
@ -6,10 +8,16 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./page-account.component.scss']
})
export class PageAccountComponent implements OnInit {
public listMembres: any[];
constructor() { }
constructor(private teamService: TeamService, private membreService: MembreService) {
this.listMembres = [];
}
ngOnInit(): void {
this.membreService.getMembres().subscribe((membres: any[]) => {
this.listMembres = membres;
});
}
}

View File

@ -1,5 +1,6 @@
<app-header></app-header>
<body>
<div class="container">
<div class="bienvenue">
<h2 class="titre">BIENVENUE</h2>
<p>
@ -13,6 +14,7 @@ lu, nous sommes là pour vous aider !</p>
<div class="connexion">
<app-signin></app-signin>
</div>
</div>
<div class="pub">
<img src="../../../assets/images/menu.png" />
<img src="../../../assets/images/repertoire.png" />

View File

@ -1,10 +1,15 @@
.container {
display: flex;
}
.bienvenue {
float: left;
display: inline;
// display: inline-block;
// height: 300px;
border: 4px solid #5d5fef;
border-radius: 10px;
margin-top: 50px;
margin-left: 200px;
// margin-left: 200px;
padding-right: 10px;
padding-left: 10px;
}
@ -18,17 +23,20 @@ p {
line-height: 2em;
}
.connexion {
float: right;
// float: right;
height: 350px;
display: inline;
margin-top: -40px;
margin-right: 200px;
margin-left: 10px;
// margin-right: 200px;
}
.pub {
padding-top: 100px;
padding-right: 100px;
padding-left: 200px;
display: flex;
flex-wrap: wrap;
padding-top: 100px;
padding-right: 200px;
padding-left: 200px;
justify-content: space-between;
}

View File

@ -1,101 +1,141 @@
<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="container-fluid">
<div class="row">
<app-side-bar></app-side-bar>
<div class="col-9 offset-2" id="main">
<div class="form-addMember">
<form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm">
<div class="form-floating">
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur"
formControlName="couleurFc">
<label for="floatingInputcouleur">Choisissez une couleur !</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">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>
<input type="color"
class="form-control"
id="floatingInputcouleur"
placeholder=""
name="couleur"
formControlName="couleurFc">
</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>
<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">VOTRE 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">
<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>
<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">VOTRE PRENOM</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>
<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="floatingInputdateNaissance">VOTRE DATE DE NAISSANCE</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>
<input
type="email"
class="form-control"
id="floatingInputemail"
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="floatingInputemail">VOTRE 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="password"
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="floatingPasswordConfirm">CONFIRMEZ VOTRE 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>
<button
class="w-100 btn btn-lg btn-outline-success"
type="submit"
[disabled]="addMemberForm.invalid"
>Ajouter le membre</button>
</form>
</div>
</div>
</div>
</div>
</form>
</main>

View File

@ -4,29 +4,72 @@
background-color: #f5f5f5;
}
.form-signup {
.form-addMember {
width: 100%;
max-width: 330px;
padding: 15px;
margin: auto;
margin-top: 50px;
margin-left: auto;
margin-right: auto;
border: solid 1px;
border-radius: 10px;
background-color: #fcddec;
border-color: #ef5da8;
}
.form-signup .checkbox {
.form-addMember .checkbox {
font-weight: 400;
}
.form-signup .form-floating:focus-within {
.form-addMember .form-floating:focus-within {
z-index: 2;
}
.form-signup input[type="email"] {
margin-bottom: -1px;
.form-addMember input[type="email"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signup input[type="password"] {
.form-addMember input[type="color"] {
border: none;
margin-bottom: 10px;
margin-top: -70px;
margin-left: 100px;
border-radius: 50%;
width: 100px;
height: 100px;
}
.form-addMember input[type="color"]::-webkit-color-swatch {
border: none;
margin-top: -15px;
border-radius: 80%;
width: 80px;
height: 80px;
}
.form-addMember input[type="text"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-addMember input[type="date"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-addMember input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.btn-outline-success {
margin-top: 10px;
background-color: #ffff;
color: #ef5da8 !important;
border-color: #ef5da8 !important;
}

View File

@ -3,6 +3,7 @@ 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';
import { MembreService } from 'src/app/services/membre.service';
@Component({
selector: 'app-page-add-member',
@ -13,6 +14,7 @@ export class PageAddMemberComponent implements OnInit {
public addMemberForm: FormGroup;
constructor(
private membreService: MembreService,
private authService: AuthService,
private router: Router,
private fb: FormBuilder
@ -27,7 +29,7 @@ export class PageAddMemberComponent implements OnInit {
firstNameFc: new FormControl('', [Validators.required]),
lastNameFc: new FormControl('', [Validators.required]),
dateNaissanceFc: new FormControl('', [Validators.required]),
couleurFc: new FormControl('', [Validators.required]),
couleurFc: new FormControl('', []),
emailFc: new FormControl('', [
Validators.email,
Validators.required,
@ -73,8 +75,8 @@ export class PageAddMemberComponent implements OnInit {
if (membre.email !== '' && membre.password !== '') {
this.authService.signup(membre).subscribe((resp) => {
this.router.navigate(['account/signin']);
this.membreService.addMembre(membre).subscribe((resp) => {
this.router.navigate(['compte']);
});
} else {
// affichage erreur

View File

@ -3,10 +3,14 @@
<app-side-bar></app-side-bar>
</div>
<div class="ajoutContact-form text-center">
<h1>Ajouter un contact</h1>
<main class="form-ajoutContact">
<form (ngSubmit)="onSubmit()" [formGroup]="ajoutContactForm">
<h1>Ajouter un contact</h1>
<div class="form-floating">
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur"
formControlName="couleurFc">
</div>
<div class="form-floating">
<input type="text"

View File

@ -1,14 +1,20 @@
.login-form {
height: 100vh;
padding-top: 40px;
background-color: #f5f5f5;
background-color: #e286d3;
}
.form-ajoutContact {
width: 100%;
max-width: 330px;
padding: 15px;
margin: auto;
margin-top: 50px;
margin-left: auto;
margin-right: auto;
border: solid 1px;
border-radius: 10px;
background-color: #fcddec;
border-color: #81164d;
}
.form-ajoutContact .checkbox {
@ -20,12 +26,45 @@
}
.form-ajoutContact input[type="email"] {
margin-bottom: -1px;
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-ajoutContact input[type="color"] {
border: none;
margin-bottom: 10px;
margin-top: -70px;
margin-left: 100px;
border-radius: 50%;
width: 100px;
height: 100px;
}
.form-ajoutContact input[type="color"]::-webkit-color-swatch {
border: none;
margin-top: -15px;
border-radius: 80%;
width: 80px;
height: 80px;
}
.form-ajoutContact input[type="text"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-ajoutContact input[type="date"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-secondary {
color: #fff;
margin-top: 10px;
background-color: #ffff;
color: rgb(255, 255, 255);
background-color: #5a1e63 !important;
}

View File

@ -6,6 +6,7 @@ import {
Validators,
} from '@angular/forms';
import { Router } from '@angular/router';
import { TokenService } from 'src/app/services/token.service';
import { Contact } from '../../models/contact';
import { RepertoireService } from '../../services/repertoire.service';
@ -19,6 +20,7 @@ export class PageAjoutContactComponent implements OnInit {
constructor(
private repertoireService: RepertoireService,
private tokenService: TokenService,
private router: Router,
private fb: FormBuilder
) {
@ -28,6 +30,7 @@ export class PageAjoutContactComponent implements OnInit {
ngOnInit(): void {
// *********************************pensser à changer group car déprécié********************************
this.ajoutContactForm = this.fb.group({
couleurFc: new FormControl('', [Validators.required]),
lastNameFc: new FormControl('', [Validators.required]),
firstNameFc: new FormControl('', [Validators.required]),
telephoneFc: new FormControl('', [Validators.required]),
@ -42,24 +45,25 @@ export class PageAjoutContactComponent implements OnInit {
}
public onSubmit(): void {
console.log('value : ', this.ajoutContactForm.value);
console.log('form : ', this.ajoutContactForm);
const couleurValue = this.ajoutContactForm.value['couleurFc'];
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 teamId = this.tokenService.getCurrentTeamId()
const contact: Contact = {
id: '',
couleur: couleurValue,
nom: lastNameValue,
prenom: firstNameValue,
telephone: telephoneValue,
email: emailValue,
dateNaissance: dateNaissanceValue,
adresse: adresseValue,
team: { id: '1' }, // changer l'id quand la personne est logé => recuperer l'id de la team du membre
team: { id: teamId }, // changer l'id quand la personne est logé => recuperer l'id de la team du membre
};
if (contact.nom !== '') {
@ -67,7 +71,7 @@ export class PageAjoutContactComponent implements OnInit {
this.router.navigate(['repertoire/']);
});
} else {
// affichage erreur
window.alert("Le contact ne peut pas être ajouté!")
}
}
}

View File

@ -1,30 +1,27 @@
<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>
<div class="row">
<div class="col-md-auto">
<app-side-bar></app-side-bar>
</div>
<div class=" col team-form text-center">
<h1>Créer votre team</h1>
<main class="form-team">
<form (ngSubmit)="onSubmit()" [formGroup]="teamForm">
<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>
</form>
</main>
</div>
</div>

View File

@ -1,31 +1,40 @@
.team-form{
margin-top: 20px;
align-content: center;
}
button{
margin-top: 10px;
}
.login-form {
height: 100vh;
padding-top: 40px;
background-color: #f5f5f5;
}
.form-signup {
.form-team {
width: 100%;
max-width: 330px;
max-width: 500px;
padding: 15px;
margin: auto;
}
.form-signup .checkbox {
.form-team .checkbox {
font-weight: 400;
}
.form-signup .form-floating:focus-within {
.form-team .form-floating:focus-within {
z-index: 2;
}
.form-signup input[type="email"] {
.form-team input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signup input[type="password"] {
.form-team input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;

View File

@ -7,7 +7,7 @@ import {
} from '@angular/forms';
import { Router } from '@angular/router';
import { Team } from 'src/app/models/team';
import { AuthService } from '../../services/auth.service';
import { TeamService } from 'src/app/services/team.service';
@Component({
selector: 'app-page-creation-team',
@ -17,7 +17,7 @@ import { AuthService } from '../../services/auth.service';
export class PageCreationTeamComponent implements OnInit {
public teamForm: FormGroup;
constructor(
private authService: AuthService,
private teamService: TeamService,
private router: Router,
private fb: FormBuilder
) {
@ -43,7 +43,7 @@ export class PageCreationTeamComponent implements OnInit {
if (team.nom !== '' ) {
this.authService.creationTeam(team).subscribe((resp) => {
this.teamService.addTeam(team).subscribe((resp) => {
this.router.navigate(['compte']);
});
} else {

View File

@ -2,3 +2,8 @@
<app-side-bar></app-side-bar>
<app-meteo></app-meteo>
<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>

View File

@ -0,0 +1,5 @@
.meteo {
display: flex;
margin-left: 300px;
margin-top: -60px;
}

View File

@ -0,0 +1,12 @@
<app-header></app-header>
<div class="row">
<div class="col-md-auto">
<app-side-bar></app-side-bar>
</div>
<div class=" col compte text-center">
<h1>Supprimer votre compte</h1>
<main class="contenu-compte">
</main>
</div>
</div>

View File

@ -1,20 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AvatarComponent } from './avatar.component';
import { PageDeleteAccountComponent } from './page-delete-account.component';
describe('AvatarComponent', () => {
let component: AvatarComponent;
let fixture: ComponentFixture<AvatarComponent>;
describe('PageDeleteAccountComponent', () => {
let component: PageDeleteAccountComponent;
let fixture: ComponentFixture<PageDeleteAccountComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AvatarComponent ]
declarations: [ PageDeleteAccountComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AvatarComponent);
fixture = TestBed.createComponent(PageDeleteAccountComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-page-delete-account',
templateUrl: './page-delete-account.component.html',
styleUrls: ['./page-delete-account.component.scss']
})
export class PageDeleteAccountComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -1 +1,12 @@
<app-header></app-header>
<div class="row">
<div class="col-md-auto">
<app-side-bar></app-side-bar>
</div>
<div class=" col compte text-center">
<h1>Supprimer ce membre</h1>
<main class="contenu-compte">
</main>
</div>
</div>

View File

@ -13,10 +13,10 @@
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>
</div> -->
</main>
</div>

View File

@ -14,25 +14,20 @@ import {
styleUrls: ['./page-forgot-password.component.scss']
})
export class PageForgotPasswordComponent implements OnInit {
public errorForm: boolean;
constructor(private authService: AuthService, private router: Router) {
this.errorForm = false;
}
ngOnInit(): void {}
public onSubmit(submittedForm: any): 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;
}
// const email = submittedForm.form.value['email'];
// console.log(email);
window.alert("Vous allez recevoir un email pour re-initialiser votre mot de passe !")
// this.router.navigate(['reinitialisation-password']);
}
}
}

View File

@ -1,2 +1,29 @@
<app-header></app-header>
<app-side-bar></app-side-bar>
<div class="row">
<div class="col-md-auto">
<app-side-bar></app-side-bar>
</div>
<div class=" col compte text-center">
<h1>Menu de la semaine</h1>
<main class="contenu-compte">
<app-card-menu></app-card-menu>
<div class="d-flex justify-content-center">
</div>
<div class="d-flex justify-content-center">
</div>
<div class="d-flex justify-content-center">
</div>
<div class="d-flex justify-content-center">
</div>
<div class="d-flex justify-content-center">
</div>
<div class="d-flex justify-content-center">
</div>
</main>
</div>

View File

@ -4,10 +4,14 @@
</div>
<div class="modifContact-form text-center">
<h1>Modifier ce contact</h1>
<main class="form-modifContact">
<form (ngSubmit)="onSubmit()" [formGroup]="modifContactForm">
<h1>Modifier ce contact</h1>
<div class="form-floating">
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur"
formControlName="couleurFc" value= "{{ listContactInfo.couleur }}">
</div>
<div class="form-floating">
<input type="text"

View File

@ -8,7 +8,13 @@
width: 100%;
max-width: 330px;
padding: 15px;
margin: auto;
margin-top: 50px;
margin-left: auto;
margin-right: auto;
border: solid 1px;
border-radius: 10px;
background-color: #fcddec;
border-color: #81164d;
}
.form-modifContact .checkbox {
@ -25,7 +31,40 @@
border-bottom-left-radius: 0;
}
.form-modifContact input[type="color"] {
border: none;
margin-bottom: 10px;
margin-top: -70px;
margin-left: 100px;
border-radius: 50%;
width: 100px;
height: 100px;
}
.form-modifContact input[type="color"]::-webkit-color-swatch {
border: none;
margin-top: -15px;
border-radius: 80%;
width: 80px;
height: 80px;
}
.form-modifContact input[type="text"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-modifContact input[type="date"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-secondary {
color: #fff;
margin-top: 10px;
background-color: #ffff;
color: rgb(255, 255, 255);
background-color: #5a1e63 !important;
}

View File

@ -44,6 +44,7 @@ export class PageModifierContactComponent implements OnInit {
// *********************************pensser à changer group car déprécié********************************
this.modifContactForm = this.fb.group({
couleurFc: new FormControl('', [Validators.required]),
lastNameFc: new FormControl('', [Validators.required]),
firstNameFc: new FormControl('', [Validators.required]),
telephoneFc: new FormControl('', [Validators.required]),
@ -71,8 +72,7 @@ export class PageModifierContactComponent implements OnInit {
//Méthode qui envoie les champs modifiés pour mise à jour
public onSubmit(): void {
console.log('value : ', this.modifContactForm.value);
console.log('form : ', this.modifContactForm);
const couleurValue = this.modifContactForm.value['couleurFc'];
const firstNameValue = this.modifContactForm.value['firstNameFc'];
const lastNameValue = this.modifContactForm.value['lastNameFc'];
const telephoneValue = this.modifContactForm.value['telephoneFc'];
@ -82,6 +82,7 @@ export class PageModifierContactComponent implements OnInit {
const contact: Contact = {
id: this.personneid,
couleur: couleurValue,
nom: lastNameValue,
prenom: firstNameValue,
telephone: telephoneValue,

View File

@ -1,5 +1,5 @@
<app-header></app-header>
<app-side-bar></app-side-bar>
<div>
<div class="ctn-link min-vh-100">

View File

@ -1,31 +1,41 @@
<app-header></app-header>
<app-side-bar></app-side-bar>
<div class="row">
<div class="col-md-auto">
<app-side-bar></app-side-bar>
</div>
<div>
<button class="w-100 btn btn-lg btn-secondary "
type="submit">Tous les contacts
</button>
<div class=" col compte text-center py-3 border">
<div>
<button class="btn btn-sm btn-rounded btn-secondary m-3" type="submit">Tous les contacts
</button>
<button routerLink="/ajouter-contact" class="btn btn-sm btn-rounded btn-secondary m-3">
Ajouter un contact
</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 d-flex justify-content-center">
<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 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 class="input-group-append"></div>
</div>
<div>
<h4>Liste des Contacts</h4>
</div>
<div class="row justify-content-evenly">
<div class="col-4">
<div class="row my-3 d-flex justify-content-center flex-row" *ngFor="let personne of listContact"
(click)="onClick(personne)">
<div class="couleur col-4" [style.background-color]="personne.couleur"></div>
<span class="fiche-contact col-7">{{ personne.prenom }} {{ personne.nom }}</span>
</div>
</div>
<div class="col-4" *ngIf="openDetails">
<app-fiche-contact [personne]="openDetails" (clickDelete)="onClickDelete($event)">
</app-fiche-contact>
</div>
</div>
</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>
</div>

View File

@ -2,14 +2,33 @@
color: #fff;
background-color: #5a1e63 !important;
width: 100%;
max-width: 330px;
max-width: 230px;
padding: 15px;
margin: auto;
min-width: 100px;
border-radius: 55px;
font-weight: bold;
}
.input-group mb-3 {
width: 100%;
.input-group.mb-3 {
width: 50%;
max-width: 330px;
padding: 15px;
margin: auto;
display: flex;
flex-direction: row;
}
.couleur{
border: none;
margin-top: -15px;
border-radius: 80%;
width: 60px;
height: 60px;
flex-direction: row;
}
.h4 {
color: black;
font-weight: bold;
}

View File

@ -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,13 +53,21 @@ 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;
}
// this.repertoireService.deleteContact(contact).subscribe((resp) => {
// this.router.navigate(['repertoire/']);
// });
// 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/']);
});
}
}

View File

@ -1,12 +1,12 @@
<app-header></app-header>
<div class="signup-form text-center">
<h1>Inscrivez-vous !</h1>
<label for="floatingInputcouleur">Choisissez une couleur</label>
<main class="form-signup">
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
<div class="form-floating">
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur"
formControlName="couleurFc">
</div>
<div class="form-floating">
<input
@ -126,10 +126,10 @@
<button
class="w-100 btn btn-lg btn-outline-success"
type="submit"
[disabled]="signupForm.invalid"
>
[disabled]="signupForm.invalid">
CREER MON COMPTE
</button>
</form>
</main>
</div>

View File

@ -1,5 +1,9 @@
<app-header></app-header>
<app-side-bar></app-side-bar>
<div class="container">
<app-to-do-list></app-to-do-list>
<div class="d-flex align-items-stretch">
<div class="row">
<div class="col" *ngFor="let todos of result">
<app-to-do-list [todo]="todos"> </app-to-do-list>
</div>
</div>
</div>

View File

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

View File

@ -0,0 +1,12 @@
<app-header></app-header>
<div class="row">
<div class="col-md-auto">
<app-side-bar></app-side-bar>
</div>
<div class=" col compte text-center">
<h1>Modifier votre compte</h1>
<main class="contenu-compte">
</main>
</div>
</div>

View File

@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PageUpdateAccountComponent } from './page-update-account.component';
describe('PageUpdateAccountComponent', () => {
let component: PageUpdateAccountComponent;
let fixture: ComponentFixture<PageUpdateAccountComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PageUpdateAccountComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PageUpdateAccountComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-page-update-account',
templateUrl: './page-update-account.component.html',
styleUrls: ['./page-update-account.component.scss']
})
export class PageUpdateAccountComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -1 +1,12 @@
<app-header></app-header>
<div class="row">
<div class="col-md-auto">
<app-side-bar></app-side-bar>
</div>
<div class=" col compte text-center">
<h1>Modifier ce membre</h1>
<main class="contenu-compte">
</main>
</div>
</div>

View File

@ -41,9 +41,9 @@ export class AuthService {
return this.http.post(`${this.apiUrl}/membres/sign-in`, body).pipe(
map((x: any) => {
console.log('Service : ', x.accessToken);
console.log('Service : ', x.token);
// Modification à faire ici
localStorage.setItem(this.tokenKey, x.accessToken);
localStorage.setItem(this.tokenKey, x.token);
return x; // permet de renvoyer la réponse à l'initiateur (page Signin) après le traitement du map
})
);

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MembreService } from './membre.service';
describe('MembreService', () => {
let service: MembreService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MembreService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,40 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Membre } from '../models/membre';
@Injectable({
providedIn: 'root'
})
export class MembreService {
apiUrl: string;
tokenKey: string;
constructor(private http: HttpClient) {
this.apiUrl = environment.apiUrl;
this.tokenKey = environment.tokenKey;
}
getMembres(): Observable<any> {
return this.http.get(`${this.apiUrl}/membres/all`);
}
getMembreId(id: any): Observable<any> {
return this.http.get(`${this.apiUrl}/membres/1` + id);
}
addMembre(membre: Membre): Observable<any> {
console.log(membre);
return this.http.post(`${this.apiUrl}/membres/sign-up`, membre);
}
deleteMembre(membre: Membre): Observable<any> {
return this.http.delete(`${this.apiUrl}/membres/delete/1`);
}
updateMembre(membre: Membre): Observable<any> {
return this.http.put(`${this.apiUrl}/membres/update/1`, membre);
}
}

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MenusService } from './menus.service';
describe('MenusService', () => {
let service: MenusService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MenusService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,56 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { map, Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Menu } from '../models/menu';
import { Router } from '@angular/router';
import { TokenService } from './token.service';
@Injectable({
providedIn: 'root'
})
export class MenusService {
apiUrl: string;
constructor(private http: HttpClient, private router: Router, private tokenService: TokenService) {
// On se sert des variables d'environnement de notre application
this.apiUrl = environment.apiUrl;
}
//on affiche les menus d'une team
getMenu(): Observable<any> | void {
const teamId = this.tokenService.getCurrentTeamId();
if (teamId){
return this.http.get(`${this.apiUrl}/menus/team/${teamId}`);
}else {
this.router.navigate(['accueil']);
}
}
getMenuById(id: any): Observable<any> {
return this.http.get(`${this.apiUrl}/menus/` + id);
}
addMenu(menu: Menu): Observable<any> | void {
console.log(menu);
const teamId = this.tokenService.getCurrentTeamId();
if (teamId){
return this.http.post(`${this.apiUrl}/menus/add/${teamId}`, menu);
}else {
this.router.navigate(['accueil']);
}
}
deleteMenu(id: any): Observable<any> {
return this.http.delete(`${this.apiUrl}/menus/delete/`+ id);
}
updateMenu(menu: Menu): Observable<any> {
return this.http.put(`${this.apiUrl}/contacts/update/`, menu);
}
}

View File

@ -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<any> {
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<any> {
@ -26,13 +29,12 @@ export class RepertoireService {
}
addContact(contact: Contact): Observable<any> {
console.log(contact);
const teamId = this.tokenService.getCurrentTeamId()
return this.http.post(`${this.apiUrl}/contacts/add`, contact);
}
deleteContact(contact: Contact): Observable<any> {
return this.http.delete(`${this.apiUrl}/contacts/delete/1`);
deleteContact(contactId: number): Observable<any> {
return this.http.delete(`${this.apiUrl}/contacts/delete/${contactId}`);
}
updateContact(contact: Contact): Observable<any> {

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { TeamService } from '../services/team.service';
describe('TeamService', () => {
let service: TeamService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(TeamService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,41 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Team } from '../models/team';
@Injectable({
providedIn: 'root'
})
export class TeamService {
apiUrl: string;
tokenKey: string;
constructor(private http: HttpClient) {
this.apiUrl = environment.apiUrl;
this.tokenKey = environment.tokenKey;
}
getTeams(): Observable<any> {
return this.http.get(`${this.apiUrl}/teams/all`);
}
getTeamById(id: any): Observable<any> {
return this.http.get(`${this.apiUrl}/teams/1` + id);
}
addTeam(team: Team): Observable<any> {
console.log(team);
return this.http.post(`${this.apiUrl}/teams/add`, team);
}
deleteTeam(team: Team): Observable<any> {
return this.http.delete(`${this.apiUrl}/teams/delete/1`);
}
updateTeam(team: Team): Observable<any> {
return this.http.put(`${this.apiUrl}/teams/update/1`, team);
}
}

View File

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

View File

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

View File

@ -0,0 +1,38 @@
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<any> {
return this.http.get(`${this.apiUrl}/todolist/team/1`);
}
deleteTacheById(idTache: any): Observable<any> {
return this.http.delete(`${this.apiUrl}/taches/delete/${idTache}`, {
responseType: 'text',
});
}
addTache(newtache: Tache, idTodoList: number): Observable<any> {
// console.log(newtache);
return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache);
}
updateTache(tache: Tache): Observable<any> {
console.log(tache);
return this.http.put(`${this.apiUrl}/taches/update/1`, tache);
}
}

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { TokenService } from './token.service';
describe('TokenService', () => {
let service: TokenService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(TokenService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,59 @@
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import jwt_decode from 'jwt-decode';
@Injectable({
providedIn: 'root'
})
export class TokenService {
tokenKey = environment.tokenKey;
constructor() { }
public getToken(): string | null {
const token = localStorage.getItem(this.tokenKey);
if(token) {
return token;
} else {
return null;
}
}
public getCurrentMembreId(): number | null {
const token = this.getToken();
if(token) {
const decodedToken = jwt_decode<any>(token);
const userId = decodedToken.sub;
return userId;
} else {
return null;
}
}
public getCurrentTeamId(): number | null {
const token = this.getToken();
if(token){
const decodedToken = jwt_decode<any>(token);
const teamId = decodedToken.teamId;
return teamId ;
}else {
return null;
}
}
public getRole(): string | null {
const token = this.getToken();
if(token){
const decodedToken = jwt_decode<any>(token);
const role= decodedToken.auth[0].authority;
return role;
}else{
return null;
}
}
}

2
src/app/todo-list.ts Normal file
View File

@ -0,0 +1,2 @@
export interface TodoList {
}

View File

@ -1,11 +1,13 @@
<!doctype html>
<html lang="en">
<html lang="fr">
<head>
<meta charset="utf-8">
<title>OrganizeeFront</title>
<title>Organizee</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<!-- Pour accèder à la bibliothèque d'icons W3S-->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
</head>
<body>
<app-root></app-root>

View File

@ -1 +1,3 @@
@import "~bootstrap/scss/bootstrap.scss";
//Pour utiliser les icons ne fonctionne que si vous avez fait cette commande : npm i bootstrap-icons --save
@import "~bootstrap-icons/font/bootstrap-icons.scss";