---|qcm| Mise à jour du component 'QCM'
This commit is contained in:
@@ -22,6 +22,10 @@ const routes: Routes = [
|
|||||||
path: 'profile',
|
path: 'profile',
|
||||||
loadChildren: () => import('./components/profile/profile.module').then(m => m.ProfileModule)
|
loadChildren: () => import('./components/profile/profile.module').then(m => m.ProfileModule)
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'qcm',
|
||||||
|
loadChildren: () => import('./components/qcm/qcm.module').then(m => m.QCMModule)
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'settings',
|
path: 'settings',
|
||||||
loadChildren: () => import('./components/settings/settings.module').then(m => m.SettingsModule)
|
loadChildren: () => import('./components/settings/settings.module').then(m => m.SettingsModule)
|
||||||
|
|||||||
@@ -37,20 +37,19 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
|||||||
private _canopies: Subscription = new Subscription();
|
private _canopies: Subscription = new Subscription();
|
||||||
private _dropzones: Subscription = new Subscription();
|
private _dropzones: Subscription = new Subscription();
|
||||||
*/
|
*/
|
||||||
title = 'Dashboard';
|
public title = 'Dashboard';
|
||||||
errors!: Errors;
|
public errors!: Errors;
|
||||||
isAuthenticated = false;
|
public isAuthenticated = false;
|
||||||
canModify = false;
|
public canModify = false;
|
||||||
|
public aeronefAggregate!: Array<AeronefByImat>;
|
||||||
aeronefAggregate!: Array<AeronefByImat>;
|
public aeronefs!: Array<Aeronef>;
|
||||||
aeronefs!: Array<Aeronef>;
|
public aeronefsCount = 0;
|
||||||
aeronefsCount = 0;
|
public canopyAggregate!: Array<CanopyModelBySize>;
|
||||||
canopyAggregate!: Array<CanopyModelBySize>;
|
public canopies!: Array<Canopy>;
|
||||||
canopies!: Array<Canopy>;
|
public canopiesCount = 0;
|
||||||
canopiesCount = 0;
|
public dropzoneAggregate!: Array<DropZoneByYear>;
|
||||||
dropzoneAggregate!: Array<DropZoneByYear>;
|
public dropzones!: Array<DropZone>;
|
||||||
dropzones!: Array<DropZone>;
|
public dropzonesCount = 0;
|
||||||
dropzonesCount = 0;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@a
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { Question } from 'src/app/core/models';
|
import { Question } from 'src/app/core/models';
|
||||||
import { JumpsService } from 'src/app/core/services';
|
import { QCMService } from 'src/app/core/services';
|
||||||
import { catchError } from 'rxjs/operators';
|
import { catchError } from 'rxjs/operators';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class QCMResolver implements Resolve<Question> {
|
export class QCMResolver implements Resolve<Question> {
|
||||||
constructor(
|
constructor(
|
||||||
private _jumpsService: JumpsService,
|
private _qcmService: QCMService,
|
||||||
private router: Router
|
private router: Router
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ export class QCMResolver implements Resolve<Question> {
|
|||||||
state: RouterStateSnapshot
|
state: RouterStateSnapshot
|
||||||
): Observable<any> {
|
): Observable<any> {
|
||||||
|
|
||||||
return this._jumpsService.get(route.params['type'])
|
return this._qcmService.get(route.params['type'])
|
||||||
.pipe(catchError(() => this.router.navigateByUrl('/')));
|
.pipe(catchError(() => this.router.navigateByUrl('/dashboard')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,5 @@
|
|||||||
|
<div class="content">
|
||||||
|
<h1>{{title}}</h1>
|
||||||
|
<hr />
|
||||||
<p>qcm works!</p>
|
<p>qcm works!</p>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export class QCMComponent implements OnInit, OnDestroy {
|
|||||||
public qcm: QCM = {} as QCM;
|
public qcm: QCM = {} as QCM;
|
||||||
public currentUser: User = {} as User;
|
public currentUser: User = {} as User;
|
||||||
public canModify = false;
|
public canModify = false;
|
||||||
|
public title = 'QCM Brevets';
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
@@ -31,6 +32,11 @@ export class QCMComponent implements OnInit, OnDestroy {
|
|||||||
const data$: Observable<any> = this.route.data;
|
const data$: Observable<any> = this.route.data;
|
||||||
this._data = data$.subscribe((data: { qcm: QCM }) => {
|
this._data = data$.subscribe((data: { qcm: QCM }) => {
|
||||||
this.qcm = data.qcm;
|
this.qcm = data.qcm;
|
||||||
|
if (this.qcm.name == 'bpa') {
|
||||||
|
this.title = 'QCM du BPA';
|
||||||
|
} else {
|
||||||
|
this.title = `QCM Brevets ${this.qcm.name.toUpperCase()}`;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// Load the current user's data
|
// Load the current user's data
|
||||||
const currentUser$: Observable<User> = this._userService.currentUser;
|
const currentUser$: Observable<User> = this._userService.currentUser;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
<div *ngIf="showQCMMenu">
|
<div *ngIf="showQCMMenu">
|
||||||
<mat-list-item appAccordionLink *ngFor="let menuqcm of menuItems.getMenuQCM()" routerLinkActive="selected" group="{{ menuqcm.state}}">
|
<mat-list-item appAccordionLink *ngFor="let menuqcm of menuItems.getMenuQCM()" routerLinkActive="selected" group="{{ menuqcm.state}}">
|
||||||
<a class="ps-4" appAccordionToggle [routerLink]="['/', menuqcm.state]" *ngIf=" menuqcm.type === 'link'">
|
<a class="ps-4" appAccordionToggle [routerLink]="['/qcm', menuqcm.state]" *ngIf=" menuqcm.type === 'link'">
|
||||||
<mat-icon [fontIcon]="menuqcm.icon" class="mt-0 mr-2"></mat-icon>
|
<mat-icon [fontIcon]="menuqcm.icon" class="mt-0 mr-2"></mat-icon>
|
||||||
<span>{{ menuqcm.name }}</span>
|
<span>{{ menuqcm.name }}</span>
|
||||||
<span class="flex-spacer"></span>
|
<span class="flex-spacer"></span>
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ const MENUITEMS: Menu[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const MENUQCM: Menu[] = [
|
const MENUQCM: Menu[] = [
|
||||||
{ state: 'qcm/bpa', type: 'link', name: 'BPA', icon: 'rule' },
|
{ state: 'bpa', type: 'link', name: 'BPA', icon: 'rule' },
|
||||||
{ state: 'qcm/c', type: 'link', name: 'Brevet C', icon: 'rule' },
|
{ state: 'c', type: 'link', name: 'Brevet C', icon: 'rule' },
|
||||||
{ state: 'qcm/d', type: 'link', name: 'Brevet D', icon: 'rule' }
|
{ state: 'd', type: 'link', name: 'Brevet D', icon: 'rule' }
|
||||||
];
|
];
|
||||||
|
|
||||||
const MENUPANEL: Menu[] = [
|
const MENUPANEL: Menu[] = [
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { ApiService } from './api.service';
|
||||||
|
import { QCM } from 'src/app/core/models';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class QCMService {
|
export class QCMService {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private apiService: ApiService
|
||||||
|
) { }
|
||||||
|
|
||||||
|
get(type: string): Observable<QCM> {
|
||||||
|
return this.apiService.get(`/qcm/${type}`)
|
||||||
|
.pipe(map(data => data.qcm));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user