commit
a0ecb2419d
30 changed files with 254 additions and 239 deletions
|
@ -5,7 +5,6 @@ import { PageAccueilComponent } from './pages/page-accueil/page-accueil.componen
|
|||
import { PageAddMemberComponent } from './pages/page-add-member/page-add-member.component';
|
||||
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 { PageDeleteMemberComponent } from './pages/page-delete-member/page-delete-member.component';
|
||||
import { PageForgotPasswordComponent } from './pages/page-forgot-password/page-forgot-password.component';
|
||||
|
@ -30,7 +29,7 @@ const routes: Routes = [
|
|||
{ path: 'ajout-membre', canActivate: [AuthGuard], component: PageAddMemberComponent },
|
||||
{ path: 'agenda', canActivate: [AuthGuard], component: PageAgendaComponent },
|
||||
{ path: 'tableau-de-bord', canActivate: [AuthGuard], component: PageDashboardComponent },
|
||||
{ path: 'supprimer-membre', canActivate: [AuthGuard], component: PageDeleteMemberComponent },
|
||||
{ path: 'supprimer-membre/:id', canActivate: [AuthGuard], component: PageDeleteMemberComponent },
|
||||
{ path: 'password-oublie', component: PageForgotPasswordComponent },
|
||||
{ path: 'menu', canActivate: [AuthGuard], component: PageMenuSemaineComponent },
|
||||
{ path: 'repertoire', canActivate: [AuthGuard], component: PageRepertoireComponent },
|
||||
|
@ -40,7 +39,6 @@ const routes: Routes = [
|
|||
{ path: 'to-do-list', canActivate: [AuthGuard], component: PageToDoListComponent },
|
||||
{ path: 'modifier-membre/:id', canActivate: [AuthGuard], component: PageUpdateMemberComponent },
|
||||
{ path: 'ajouter-contact', canActivate: [AuthGuard], component: PageAjoutContactComponent },
|
||||
{ path: 'creation-team', canActivate: [AuthGuard], component: PageCreationTeamComponent },
|
||||
{ path: 'footer', component: FooterComponent},
|
||||
{ path: 'ajout-evenement', canActivate: [AuthGuard], component: PageAjoutEvenementsComponent },
|
||||
{ path: '**', component: PageNotFoundComponent },
|
||||
|
|
|
@ -30,7 +30,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|||
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 { FooterComponent } from './components/footer/footer.component';
|
||||
import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular";
|
||||
|
@ -73,7 +72,6 @@ registerLocaleData(localeFr)
|
|||
CreneauComponent,
|
||||
PageAjoutContactComponent,
|
||||
PageModifierContactComponent,
|
||||
PageCreationTeamComponent,
|
||||
FooterComponent,
|
||||
CardAvatarComponent,
|
||||
DeconnexionComponent,
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
<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/{{membre.id}}"
|
||||
routerLinkActive="active-custom">
|
||||
routerLinkActive="active-custom"
|
||||
[hidden]="parent == false">
|
||||
Modifier
|
||||
</button><button button type="button" class="btn btn-primary px-4"
|
||||
routerLink="../supprimer-membre"
|
||||
routerLinkActive="active-custom">
|
||||
routerLink="../supprimer-membre/{{membre.id}}"
|
||||
routerLinkActive="active-custom"
|
||||
[hidden]="parent == false">
|
||||
Supprimer
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
.mt-5 {
|
||||
margin-top: 0rem !important;
|
||||
}
|
||||
|
||||
#couleur{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { TokenService } from 'src/app/services/token.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-card-member',
|
||||
|
@ -7,10 +8,24 @@ import { Component, Input, OnInit } from '@angular/core';
|
|||
})
|
||||
export class CardMemberComponent implements OnInit {
|
||||
@Input() membre: any;
|
||||
parent: boolean;
|
||||
|
||||
constructor() { }
|
||||
constructor(private tokenService: TokenService) {
|
||||
this.parent = false;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
/** Récupérer le rôle de l'uilisateur connecté pour lui imposer des limitations s'il a un ROLE_ENFANT **/
|
||||
/** Il s'agit de cacher les boutons qui permettent de modifier et supprimer les profils (html)**/
|
||||
const userRole = this.tokenService.getRole();
|
||||
if(userRole == "ROLE_PARENT"){
|
||||
this.parent = true;
|
||||
console.log('Rôle : ' + userRole);
|
||||
}
|
||||
else if(userRole== "ROLE_ENFANT"){
|
||||
this.parent = false;
|
||||
console.log('Rôle : ' + userRole);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,5 @@
|
|||
type="button"
|
||||
class="btn btn-outline-primary btn-circle btn-xl"
|
||||
(click)="onClickDeco()"
|
||||
>
|
||||
Se déconnecter
|
||||
> Déconnexion
|
||||
</button>
|
||||
|
|
|
@ -1,10 +1,25 @@
|
|||
.btn-circle.btn-xl {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
padding: 10px 16px;
|
||||
border-radius: 40px;
|
||||
font-size: 10px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
padding: 10px;
|
||||
border-radius: 15px;
|
||||
background-color: white;
|
||||
font-size: 12px;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.btn-circle.btn-xl:hover {
|
||||
width: auto;
|
||||
height: auto;
|
||||
padding: 10px;
|
||||
border-radius: 15px;
|
||||
background-color: #5d5fef;
|
||||
font-size: 12px;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
float: right;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
.liens {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
color : blue;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
a{
|
||||
color: rgb(54, 54, 54);
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 20px;
|
||||
margin-top: 40px;
|
||||
margin-bottom: 0px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
h3{
|
||||
color : blue;
|
||||
color :rgb(54, 54, 54);
|
||||
font-size : 16px;
|
||||
}
|
||||
font-weight: bold;
|
||||
}
|
||||
|
|
|
@ -4,16 +4,8 @@
|
|||
<img id="img" src="../../../assets/images/logo-organizee.png" />
|
||||
Organizee
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarText">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item"></li>
|
||||
</ul>
|
||||
<span class="navbar-text">
|
||||
<app-deconnexion *ngIf="isLogged"></app-deconnexion>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="navbarText">
|
||||
<app-deconnexion *ngIf="isLogged" ></app-deconnexion>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
#img {
|
||||
height:95px;
|
||||
height:45px;
|
||||
}
|
||||
|
||||
.navbar{
|
||||
height: auto;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
font-weight: bold;
|
||||
font-size: 3rem;
|
||||
font-size: 2rem;
|
||||
color: #5d5fef;
|
||||
}
|
||||
|
||||
|
@ -27,4 +33,4 @@ a:active {
|
|||
|
||||
.container-fluid{
|
||||
width:90%;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
width: auto;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
//background-color: #c3c3e7;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
.nav{
|
||||
margin-top: 20px;
|
||||
|
@ -19,5 +20,9 @@ li {
|
|||
|
||||
a{
|
||||
color: black;
|
||||
background-color: white;
|
||||
font-weight: bold;
|
||||
padding: none;
|
||||
margin-bottom: 10px;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { Team } from "./team";
|
||||
|
||||
export interface Membre {
|
||||
id: string;
|
||||
nom: string;
|
||||
|
@ -7,6 +9,6 @@ export interface Membre {
|
|||
dateNaissance: Date;
|
||||
couleur: string;
|
||||
passwordConfirm: string;
|
||||
// smiley: string;
|
||||
//team: Team;
|
||||
roleList: string[];
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
export interface Team {
|
||||
id: string;
|
||||
nom : string;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
<app-side-bar [backgroundColor]="'#7879F1'"></app-side-bar>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-9 offset-2" id="main">
|
||||
<h1 class="col-md-auto">{{ currentTeam.nom }}</h1>
|
||||
<div>
|
||||
<div class="contenu">
|
||||
<!-- Pour récupérer le membre connecté-->
|
||||
<div class="d-flex justify-content-center">
|
||||
<app-card-member [membre]="currentUser"> </app-card-member>
|
||||
|
@ -16,6 +16,7 @@
|
|||
class="btn btn-primary btn-lg"
|
||||
routerLink="../ajout-membre"
|
||||
routerLinkActive="active-custom"
|
||||
[hidden]="parent == false"
|
||||
>
|
||||
Ajouter un membre
|
||||
</button>
|
||||
|
|
|
@ -12,6 +12,7 @@ ng-container{
|
|||
|
||||
#bouton-ajout {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #7879F1 !important;
|
||||
background-color: #7879F1;
|
||||
color: #fff;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { MembreService } from 'src/app/services/membre.service';
|
||||
import { TeamService } from 'src/app/services/team.service';
|
||||
import { TokenService } from 'src/app/services/token.service';
|
||||
|
@ -15,12 +14,13 @@ export class PageAccountComponent implements OnInit {
|
|||
public listMembres: any[];
|
||||
currentUser: any;
|
||||
currentTeam: any;
|
||||
parent: boolean;
|
||||
|
||||
constructor(private membreService: MembreService,
|
||||
private teamService: TeamService,
|
||||
private tokenService: TokenService,
|
||||
private router: Router) {
|
||||
private tokenService: TokenService) {
|
||||
this.listMembres = [];
|
||||
this.parent = false;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
@ -36,5 +36,18 @@ export class PageAccountComponent implements OnInit {
|
|||
this.membreService.getMembresByTeamId()?.subscribe((membres: any[]) => {
|
||||
this.listMembres = membres;
|
||||
});
|
||||
|
||||
/** Récupérer le rôle de l'uilisateur connecté pour lui imposer des limitations s'il a un ROLE_ENFANT **/
|
||||
/** Il s'agit de cacher les boutons qui permettent de modifier et supprimer les profils (html)**/
|
||||
const userRole = this.tokenService.getRole();
|
||||
if(userRole == "ROLE_PARENT"){
|
||||
this.parent = true;
|
||||
console.log('Rôle : ' + userRole);
|
||||
}
|
||||
else if(userRole== "ROLE_ENFANT"){
|
||||
this.parent = false;
|
||||
console.log('Rôle : ' + userRole);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
<app-side-bar [backgroundColor]="'#7879F1'"></app-side-bar>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-9 offset-2" id="main">
|
||||
|
@ -161,3 +161,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
}
|
||||
h1{
|
||||
color: rgba(0, 0, 0, 0.658);
|
||||
font-size: 34px;
|
||||
font-size: 28px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
<app-header></app-header>
|
||||
|
||||
<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>
|
|
@ -1,41 +0,0 @@
|
|||
.team-form{
|
||||
margin-top: 20px;
|
||||
align-content: center;
|
||||
|
||||
}
|
||||
|
||||
button{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.login-form {
|
||||
height: 100vh;
|
||||
padding-top: 40px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.form-team {
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.form-team .checkbox {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.form-team .form-floating:focus-within {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.form-team input[type="email"] {
|
||||
margin-bottom: -1px;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.form-team input[type="password"] {
|
||||
margin-bottom: 10px;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PageCreationTeamComponent } from './page-creation-team.component';
|
||||
|
||||
describe('PageCreationTeamComponent', () => {
|
||||
let component: PageCreationTeamComponent;
|
||||
let fixture: ComponentFixture<PageCreationTeamComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PageCreationTeamComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PageCreationTeamComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -1,71 +0,0 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {
|
||||
FormBuilder,
|
||||
FormControl,
|
||||
FormGroup,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { Team } from 'src/app/models/team';
|
||||
import { MembreService } from 'src/app/services/membre.service';
|
||||
import { TeamService } from 'src/app/services/team.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-creation-team',
|
||||
templateUrl: './page-creation-team.component.html',
|
||||
styleUrls: ['./page-creation-team.component.scss'],
|
||||
})
|
||||
export class PageCreationTeamComponent implements OnInit {
|
||||
public teamForm: FormGroup;
|
||||
constructor(
|
||||
private teamService: TeamService,
|
||||
private membreService: MembreService,
|
||||
private router: Router,
|
||||
private fb: FormBuilder
|
||||
) {
|
||||
this.teamForm = new FormGroup({});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// *********************************penser a changer group car déprécié********************************
|
||||
this.teamForm = new FormGroup({
|
||||
nameFc : new FormControl('', [Validators.required])
|
||||
});
|
||||
}
|
||||
|
||||
public onSubmit(): void {
|
||||
console.log('value : ', this.teamForm.value);
|
||||
console.log('form : ', this.teamForm);
|
||||
const nameValue = this.teamForm.value['nameFc'];
|
||||
|
||||
const team: Team = {
|
||||
nom : nameValue,
|
||||
};
|
||||
if (team.nom !== '' ) {
|
||||
this.teamService.addTeam(team).subscribe((resp) => {
|
||||
this.router.navigate(['compte']);
|
||||
});
|
||||
} else {
|
||||
// affichage erreur
|
||||
}
|
||||
}
|
||||
|
||||
ConfirmedValidator(controlName: string, matchingControlName: string) {
|
||||
return (formGroup: FormGroup) => {
|
||||
const control = formGroup.controls[controlName];
|
||||
const matchingControl = formGroup.controls[matchingControlName];
|
||||
if (
|
||||
matchingControl.errors &&
|
||||
!matchingControl.errors['confirmedValidator']
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (control.value !== matchingControl.value) {
|
||||
matchingControl.setErrors({ confirmedValidator: true });
|
||||
} else {
|
||||
matchingControl.setErrors(null);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -2,10 +2,33 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar></app-side-bar>
|
||||
<app-side-bar [backgroundColor]="'#7879F1'"></app-side-bar>
|
||||
</div>
|
||||
<div class="col compte text-center">
|
||||
<h1>Supprimer ce membre</h1>
|
||||
<main class="contenu-compte"></main>
|
||||
<div class="col text-center">
|
||||
<main class="contenu">
|
||||
<p class="d-flex justify-content-center">Êtes-vous sur de vouloir Supprimer ce compte ?</p>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button
|
||||
id = "bouton-ajout"
|
||||
type="button"
|
||||
class="btn btn-primary btn-lg bouton-non"
|
||||
routerLink="/compte"
|
||||
routerLinkActive="active-custom"
|
||||
[hidden]="parent == false"
|
||||
>Non, je ne souhaite pas supprimer ce compte
|
||||
</button>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button
|
||||
id = "bouton-ajout"
|
||||
type="button"
|
||||
class="btn btn-primary btn-lg bouton-oui"
|
||||
(clickDelete)="onClickDelete()"
|
||||
[hidden]="parent == false"
|
||||
>Oui, je souhaite supprimer ce compte
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
.contenu{
|
||||
padding-top: 100px;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
p{
|
||||
font-size: 30px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
button{
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.bouton-non {
|
||||
margin-top: 5px;
|
||||
margin-right: 5px;
|
||||
border: 1px solid #7879F1 !important;
|
||||
background-color: #7879F1;
|
||||
height: 40px;
|
||||
width: 450px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.bouton-non:hover {
|
||||
margin-top: 5px;
|
||||
margin-right: 5px;
|
||||
border: 1px solid #68d182 !important;
|
||||
background-color: #68d182;
|
||||
color: #fff;
|
||||
height: 40px;
|
||||
width: 450px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.bouton-oui {
|
||||
margin-top: 5px;
|
||||
border: 1px solid #7879F1 !important;
|
||||
background-color: #7879F1;
|
||||
color: #fff;
|
||||
height: 40px;
|
||||
width: 450px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.bouton-oui:hover {
|
||||
margin-top: 5px;
|
||||
border: 1px solid #bd4646 !important;
|
||||
background-color: #bd4646;
|
||||
color: #fff;
|
||||
height: 40px;
|
||||
width: 450px;
|
||||
text-align: center;
|
||||
}
|
|
@ -1,4 +1,7 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MembreService } from 'src/app/services/membre.service';
|
||||
import { TokenService } from 'src/app/services/token.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-delete-member',
|
||||
|
@ -6,10 +9,50 @@ import { Component, OnInit } from '@angular/core';
|
|||
styleUrls: ['./page-delete-member.component.scss']
|
||||
})
|
||||
export class PageDeleteMemberComponent implements OnInit {
|
||||
public membreId: any;
|
||||
public membreInfos: any;
|
||||
parent: boolean;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
constructor(private membreService: MembreService,
|
||||
private tokenService: TokenService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) {
|
||||
this.membreInfos = '';
|
||||
this.parent = false;
|
||||
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
/** Pour récuperer l'id du membre à modifier **/
|
||||
this.membreId = this.route.snapshot.paramMap.get('id');
|
||||
|
||||
/** Appel Api **/
|
||||
this.membreService
|
||||
.getMembreId(this.membreId)
|
||||
.subscribe((membreInfos: any) => {
|
||||
this.membreInfos = membreInfos;
|
||||
console.log(membreInfos.id);
|
||||
});
|
||||
|
||||
/** Récupérer le rôle de l'uilisateur connecté pour lui imposer des limitations s'il a un ROLE_ENFANT **/
|
||||
/** Il s'agit de cacher les boutons qui permettent de modifier et supprimer les profils (html)**/
|
||||
const userRole = this.tokenService.getRole();
|
||||
if(userRole == "ROLE_PARENT"){
|
||||
this.parent = true;
|
||||
console.log('Rôle : ' + userRole);
|
||||
}
|
||||
else if(userRole== "ROLE_ENFANT"){
|
||||
this.parent = false;
|
||||
console.log('Rôle : ' + userRole);
|
||||
}
|
||||
}
|
||||
|
||||
/********************** Suppresion d'un membre au click ********************/
|
||||
onClickDelete(): void {
|
||||
console.log(this.membreInfos);
|
||||
this.membreService.deleteMembre(this.membreInfos.id).subscribe((resp) => {
|
||||
return resp
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import {
|
|||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { Team } from 'src/app/models/team';
|
||||
import { TeamService } from 'src/app/services/team.service';
|
||||
import { Membre } from '../../models/membre';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
|
||||
|
@ -19,6 +21,7 @@ export class PageSignupComponent implements OnInit {
|
|||
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private teamService: TeamService,
|
||||
private router: Router,
|
||||
private fb: FormBuilder
|
||||
) {
|
||||
|
@ -29,6 +32,7 @@ export class PageSignupComponent implements OnInit {
|
|||
// *********************************pensser a changer group car déprécié********************************
|
||||
this.signupForm = this.fb.group(
|
||||
{
|
||||
teamNameFc: new FormControl('', [Validators.required]),
|
||||
firstNameFc: new FormControl('', [Validators.required]),
|
||||
lastNameFc: new FormControl('', [Validators.required]),
|
||||
dateNaissanceFc: new FormControl('', [Validators.required]),
|
||||
|
@ -55,6 +59,8 @@ export class PageSignupComponent implements OnInit {
|
|||
}
|
||||
|
||||
public onSubmit(): void {
|
||||
const teamIdValue = this.signupForm.value[''];
|
||||
const teamNameValue = this.signupForm.value['teamNameFc'];
|
||||
const idValue = this.signupForm.value[''];
|
||||
const prenomValue = this.signupForm.value['firstNameFc'];
|
||||
const nomValue = this.signupForm.value['lastNameFc'];
|
||||
|
@ -65,6 +71,11 @@ export class PageSignupComponent implements OnInit {
|
|||
const couleurValue = this.signupForm.value['couleurFc'];
|
||||
const roleValue = ['ROLE_PARENT'];
|
||||
|
||||
const team: Team = {
|
||||
id : teamIdValue,
|
||||
nom : teamNameValue,
|
||||
};
|
||||
|
||||
const membre: Membre = {
|
||||
id: idValue,
|
||||
nom: nomValue,
|
||||
|
@ -74,10 +85,14 @@ export class PageSignupComponent implements OnInit {
|
|||
couleur: couleurValue,
|
||||
dateNaissance: dateNaissanceValue,
|
||||
passwordConfirm: passwordConfirmValue,
|
||||
//team: teamIdValue,
|
||||
roleList: roleValue,
|
||||
};
|
||||
|
||||
if (membre.email !== '' && membre.password !== '') {
|
||||
if (membre.email !== '' && membre.password !== '' && team.nom!== '') {
|
||||
this.teamService.addTeam(team).subscribe((resp) => {
|
||||
return resp
|
||||
});
|
||||
this.authService.signup(membre).subscribe((resp) => {
|
||||
this.router.navigate(['accueil']);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
<app-side-bar [backgroundColor]="'#7879F1'"></app-side-bar>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-9 offset-2" id="main">
|
||||
|
@ -110,3 +110,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
|
|
|
@ -103,7 +103,7 @@ export class PageUpdateMemberComponent implements OnInit {
|
|||
console.log(membre);
|
||||
|
||||
this.membreService.updateMembre(membre)?.subscribe((resp) => {
|
||||
//this.router.navigate(['compte']);
|
||||
this.router.navigate(['compte']);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,7 @@ export class AuthService {
|
|||
//methode pour s'inscrire - on passe l'objet en entier
|
||||
signup(membre: Membre): Observable<any> {
|
||||
console.log(membre);
|
||||
|
||||
return this.http.post(`${this.apiUrl}/membres/sign-up`, membre);
|
||||
|
||||
}
|
||||
|
||||
//methode pour se connecter - on passe id et pwd
|
||||
|
@ -60,8 +58,6 @@ export class AuthService {
|
|||
return this.http.post(`${this.apiUrl}/teams/add`, team);
|
||||
}
|
||||
|
||||
|
||||
|
||||
addMember(membre: Membre): Observable<any> {
|
||||
console.log(membre);
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ export class MembreService {
|
|||
}
|
||||
}
|
||||
|
||||
deleteMembre(membre: Membre): Observable<any> {
|
||||
return this.http.delete(`${this.apiUrl}/membres/delete/1`);
|
||||
deleteMembre(membre: Membre): Observable<any>{
|
||||
return this.http.delete(`${this.apiUrl}/membres/delete/${membre.id}`);
|
||||
}
|
||||
|
||||
updateMembre(membre: Membre): Observable<any> | void {
|
||||
|
|
Loading…
Add table
Reference in a new issue