commit
b4518612ce
8 changed files with 76 additions and 15 deletions
|
@ -41,6 +41,7 @@ import { HumeurComponent } from './components/humeur/humeur.component';
|
||||||
import { DeconnexionComponent } from './components/deconnexion/deconnexion.component';
|
import { DeconnexionComponent } from './components/deconnexion/deconnexion.component';
|
||||||
import { AlertComponent } from './components/alert/alert.component';
|
import { AlertComponent } from './components/alert/alert.component';
|
||||||
import { PageAjoutEvenementsComponent } from './pages/page-ajout-evenements/page-ajout-evenements.component';
|
import { PageAjoutEvenementsComponent } from './pages/page-ajout-evenements/page-ajout-evenements.component';
|
||||||
|
import { PageSupportComponent } from './pages/page-support/page-support.component';
|
||||||
registerLocaleData(localeFr)
|
registerLocaleData(localeFr)
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -78,7 +79,8 @@ registerLocaleData(localeFr)
|
||||||
DeconnexionComponent,
|
DeconnexionComponent,
|
||||||
HumeurComponent,
|
HumeurComponent,
|
||||||
AlertComponent,
|
AlertComponent,
|
||||||
PageAjoutEvenementsComponent
|
PageAjoutEvenementsComponent,
|
||||||
|
PageSupportComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
|
|
@ -8,5 +8,6 @@
|
||||||
<a routerLink="../to-do-list" routerLinkActive="active-custom" class="nav-link">To-Do-List</a>
|
<a routerLink="../to-do-list" routerLinkActive="active-custom" class="nav-link">To-Do-List</a>
|
||||||
<a routerLink="../agenda" routerLinkActive="active-custom" class="nav-link">Agenda</a>
|
<a routerLink="../agenda" routerLinkActive="active-custom" class="nav-link">Agenda</a>
|
||||||
<a routerLink="../menu" routerLinkActive="active-custom" class="nav-link">Menus</a>
|
<a routerLink="../menu" routerLinkActive="active-custom" class="nav-link">Menus</a>
|
||||||
|
<a routerLink="../page-support" routerLinkActive="active-custom" class="nav-link">Nous contacter</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
|
@ -7,4 +7,9 @@ font-size: smaller;
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3{
|
||||||
|
color : blue;
|
||||||
|
font-size : 16px;
|
||||||
}
|
}
|
|
@ -2,7 +2,12 @@
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<h2>Mon humeur :</h2>
|
<h2>Mon humeur :</h2>
|
||||||
|
|
||||||
|
<app-alert
|
||||||
|
*ngIf="isShow"
|
||||||
|
[alert]="alert"
|
||||||
|
(eventClose)="onClickCloseAlert()"
|
||||||
|
></app-alert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,4 +24,5 @@
|
||||||
<div >
|
<div >
|
||||||
|
|
||||||
|
|
||||||
</div> </div>
|
</div> </div>
|
||||||
|
|
|
@ -6,6 +6,7 @@ p>img {
|
||||||
img {
|
img {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
|
margin: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.humeur {
|
.humeur {
|
||||||
|
@ -13,6 +14,7 @@ display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
background-color: #87AFC7;
|
width: 400px;
|
||||||
|
background-color: #87AFC7;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { MembreService } from 'src/app/services/membre.service';
|
||||||
|
import { TokenService } from 'src/app/services/token.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-humeur',
|
selector: 'app-humeur',
|
||||||
|
@ -6,10 +8,10 @@ import { Component, OnInit } from '@angular/core';
|
||||||
styleUrls: ['./humeur.component.scss']
|
styleUrls: ['./humeur.component.scss']
|
||||||
})
|
})
|
||||||
export class HumeurComponent implements OnInit {
|
export class HumeurComponent implements OnInit {
|
||||||
|
monHumeurLien! : string[];
|
||||||
|
monHumeurTitle! : string[] ;
|
||||||
monHumeurLien! : string[];
|
isShow: boolean;
|
||||||
monHumeurTitle! : string[] ;
|
alert: any;
|
||||||
|
|
||||||
|
|
||||||
tabHumeur= [
|
tabHumeur= [
|
||||||
|
@ -19,18 +21,48 @@ export class HumeurComponent implements OnInit {
|
||||||
{ title : "Je suis en colère", lien : "assets/images/emoticon-insulter.png"},
|
{ title : "Je suis en colère", lien : "assets/images/emoticon-insulter.png"},
|
||||||
{ title : "Je suis en joie", lien : "assets/images/emoticon-feter.png"} ]
|
{ title : "Je suis en joie", lien : "assets/images/emoticon-feter.png"} ]
|
||||||
|
|
||||||
constructor() { }
|
constructor(private membreService: MembreService, private tokenService: TokenService) {
|
||||||
|
this.isShow= false;
|
||||||
|
this.alert="";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void { }
|
ngOnInit(): void {
|
||||||
|
const userId = this.tokenService.getCurrentMembreId();
|
||||||
|
this.membreService.getMembreId(userId).subscribe({
|
||||||
|
next: result => {
|
||||||
|
this.monHumeurTitle= [this.tabHumeur[result.smiley].title];
|
||||||
|
this.monHumeurLien= [this.tabHumeur[result.smiley].lien];
|
||||||
|
// console.log("resultat smiley ", result.smiley);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
onChoixHumeur(numero: number){
|
onChoixHumeur(numero: number){
|
||||||
this.monHumeurTitle= [this.tabHumeur[numero].title];
|
this.monHumeurTitle= [this.tabHumeur[numero].title];
|
||||||
this.monHumeurLien= [this.tabHumeur[numero].lien];
|
this.monHumeurLien= [this.tabHumeur[numero].lien];
|
||||||
|
|
||||||
|
this.membreService.updateHumeur(numero)?.subscribe(
|
||||||
|
{
|
||||||
|
next: result => {
|
||||||
|
this.alert={"type":"success", "content":"L'humeur a bien été modifiée"};
|
||||||
|
this.isShow = true;
|
||||||
|
},
|
||||||
|
error: err => {
|
||||||
|
this.alert={"type":"danger", "content":"Problème lors de la modification de l'humeur"};
|
||||||
|
this.isShow = true;
|
||||||
|
},
|
||||||
|
complete: () => console.log('DONE!')
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
console.log("humeur titre est : ", this.monHumeurTitle);
|
console.log("humeur titre est : ", this.monHumeurTitle);
|
||||||
console.log("humeur lien est : ", this.monHumeurLien);
|
console.log("humeur lien est : ", this.monHumeurLien);
|
||||||
console.log("index humeur est : ", numero );
|
console.log("index humeur est : ", numero);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClickCloseAlert(){
|
||||||
|
this.isShow=!this.isShow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -28,4 +28,5 @@
|
||||||
<button type="button" class="btn btn-danger">Effacer</button>
|
<button type="button" class="btn btn-danger">Effacer</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<app-footer></app-footer>
|
|
@ -57,4 +57,16 @@ export class MembreService {
|
||||||
this.router.navigate(['accueil']);
|
this.router.navigate(['accueil']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateHumeur(numero : number) : Observable<any> | void {
|
||||||
|
const userId = this.tokenService.getCurrentMembreId();
|
||||||
|
if (userId){
|
||||||
|
return this.http.put(`${this.apiUrl}/membres/update/smiley/${userId}`, numero);
|
||||||
|
}else {
|
||||||
|
this.router.navigate(['accueil']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue