Merge branch 'dev' into sana
This commit is contained in:
commit
7784870446
13 changed files with 309 additions and 91 deletions
|
@ -1,6 +1,5 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule, LOCALE_ID } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { PageAccueilComponent } from './pages/page-accueil/page-accueil.component';
|
import { PageAccueilComponent } from './pages/page-accueil/page-accueil.component';
|
||||||
|
@ -40,6 +39,9 @@ import { FooterComponent } from './components/footer/footer.component';
|
||||||
import { PageDeleteAccountComponent } from './pages/page-delete-account/page-delete-account.component';
|
import { PageDeleteAccountComponent } from './pages/page-delete-account/page-delete-account.component';
|
||||||
import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component';
|
import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component';
|
||||||
import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular";
|
import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular";
|
||||||
|
import { registerLocaleData } from '@angular/common';
|
||||||
|
import localeFr from '@angular/common/locales/fr';
|
||||||
|
registerLocaleData(localeFr)
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -78,6 +80,7 @@ import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular";
|
||||||
FooterComponent,
|
FooterComponent,
|
||||||
PageDeleteAccountComponent,
|
PageDeleteAccountComponent,
|
||||||
PageUpdateAccountComponent,
|
PageUpdateAccountComponent,
|
||||||
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -86,9 +89,10 @@ import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular";
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
AutofocusFixModule.forRoot(),
|
AutofocusFixModule.forRoot(),
|
||||||
DayPilotModule
|
DayPilotModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
|
{provide: LOCALE_ID, useValue: "fr-FR" }
|
||||||
|
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
|
|
|
@ -1,46 +1,135 @@
|
||||||
<div class="menu">
|
|
||||||
<div *ngFor="let menu of listMenus">
|
|
||||||
<p>{{ menu.dateMenu }} {{ menu.libelle }}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ng-template #content let-modal>
|
<ng-template #content let-modal>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="modal-basic-title">
|
<h4 class="modal-title" id="modal-basic-title">Ajouter un menu</h4>
|
||||||
Ajouter un menu
|
<button
|
||||||
</h4>
|
type="button"
|
||||||
<button type="button" class="close" aria-label="Close" (click)="modal.dismiss('Cross click')">
|
class="close"
|
||||||
|
aria-label="Close"
|
||||||
<span aria-hidden="true">
|
(click)="modal.dismiss('Cross click')"
|
||||||
×
|
>
|
||||||
</span>
|
<span aria-hidden="true"> × </span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form [formGroup]="menuForm">
|
<form [formGroup]="menuForm">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="dateMenu">
|
|
||||||
Date
|
|
||||||
</label>
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input id="dateMenu" class="form-control" formControlName="dateMenuFc" placeholder="yyyy-mm-dd" name="date"
|
<input
|
||||||
>
|
type="date"
|
||||||
<input id="libelle" class="form-control" formControlName="libelleFc" placeholder="" name="libelle"
|
id="dateMenu"
|
||||||
>
|
class="form-control"
|
||||||
|
formControlName="dateMenuFc"
|
||||||
|
placeholder="Date"
|
||||||
|
name="date"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<input
|
||||||
|
id="repasMidi"
|
||||||
|
class="form-control"
|
||||||
|
formControlName="repasMidiFc"
|
||||||
|
placeholder="Repas du midi"
|
||||||
|
name="repasMidi"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<input
|
||||||
|
id="repasSoir"
|
||||||
|
class="form-control"
|
||||||
|
formControlName="repasSoirFc"
|
||||||
|
placeholder="Repas du soir"
|
||||||
|
name="repasSoir"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-outline-dark" (click)="modal.close(saveMenu())">
|
<button
|
||||||
Save
|
type="button"
|
||||||
|
class="btn btn-outline-dark"
|
||||||
|
(click)="modal.close(saveMenu())"
|
||||||
|
>
|
||||||
|
Enregistrer
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<button class="btn btn-lg btn-outline-primary" (click)="open(content)">
|
<button type="button" class="btn btn-outline-warning" (click)="open(content)">
|
||||||
Ajouter un menu
|
Ajouter un menu
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<div class="container mt-5 menu">
|
||||||
|
<div class="row d-flex justify-content-center">
|
||||||
|
<div class="col-md-auto" *ngFor="let menu of listMenus">
|
||||||
|
<div class="card p-3 py-4 align-items" style="width: 14rem">
|
||||||
|
<p class="jour">{{ menu.dateMenu | date: "EEEE":"fr" }}</p>
|
||||||
|
<div class="tag">
|
||||||
|
<p class="repas">Midi</p>
|
||||||
|
<p>{{ menu.repasMidi }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="tag">
|
||||||
|
<p class="repas">Soir</p>
|
||||||
|
<p>{{ menu.repasSoir }}</p>
|
||||||
|
</div>
|
||||||
|
<ng-template #content let-modal>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="modal-basic-title">
|
||||||
|
Mettre à jour 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]="upMenuForm">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<input
|
||||||
|
type="date"
|
||||||
|
id="dateMenu"
|
||||||
|
class="form-control"
|
||||||
|
formControlName="dateMenuFc"
|
||||||
|
value="{{ menu.dateMenu }}"
|
||||||
|
placeholder="Date"
|
||||||
|
name="date"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
id="repasMidi"
|
||||||
|
class="form-control"
|
||||||
|
formControlName="repasMidiFc"
|
||||||
|
value="{{ menu.repasMidi }}"
|
||||||
|
placeholder="Repas du midi"
|
||||||
|
name="repasMidi"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
id="repasSoir"
|
||||||
|
class="form-control"
|
||||||
|
formControlName="repasSoirFc"
|
||||||
|
value="{{ menu.repasSoir }}"
|
||||||
|
placeholder="Repas du soir"
|
||||||
|
name="repasSoir"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-outline-dark"
|
||||||
|
(click)="modal.close(updateMenu(menu.id))"
|
||||||
|
>
|
||||||
|
Mettre à jour
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
<i class="bi bi-pencil-square" (click)="open(content)"></i>
|
||||||
|
<i class="bi bi-trash3" (click)="deleteMenu(menu.id)"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,3 +1,36 @@
|
||||||
.menu {
|
.card {
|
||||||
margin-left: 500px;
|
min-height: 22rem;
|
||||||
|
margin-left: 75px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
border: 1px solid #f7c02b;
|
||||||
|
border-radius: 8px;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 5px 5px 5px gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
margin-top: 20px;
|
||||||
|
background-color: #fad980;
|
||||||
|
margin-left: -8px;
|
||||||
|
width: 13rem;
|
||||||
|
border: 1px solid #fad980;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
.bi {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
margin-top: 10px;
|
||||||
|
color: black;
|
||||||
|
box-shadow: 5px 5px 5px gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jour {
|
||||||
|
font-weight: bolder;
|
||||||
|
font-size: 25px;
|
||||||
|
}
|
||||||
|
.repas {
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { Menu } from 'src/app/models/menu';
|
import { Menu } from 'src/app/models/menu';
|
||||||
import { MenusService } from 'src/app/services/menus.service';
|
import { MenusService } from 'src/app/services/menus.service';
|
||||||
|
@ -22,6 +22,8 @@ closeResult = '';
|
||||||
public listMenus:any[];
|
public listMenus:any[];
|
||||||
public menuId : any;
|
public menuId : any;
|
||||||
public menuForm : FormGroup;
|
public menuForm : FormGroup;
|
||||||
|
public upMenuForm : FormGroup;
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private menusService: MenusService,
|
private menusService: MenusService,
|
||||||
|
@ -31,32 +33,77 @@ public menuForm : FormGroup;
|
||||||
private fb: FormBuilder
|
private fb: FormBuilder
|
||||||
) {
|
) {
|
||||||
this.listMenus=[];
|
this.listMenus=[];
|
||||||
this.menuId=0;
|
|
||||||
this.menuForm = new FormGroup({});
|
this.menuForm = new FormGroup({});
|
||||||
}
|
this.upMenuForm = this.initForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete d'un menu
|
||||||
|
deleteMenu(id_menu : number): void {
|
||||||
|
window.alert("Le menu a bien été supprimé!")
|
||||||
|
this.menusService.deleteMenu(id_menu)?.subscribe((resp) => {
|
||||||
|
this.router.navigate(['menu']);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//updateMenu
|
||||||
|
updateMenu(id_menu : number): void {
|
||||||
|
|
||||||
|
const dateValue = this.menuForm.value['dateMenuFc'];
|
||||||
|
const repasMidiValue = this.menuForm.value['repasMidiFc'];
|
||||||
|
const repasSoirValue = this.menuForm.value['repasSoirFc'];
|
||||||
|
|
||||||
|
|
||||||
|
const menu: Menu = {
|
||||||
|
dateMenu: dateValue,
|
||||||
|
repasMidi: repasMidiValue,
|
||||||
|
repasSoir: repasSoirValue,
|
||||||
|
id: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(id_menu);
|
||||||
|
|
||||||
|
this.menusService.updateMenu(menu, id_menu)?.subscribe((resp) => {
|
||||||
|
console.log("ok");
|
||||||
|
this.router.navigate(['menu']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//Méthode qui initialise les champs du formulaire avec les infos de la BDD
|
||||||
|
private initForm(menu?: Menu): FormGroup {
|
||||||
|
return this.fb.group({
|
||||||
|
dateMenu: [menu ? menu.dateMenu : ''],
|
||||||
|
libelle: [menu ? menu.repasMidi : ''],
|
||||||
|
repas: [menu ? menu.repasSoir : ''],
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//ajout d'un menu
|
//ajout d'un menu
|
||||||
saveMenu(): void {
|
saveMenu(): void {
|
||||||
|
|
||||||
const dateValue = this.menuForm.value['dateMenuFc'];
|
const dateValue = this.menuForm.value['dateMenuFc'];
|
||||||
const libelleValue = this.menuForm.value['libelleFc'];
|
const repasMidiValue = this.menuForm.value['repasMidiFc'];
|
||||||
|
const repasSoirValue = this.menuForm.value['repasSoirFc'];
|
||||||
|
|
||||||
|
|
||||||
const menu: Menu = {
|
const menu: Menu = {
|
||||||
dateMenu: dateValue,
|
dateMenu: dateValue,
|
||||||
libelle: libelleValue,
|
repasMidi: repasMidiValue,
|
||||||
|
repasSoir: repasSoirValue,
|
||||||
|
id: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// if (menu.dateMenu != undefined && menu.libelle != '') {
|
if (menu.dateMenu !=='') {
|
||||||
|
|
||||||
console.log(dateValue);
|
console.log(menu.dateMenu);
|
||||||
this.menusService.addMenu(menu)?.subscribe((resp) => {
|
this.menusService.addMenu(menu)?.subscribe((resp) => {
|
||||||
this.router.navigate(['menu']);
|
this.router.navigate(['menu']);
|
||||||
});
|
});
|
||||||
// } else {
|
} else {
|
||||||
// this.router.navigate(['menu']);
|
this.router.navigate(['accueil']);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,12 +113,15 @@ saveMenu(): void {
|
||||||
this.menusService.getMenu()?.subscribe((listMenus: any[])=>{
|
this.menusService.getMenu()?.subscribe((listMenus: any[])=>{
|
||||||
console.log(listMenus);
|
console.log(listMenus);
|
||||||
this.listMenus=listMenus;
|
this.listMenus=listMenus;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.menuForm = this.fb.group(
|
this.menuForm = this.fb.group(
|
||||||
{
|
{
|
||||||
dateMenuFc: new FormControl('',[Validators.required]),
|
dateMenuFc: new FormControl('',[Validators.required]),
|
||||||
libelleFc: new FormControl('',[Validators.required]),
|
libelleFc: new FormControl('',[Validators.required]),
|
||||||
|
repasFc: new FormControl('',[Validators.required]),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -99,11 +149,3 @@ open(content: any) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ import { Membre } from './membre';
|
||||||
import { Team } from './team';
|
import { Team } from './team';
|
||||||
|
|
||||||
export interface Menu {
|
export interface Menu {
|
||||||
libelle: string;
|
dateMenu: string;
|
||||||
dateMenu: Date;
|
repasMidi: string;
|
||||||
|
repasSoir: string;
|
||||||
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,32 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
<app-meteo></app-meteo>
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3 class="titre">Bienvenue {{conectedUser.prenom}}!!</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row d-flex align-items-center flex-row">
|
||||||
|
|
||||||
|
<div class="col-4">
|
||||||
|
<div class="flex-row border">
|
||||||
|
<app-meteo></app-meteo>
|
||||||
|
</div>
|
||||||
|
<div class="flex-row border">
|
||||||
|
<span>Humeur en attente component</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-8 border">
|
||||||
|
<app-calendrier>A venir</app-calendrier>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="d-flex justify-content-center">
|
<div class="row">
|
||||||
<button button type="button" class="btn btn-primary btn-lg" routerLink="../creation-team"
|
<app-card-member>A modifier</app-card-member>
|
||||||
routerLinkActive="active-custom">Créer ma team</button>
|
</div>
|
||||||
</div>
|
|
||||||
|
</div>
|
|
@ -1,5 +1,22 @@
|
||||||
|
.titre{
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.meteo {
|
.meteo {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: 300px;
|
margin-left: 500px;
|
||||||
margin-top: -60px;
|
margin-top: -60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid 8c2e9b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.calendrier{
|
||||||
|
align-content: flex-end;
|
||||||
|
}
|
|
@ -1,4 +1,8 @@
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { MembreService } from 'src/app/services/membre.service';
|
||||||
|
import { TokenService } from 'src/app/services/token.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-page-dashboard',
|
selector: 'app-page-dashboard',
|
||||||
|
@ -7,9 +11,26 @@ import { Component, OnInit } from '@angular/core';
|
||||||
})
|
})
|
||||||
export class PageDashboardComponent implements OnInit {
|
export class PageDashboardComponent implements OnInit {
|
||||||
|
|
||||||
constructor() { }
|
conectedUser: any;
|
||||||
|
|
||||||
ngOnInit(): void {
|
constructor(private membreService: MembreService,
|
||||||
|
private http: HttpClient,
|
||||||
|
private router: Router,
|
||||||
|
private tokenService: TokenService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.membreService.getMembreId(this.tokenService.getCurrentMembreId()).subscribe((result) => {
|
||||||
|
this.conectedUser = result ;
|
||||||
|
console.log(result);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// récuperer l id du membre s=qui est connecté
|
||||||
|
//recuperer l id dans le token grace au user id du getCurrentMembreId
|
||||||
|
// placer ce userId dans la methode getMembreId a la place de l id
|
||||||
|
//********************************************************************
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,12 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-auto">
|
<div class="col-md-auto">
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar class="sidebarMenu"></app-side-bar>
|
||||||
</div>
|
</div>
|
||||||
<div class=" col compte text-center">
|
<div class="col menu text-center">
|
||||||
<h1>Menu de la semaine</h1>
|
<h2>Menu de la semaine</h2>
|
||||||
<main class="contenu-compte">
|
<main class="contenu-menu">
|
||||||
<app-card-menu></app-card-menu>
|
<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>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -21,12 +21,11 @@ export class MembreService {
|
||||||
}
|
}
|
||||||
|
|
||||||
getMembreId(id: any): Observable<any> {
|
getMembreId(id: any): Observable<any> {
|
||||||
return this.http.get(`${this.apiUrl}/membres/1` + id);
|
return this.http.get(`${this.apiUrl}/membres/` + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
addMembre(membre: Membre): Observable<any> {
|
addMembre(membre: Membre): Observable<any> {
|
||||||
console.log(membre);
|
console.log(membre);
|
||||||
|
|
||||||
return this.http.post(`${this.apiUrl}/membres/sign-up`, membre);
|
return this.http.post(`${this.apiUrl}/membres/sign-up`, membre);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,17 @@ apiUrl: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteMenu(id: any): Observable<any> {
|
deleteMenu(id:number): Observable<any> {
|
||||||
return this.http.delete(`${this.apiUrl}/menus/delete/`+ id);
|
return this.http.delete(`${this.apiUrl}/menus/delete/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMenu(menu: Menu): Observable<any> {
|
|
||||||
return this.http.put(`${this.apiUrl}/contacts/update/`, menu);
|
updateMenu(menu: Menu, id:number): Observable<any> | void {
|
||||||
}
|
const teamId = this.tokenService.getCurrentTeamId();
|
||||||
|
if (teamId){
|
||||||
|
return this.http.put(`${this.apiUrl}/menus/update/${teamId}/${id}`, menu);
|
||||||
|
}else {
|
||||||
|
this.router.navigate(['accueil']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ tokenKey = environment.tokenKey;
|
||||||
const token = this.getToken();
|
const token = this.getToken();
|
||||||
if(token) {
|
if(token) {
|
||||||
const decodedToken = jwt_decode<any>(token);
|
const decodedToken = jwt_decode<any>(token);
|
||||||
const userId = decodedToken.sub;
|
const userId = decodedToken.userId;
|
||||||
return userId;
|
return userId;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue