Skip to content
Snippets Groups Projects
Commit 9f8e4016 authored by Hamza Touizrat's avatar Hamza Touizrat
Browse files

Merge branch 'authorize-valid-profile' into 'master'

Authorize valid profile

See merge request !75
parents 40226839 e8a980a3
No related branches found
No related tags found
1 merge request!75Authorize valid profile
{
"python.pythonPath": "C:\\Users\\feliv\\anaconda3\\python.exe"
}
\ No newline at end of file
import { Injectable } from '@angular/core';
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {ActivatedRoute,Router} from '@angular/router' import {ActivatedRoute,Router} from '@angular/router'
import {PersonalData} from '../core' import {PersonalData} from '../core'
import * as moment from 'moment' import * as moment from 'moment'
import {User} from 'app/core' import {User} from 'app/core'
@Injectable({
providedIn: 'root',
})
@Component({ @Component({
selector: 'app-my-data', selector: 'app-my-data',
templateUrl: './my-data.component.html', templateUrl: './my-data.component.html',
...@@ -11,10 +18,13 @@ import {User} from 'app/core' ...@@ -11,10 +18,13 @@ import {User} from 'app/core'
}) })
export class MyDataComponent implements OnInit{ export class MyDataComponent implements OnInit{
personalData: PersonalData; private personalData: PersonalData;
validatedAccount : String; public validatedAccount : String;
dateNow: Date; public dateNow: Date;
currentYear: String; public currentYear: String;
public validState: boolean;
public grade = { public grade = {
"troisieme": "Troisième", "troisieme": "Troisième",
...@@ -25,6 +35,16 @@ export class MyDataComponent implements OnInit { ...@@ -25,6 +35,16 @@ export class MyDataComponent implements OnInit {
} }
public getValidState() : boolean {
if (this.validatedAccount=="Validé"){
return true
}
else {
return false
}
}
//Styles validated account label depending on the status of the account //Styles validated account label depending on the status of the account
public styleValidatedAccount = ()=> { public styleValidatedAccount = ()=> {
if(this.validatedAccount==="Données personnelles non remplies"){ if(this.validatedAccount==="Données personnelles non remplies"){
...@@ -68,13 +88,16 @@ export class MyDataComponent implements OnInit { ...@@ -68,13 +88,16 @@ export class MyDataComponent implements OnInit {
} }
if(this.personalData.registration.validated){ if(this.personalData.registration.validated){
this.validatedAccount= "Validé" this.validatedAccount= "Validé";
}else if(this.personalData.year===this.currentYear){ }else if(this.personalData.year===this.currentYear){
this.validatedAccount="En cours de validation" this.validatedAccount="En cours de validation";
}else{ }else{
this.validatedAccount="Données personnelles non remplies" this.validatedAccount="Données personnelles non remplies";
} }
} }
} }
...@@ -111,6 +111,7 @@ export class VisitAdapter implements IAdapter<Visit> { ...@@ -111,6 +111,7 @@ export class VisitAdapter implements IAdapter<Visit> {
registrationsOpen: data.registrations_open, registrationsOpen: data.registrations_open,
image: data.image, image: data.image,
factSheet: data.fact_sheet, factSheet: data.fact_sheet,
contextSheet: data.context_sheet,
permissionSheet: data.permission, permissionSheet: data.permission,
participants: participants, participants: participants,
organizers: organizers, organizers: organizers,
......
...@@ -36,6 +36,7 @@ export class Visit { ...@@ -36,6 +36,7 @@ export class Visit {
registrationsOpen: boolean; registrationsOpen: boolean;
image: string; image: string;
factSheet: string; factSheet: string;
contextSheet: string;
permissionSheet: string; permissionSheet: string;
participants: Participant[]; participants: Participant[];
organizers: Organizer[]; organizers: Organizer[];
...@@ -55,6 +56,7 @@ export class Visit { ...@@ -55,6 +56,7 @@ export class Visit {
registrationsOpen: boolean, registrationsOpen: boolean,
image: string; image: string;
factSheet?: string; factSheet?: string;
contextSheet?: string;
permissionSheet?: string; permissionSheet?: string;
participants?: Participant[]; participants?: Participant[];
organizers?: Organizer[], organizers?: Organizer[],
...@@ -73,6 +75,7 @@ export class Visit { ...@@ -73,6 +75,7 @@ export class Visit {
this.registrationsOpen = opts.registrationsOpen; this.registrationsOpen = opts.registrationsOpen;
this.image = opts.image; this.image = opts.image;
this.factSheet = opts.factSheet; this.factSheet = opts.factSheet;
this.contextSheet = opts.contextSheet;
this.permissionSheet = opts.permissionSheet; this.permissionSheet = opts.permissionSheet;
this.participants = opts.participants || []; this.participants = opts.participants || [];
this.organizers = opts.organizers || []; this.organizers = opts.organizers || [];
......
<div id="visit"> <div id="visit">
<app-register-form [visible]="registerFormActive" (closed)="registerFormActive = false" [userId]="userId" [visit]="visit" (participate)="onParticipate($event)"></app-register-form> <app-register-form [visible]="registerFormActive" (closed)="registerFormActive = false" [userId]="userId"
[visit]="visit" (participate)="onParticipate($event)"></app-register-form>
<app-leave-form [visible]="leaveFormActive" (closed)="leaveFormActive = false" [visit]="visit" [userId]="userId" (left)="participant = null"></app-leave-form> <app-leave-form [visible]="leaveFormActive" (closed)="leaveFormActive = false" [visit]="visit" [userId]="userId"
(left)="participant = null"></app-leave-form>
<div class="text-center"> <div class="text-center">
<h1>{{ visit.title }}</h1> <h1>{{ visit.title }}</h1>
<p> <p>
<strong>{{ visit.date | date:"EEEE d MMMM" }} – {{ visit.startTime | date:"shortTime"}}</strong> – {{ visit.place.name }} <strong>{{ visit.date | date:"EEEE d MMMM" }} – {{ visit.startTime | date:"shortTime"}}</strong> – {{
visit.place.name }}
</p> </p>
<p *ngIf="visit.summary" class="text-muted"> <p *ngIf="visit.summary" class="text-muted">
...@@ -15,28 +18,26 @@ ...@@ -15,28 +18,26 @@
<!-- Metadata badges --> <!-- Metadata badges -->
<div> <div>
<app-registration-badge <app-registration-badge [title]="visit.title" [open]="visit.registrationsOpen" [passed]="visit.passed"
[title]="visit.title"
[open]="visit.registrationsOpen"
[passed]="visit.passed"
[deadline]="visit.deadline"></app-registration-badge> [deadline]="visit.deadline"></app-registration-badge>
<app-participant-number-badge <app-participant-number-badge [number]="acceptedParticipants"></app-participant-number-badge>
[number]="acceptedParticipants"></app-participant-number-badge>
<span *ngIf="participant"> <span *ngIf="participant">
<app-participation-badge <app-participation-badge [accepted]="participant.accepted" [passed]="visit.passed"></app-participation-badge>
[accepted]="participant.accepted"
[passed]="visit.passed"></app-participation-badge>
</span> </span>
</div> </div>
<!-- Show register button if user does not participate --> <!-- Show register button if user does not participate -->
<div *ngIf="visit.registrationsOpen && !participant" class="text-center"> <div *ngIf="visit.registrationsOpen && !participant" class="text-center">
<button id="participate-btn" type="button" name="button" class="btn-success" (click)="registerFormActive = true">Je m'inscris</button> <button id="participate-btn" type="button" name="button" class="btn-primary" [disabled]="!isValid" (click)="registerFormActive = true">
Je m'inscris</button>
</div> </div>
<div *ngIf="participant && !visit.passed"> <div class="text-muted-sm">{{errorMessageRegistration}}</div>
<div *ngIf="participant && !visit.passed">
<!-- And a shy-ish unregister link --> <!-- And a shy-ish unregister link -->
<p class="text-muted-sm"> <p class="text-muted-sm">
Tu as un empêchement et souhaites Tu as un empêchement et souhaites
...@@ -47,10 +48,17 @@ ...@@ -47,10 +48,17 @@
<!-- Related documents --> <!-- Related documents -->
<p class="alert alert-info" *ngIf="visit.permissionSheet"> <p class="alert alert-info" *ngIf="visit.permissionSheet">
<i class="fa fa-exclamation-triangle"></i>Avant de te rendre à la sortie, télécharge <a [href]="visit.permissionSheet">l'autorisation de sortie</a>. Fais-la remplir par tes parents et remets-la aux tuteurs le jour de la sortie. <i class="fa fa-exclamation-triangle"></i>Avant de te rendre à la sortie, télécharge <a
[href]="visit.permissionSheet">l'autorisation de sortie</a>. Fais-la remplir par tes parents et remets-la aux
tuteurs le jour de la sortie.
</p> </p>
<p class="alert alert-default" *ngIf="visit.factSheet"> <p class="alert alert-default" *ngIf="visit.factSheet">
<i class="fa fa-file-text"></i> Les organisateurs ont rédigé une <a [href]="visit.factSheet">fiche sortie</a>. N'hésite pas à en prendre connaissance avant de te rendre à la sortie ! <i class="fa fa-file-text"></i> Les organisateurs ont rédigé une <a [href]="visit.factSheet">fiche sortie</a>.
N'hésite pas à en prendre connaissance avant de te rendre à la sortie !
</p>
<p class="alert alert-default" *ngIf="visit.contextSheet">
<i class="fa fa-file-text"></i> Les organisateurs ont rédigé une <a [href]="visit.contextSheet">fiche de
contexte</a> sur la sortie. N'hésite pas à en prendre connaissance avant de te rendre à la sortie !
</p> </p>
</div> </div>
...@@ -71,9 +79,7 @@ ...@@ -71,9 +79,7 @@
<app-useful-information [visit]="visit"></app-useful-information> <app-useful-information [visit]="visit"></app-useful-information>
<h2>Se rendre à cette sortie</h2> <h2>Se rendre à cette sortie</h2>
<app-visit-location-map <app-visit-location-map [geocoder]="geocoder" [address]="visit.address"></app-visit-location-map>
[geocoder]="geocoder"
[address]="visit.address"></app-visit-location-map>
<div *ngIf="visit.organizers.length > 0"> <div *ngIf="visit.organizers.length > 0">
<h2>Tuteurs organisateurs</h2> <h2>Tuteurs organisateurs</h2>
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
margin-top: 1em; margin-top: 1em;
} }
img#illustration { img#illustration {
display: block; display: block;
margin: 1em auto; margin: 1em auto;
......
...@@ -3,6 +3,11 @@ import { Observable, Subject } from 'rxjs'; ...@@ -3,6 +3,11 @@ import { Observable, Subject } from 'rxjs';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { AuthService, Geocoder } from 'app/core'; import { AuthService, Geocoder } from 'app/core';
import { Visit, Participant } from '../shared'; import { Visit, Participant } from '../shared';
import {MyDataComponent} from 'app/members/account/my-data/my-data.component';
@Component({ @Component({
selector: 'app-visit-detail', selector: 'app-visit-detail',
...@@ -19,18 +24,27 @@ export class VisitDetailComponent implements OnInit { ...@@ -19,18 +24,27 @@ export class VisitDetailComponent implements OnInit {
formLoading: boolean = false; formLoading: boolean = false;
leaveFormActive = false; leaveFormActive = false;
geocoder: Geocoder; geocoder: Geocoder;
errorMessageRegistration= "";
isValid : boolean;
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
private auth: AuthService, private auth: AuthService,
) { } private dataC: MyDataComponent,
) {this.isValid=dataC.getValidState()}
ngOnInit() { ngOnInit() {
this.visit = this.route.snapshot.data['visit']; this.visit = this.route.snapshot.data['visit'];
this.geocoder = this.route.snapshot.data['geocoder']; this.geocoder = this.route.snapshot.data['geocoder'];
this.userId = this.auth.getUserSnapshot().id; this.userId = this.auth.getUserSnapshot().id;
this.getParticipant(); this.getParticipant();
this.getAcceptedParticipants(); this.getAcceptedParticipants();
if (!this.isValid)
{
this.errorMessageRegistration="Tu dois valider ton compte pour pouvoir t'inscrire aux sorties."
}
} }
getParticipant() { getParticipant() {
...@@ -52,3 +66,4 @@ export class VisitDetailComponent implements OnInit { ...@@ -52,3 +66,4 @@ export class VisitDetailComponent implements OnInit {
} }
} }
...@@ -127,7 +127,7 @@ export class StudentSignupComponent implements OnInit { ...@@ -127,7 +127,7 @@ export class StudentSignupComponent implements OnInit {
tap(() => this.loading = false), tap(() => this.loading = false),
tap(() => { tap(() => {
setTimeout(()=>{ setTimeout(()=>{
this.router.navigate(['./membres']) this.router.navigate(['./membres/compte/donnees'])
},3000)}) },3000)})
......
src/favicon.ico

5.3 KiB | W: | H:

src/favicon.ico

63.9 KiB | W: | H:

src/favicon.ico
src/favicon.ico
src/favicon.ico
src/favicon.ico
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment