---|qcm| Mise à jour V17 et QCM
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { ActivatedRoute, Data, Router } from '@angular/router';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { User, Errors, Aeronef, AeronefByImat, Canopy, CanopyModelBySize, DropZone, DropZoneByYear } from 'src/app/core/models';
|
||||
import { Aeronef, AeronefByImat, Canopy, CanopyModelBySize, DropZone, DropZoneByYear, Errors, Jump, User } from 'src/app/core/models';
|
||||
//import { AeronefsService, CanopiesService, DropZonesService, UserService } from 'src/app/core/services';
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { JumpsService, UserService } from 'src/app/core/services';
|
||||
import { ShowAuthedDirective } from 'src/app/components/shared/show-authed.directive';
|
||||
import {
|
||||
AeronefsComponent, AeronefsBarComponent,
|
||||
@@ -19,19 +21,21 @@ import {
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [
|
||||
ShowAuthedDirective,
|
||||
DatePipe, ShowAuthedDirective, MatDividerModule,
|
||||
AeronefsComponent, AeronefsBarComponent,
|
||||
CanopyModelsComponent, CanopySizesComponent,
|
||||
DropZonesComponent, DropZonesBarComponent,
|
||||
JumpsByMonthComponent
|
||||
],
|
||||
selector: 'huapp-dashboard',
|
||||
selector: 'app-dashboard',
|
||||
templateUrl: './dashboard.component.html',
|
||||
styleUrls: ['./dashboard.component.scss']
|
||||
styleUrl: './dashboard.component.scss'
|
||||
})
|
||||
export class DashboardComponent implements OnInit, OnDestroy {
|
||||
private _currentUser: Subscription = new Subscription();
|
||||
private _data: Subscription = new Subscription();
|
||||
private _lastjump: Subscription = new Subscription();
|
||||
private _lastjump$: Observable<Jump> = new Observable();
|
||||
/*
|
||||
private _aeronefs: Subscription = new Subscription();
|
||||
private _canopies: Subscription = new Subscription();
|
||||
@@ -50,12 +54,14 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
public dropzoneAggregate!: Array<DropZoneByYear>;
|
||||
public dropzones!: Array<DropZone>;
|
||||
public dropzonesCount = 0;
|
||||
public lastJump: Jump = {} as Jump;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private titleService: Title,
|
||||
private userService: UserService
|
||||
private _userService: UserService,
|
||||
private _jumpsService: JumpsService
|
||||
/*
|
||||
private aeronefsService: AeronefsService,
|
||||
private canopiesService: CanopiesService,
|
||||
@@ -74,10 +80,15 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
this.router.navigateByUrl('/login');
|
||||
return;
|
||||
}
|
||||
const currentUser$: Observable<User> = this.userService.currentUser;
|
||||
const currentUser$: Observable<User> = this._userService.currentUser;
|
||||
this._currentUser = currentUser$.subscribe((userData: User) => {
|
||||
this.canModify = userData.role === 'Admin';
|
||||
});
|
||||
|
||||
this._lastjump$ = this._jumpsService.getLastJump();
|
||||
this._lastjump = this._lastjump$.subscribe((jump) => {
|
||||
this.lastJump = jump;
|
||||
});
|
||||
});
|
||||
/*
|
||||
this._loadAeronefs();
|
||||
@@ -90,6 +101,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
ngOnDestroy() {
|
||||
this._currentUser.unsubscribe();
|
||||
this._data.unsubscribe();
|
||||
this._lastjump.unsubscribe();
|
||||
/*
|
||||
this._aeronefs.unsubscribe();
|
||||
this._canopies.unsubscribe();
|
||||
|
||||
Reference in New Issue
Block a user