Import "TranslateModule"
This commit is contained in:
@@ -14,7 +14,7 @@ import { ServiceCacheApi } from "../services/service-cache-api.service";
|
|||||||
selector: "app-root",
|
selector: "app-root",
|
||||||
templateUrl: "./app.component.html",
|
templateUrl: "./app.component.html",
|
||||||
styleUrls: ["./app.component.css"],
|
styleUrls: ["./app.component.css"],
|
||||||
standalone: false
|
imports: [],
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit {
|
export class AppComponent implements OnInit {
|
||||||
public title = "app";
|
public title = "app";
|
||||||
@@ -22,23 +22,23 @@ export class AppComponent implements OnInit {
|
|||||||
public version: string;
|
public version: string;
|
||||||
public selectedLanguageFlag: string;
|
public selectedLanguageFlag: string;
|
||||||
|
|
||||||
constructor(private router: Router,
|
constructor(
|
||||||
|
private router: Router,
|
||||||
private authenticationService: AuthenticationService,
|
private authenticationService: AuthenticationService,
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
private serviceCacheApi: ServiceCacheApi,
|
private serviceCacheApi: ServiceCacheApi,
|
||||||
private translateService: TranslateService)
|
private translateService: TranslateService
|
||||||
{
|
) {
|
||||||
this.authenticationService.currentUser.subscribe(user => {
|
this.authenticationService.currentUser.subscribe((user) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
this.currentUser = user;
|
this.currentUser = user;
|
||||||
this.translateService.addLangs(['en', 'fr']);
|
this.translateService.addLangs(["en", "fr"]);
|
||||||
this.translateService.use(user.language);
|
this.translateService.use(user.language);
|
||||||
this.selectedLanguageFlag = user.language;
|
this.selectedLanguageFlag = user.language;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ConfigurationHelper.settings.subscribe(settings =>
|
ConfigurationHelper.settings.subscribe((settings) => {
|
||||||
{
|
|
||||||
if (settings != null) {
|
if (settings != null) {
|
||||||
this.version = settings.version;
|
this.version = settings.version;
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ export class AppComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.serviceComm.componentTitle.subscribe(title => (this.title = title));
|
this.serviceComm.componentTitle.subscribe((title) => (this.title = title));
|
||||||
}
|
}
|
||||||
|
|
||||||
public show() {
|
public show() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { Router, ActivatedRoute } from "@angular/router";
|
import { Router, ActivatedRoute } from "@angular/router";
|
||||||
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
import { first } from "rxjs/operators";
|
import { first } from "rxjs/operators";
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ import { User } from "../../models/user";
|
|||||||
selector: "app-create-user",
|
selector: "app-create-user",
|
||||||
templateUrl: "./create-user.component.html",
|
templateUrl: "./create-user.component.html",
|
||||||
styleUrls: ["./create-user.component.css"],
|
styleUrls: ["./create-user.component.css"],
|
||||||
standalone: false,
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class CreateUserComponent implements OnInit {
|
export class CreateUserComponent implements OnInit {
|
||||||
createForm: FormGroup;
|
createForm: FormGroup;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
import { Observable, forkJoin } from "rxjs";
|
import { Observable, forkJoin } from "rxjs";
|
||||||
|
|
||||||
import { AircraftService } from "../../services/aircraft.service";
|
import { AircraftService } from "../../services/aircraft.service";
|
||||||
@@ -13,21 +13,25 @@ import { ServiceComm } from "../../services/service-comm.service";
|
|||||||
selector: "app-default",
|
selector: "app-default",
|
||||||
templateUrl: "./default.component.html",
|
templateUrl: "./default.component.html",
|
||||||
styleUrls: ["./default.component.css"],
|
styleUrls: ["./default.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class DefaultComponent implements OnInit {
|
export class DefaultComponent implements OnInit {
|
||||||
constructor(private serviceComm: ServiceComm,
|
constructor(
|
||||||
|
private serviceComm: ServiceComm,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private authenticationService: AuthenticationService,
|
private authenticationService: AuthenticationService,
|
||||||
private serviceApiAircraft: AircraftService,
|
private serviceApiAircraft: AircraftService,
|
||||||
private serviceApiJumpType: JumpTypeService,
|
private serviceApiJumpType: JumpTypeService,
|
||||||
private serviceApiDropzone: DropzoneService,
|
private serviceApiDropzone: DropzoneService,
|
||||||
private serviceApiGear : GearService) {}
|
private serviceApiGear: GearService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.authenticationService.alwaysLogin();
|
this.authenticationService.alwaysLogin();
|
||||||
|
|
||||||
this.putToCacheRefDatas().subscribe(() => { console.log("Push to cache the referentiel datas"); });
|
this.putToCacheRefDatas().subscribe(() => {
|
||||||
|
console.log("Push to cache the referentiel datas");
|
||||||
|
});
|
||||||
this.updateTitle();
|
this.updateTitle();
|
||||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||||
if (data === true) {
|
if (data === true) {
|
||||||
@@ -46,8 +50,8 @@ export class DefaultComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle() {
|
private updateTitle() {
|
||||||
this.translateService.get("Default_Title").subscribe(
|
this.translateService.get("Default_Title").subscribe((data) => {
|
||||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
this.serviceComm.updatedComponentTitle(data);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,27 @@
|
|||||||
import { Component, Inject, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from "@angular/core";
|
||||||
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA } from "@angular/material/dialog";
|
||||||
|
|
||||||
import { AddAction } from '../../models/add-action.enum';
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
import { JumpResp } from '../../models/jump';
|
import { JumpResp } from "../../models/jump";
|
||||||
import { JumpService } from '../../services/jump.service';
|
import { JumpService } from "../../services/jump.service";
|
||||||
import { ServiceComm } from '../../services/service-comm.service';
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
|
import { TranslateModule } from "@ngx-translate/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-jump-infos',
|
selector: "app-jump-infos",
|
||||||
templateUrl: './jump-infos.component.html',
|
templateUrl: "./jump-infos.component.html",
|
||||||
styleUrls: ['./jump-infos.component.css'],
|
styleUrls: ["./jump-infos.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class JumpInfosComponent implements OnInit {
|
export class JumpInfosComponent implements OnInit {
|
||||||
public editMode: boolean;
|
public editMode: boolean;
|
||||||
public jump: JumpResp
|
public jump: JumpResp;
|
||||||
|
|
||||||
constructor(@Inject(MAT_DIALOG_DATA) public data: any,
|
constructor(
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
private serviceJump: JumpService,
|
private serviceJump: JumpService,
|
||||||
private serviceComm: ServiceComm) {
|
private serviceComm: ServiceComm
|
||||||
|
) {
|
||||||
this.jump = new JumpResp(data.jump);
|
this.jump = new JumpResp(data.jump);
|
||||||
this.editMode = data.editMode;
|
this.editMode = data.editMode;
|
||||||
}
|
}
|
||||||
@@ -26,10 +29,13 @@ export class JumpInfosComponent implements OnInit {
|
|||||||
ngOnInit(): void {}
|
ngOnInit(): void {}
|
||||||
|
|
||||||
public updateJump() {
|
public updateJump() {
|
||||||
this.serviceJump.updateJump(this.jump.id,
|
this.serviceJump
|
||||||
|
.updateJump(
|
||||||
|
this.jump.id,
|
||||||
this.jump.isSpecial,
|
this.jump.isSpecial,
|
||||||
this.jump.withCutaway,
|
this.jump.withCutaway,
|
||||||
this.jump.notes)
|
this.jump.notes
|
||||||
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.serviceComm.refreshData(AddAction.Jump);
|
this.serviceComm.refreshData(AddAction.Jump);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,39 +1,42 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||||
import { MatPaginator } from '@angular/material/paginator';
|
import { MatPaginator } from "@angular/material/paginator";
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from "@angular/material/table";
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from "@angular/material/dialog";
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
import { AircraftService } from '../../services/aircraft.service';
|
import { AircraftService } from "../../services/aircraft.service";
|
||||||
import { ServiceComm } from '../../services/service-comm.service';
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { AuthenticationService } from '../../services/authentication.service';
|
import { AuthenticationService } from "../../services/authentication.service";
|
||||||
import { NewAircraftComponent } from '../new-aircraft/new-aircraft.component';
|
import { NewAircraftComponent } from "../new-aircraft/new-aircraft.component";
|
||||||
import { AddAction } from '../../models/add-action.enum';
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
import { AircraftResp } from '../../models/aircraft';
|
import { AircraftResp } from "../../models/aircraft";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list-of-aircrafts',
|
selector: "app-list-of-aircrafts",
|
||||||
templateUrl: './list-of-aircrafts.component.html',
|
templateUrl: "./list-of-aircrafts.component.html",
|
||||||
styleUrls: ['./list-of-aircrafts.component.css'],
|
styleUrls: ["./list-of-aircrafts.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class ListOfAircraftsComponent implements OnInit {
|
export class ListOfAircraftsComponent implements OnInit {
|
||||||
public displayedColumns: Array<string> = ['name', 'imageData'];
|
public displayedColumns: Array<string> = ["name", "imageData"];
|
||||||
public dataSourceTable: MatTableDataSource<AircraftResp>;
|
public dataSourceTable: MatTableDataSource<AircraftResp>;
|
||||||
public resultsLength = 0;
|
public resultsLength = 0;
|
||||||
public isUserAdmin: boolean;
|
public isUserAdmin: boolean;
|
||||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||||
|
|
||||||
constructor(private serviceApi: AircraftService,
|
constructor(
|
||||||
|
private serviceApi: AircraftService,
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
private authenticationService: AuthenticationService,
|
private authenticationService: AuthenticationService,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
private translateService: TranslateService) {
|
private translateService: TranslateService
|
||||||
this.isUserAdmin = this.authenticationService.currentUserValue.roles === "admin";
|
) {
|
||||||
|
this.isUserAdmin =
|
||||||
|
this.authenticationService.currentUserValue.roles === "admin";
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.serviceComm.refreshRequest.subscribe(action => {
|
this.serviceComm.refreshRequest.subscribe((action) => {
|
||||||
if (action === AddAction.Aircraft) {
|
if (action === AddAction.Aircraft) {
|
||||||
this.dialog.closeAll();
|
this.dialog.closeAll();
|
||||||
this.getListOfAircrafts();
|
this.getListOfAircrafts();
|
||||||
@@ -50,7 +53,7 @@ export class ListOfAircraftsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getListOfAircrafts() {
|
private getListOfAircrafts() {
|
||||||
this.serviceApi.getListOfAircrafts().subscribe(data => {
|
this.serviceApi.getListOfAircrafts().subscribe((data) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
data.sort((a, b) => a.name.localeCompare(b.name));
|
data.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
this.dataSourceTable = new MatTableDataSource<AircraftResp>(data);
|
this.dataSourceTable = new MatTableDataSource<AircraftResp>(data);
|
||||||
@@ -65,8 +68,8 @@ export class ListOfAircraftsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle() {
|
private updateTitle() {
|
||||||
this.translateService.get("ListAircrafts_Title").subscribe(
|
this.translateService.get("ListAircrafts_Title").subscribe((data) => {
|
||||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
this.serviceComm.updatedComponentTitle(data);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +1,43 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||||
import { MatPaginator } from '@angular/material/paginator';
|
import { MatPaginator } from "@angular/material/paginator";
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from "@angular/material/table";
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from "@angular/material/dialog";
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
import { AddAction } from '../../models/add-action.enum';
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
import { DropZoneResp } from '../../models/dropzone';
|
import { DropZoneResp } from "../../models/dropzone";
|
||||||
import { DropzoneService } from '../../services/dropzone.service';
|
import { DropzoneService } from "../../services/dropzone.service";
|
||||||
import { ServiceComm } from '../../services/service-comm.service';
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { AuthenticationService } from '../../services/authentication.service';
|
import { AuthenticationService } from "../../services/authentication.service";
|
||||||
import { NewDropZoneComponent } from '../new-drop-zone/new-drop-zone.component';
|
import { NewDropZoneComponent } from "../new-drop-zone/new-drop-zone.component";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list-of-dzs',
|
selector: "app-list-of-dzs",
|
||||||
templateUrl: './list-of-dzs.component.html',
|
templateUrl: "./list-of-dzs.component.html",
|
||||||
styleUrls: ['./list-of-dzs.component.css'],
|
styleUrls: ["./list-of-dzs.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class ListOfDzsComponent implements OnInit {
|
export class ListOfDzsComponent implements OnInit {
|
||||||
public displayedColumns: Array<string> = [
|
public displayedColumns: Array<string> = [
|
||||||
'isfavorite',
|
"isfavorite",
|
||||||
'name',
|
"name",
|
||||||
'address',
|
"address",
|
||||||
'type',
|
"type",
|
||||||
];
|
];
|
||||||
public dataSourceTable: MatTableDataSource<DropZoneResp>;
|
public dataSourceTable: MatTableDataSource<DropZoneResp>;
|
||||||
public isUserAdmin: boolean;
|
public isUserAdmin: boolean;
|
||||||
public resultsLength = 0;
|
public resultsLength = 0;
|
||||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||||
|
|
||||||
constructor(private serviceApi: DropzoneService,
|
constructor(
|
||||||
|
private serviceApi: DropzoneService,
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
private authenticationService: AuthenticationService,
|
private authenticationService: AuthenticationService,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
private translateService: TranslateService) {
|
private translateService: TranslateService
|
||||||
this.isUserAdmin = this.authenticationService.currentUserValue.roles === "admin";
|
) {
|
||||||
|
this.isUserAdmin =
|
||||||
|
this.authenticationService.currentUserValue.roles === "admin";
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -55,10 +58,13 @@ export class ListOfDzsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getListOfDropZones() {
|
private getListOfDropZones() {
|
||||||
this.serviceApi.getListOfDropZones()
|
this.serviceApi.getListOfDropZones().subscribe((data) => {
|
||||||
.subscribe((data) => {
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0) || a.name.localeCompare(b.name));
|
data.sort(
|
||||||
|
(a, b) =>
|
||||||
|
(b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0) ||
|
||||||
|
a.name.localeCompare(b.name)
|
||||||
|
);
|
||||||
this.dataSourceTable = new MatTableDataSource<DropZoneResp>(data);
|
this.dataSourceTable = new MatTableDataSource<DropZoneResp>(data);
|
||||||
this.dataSourceTable.paginator = this.paginator;
|
this.dataSourceTable.paginator = this.paginator;
|
||||||
this.resultsLength = data.length;
|
this.resultsLength = data.length;
|
||||||
@@ -88,8 +94,8 @@ export class ListOfDzsComponent implements OnInit {
|
|||||||
|
|
||||||
openDialogToAdd() {
|
openDialogToAdd() {
|
||||||
this.dialog.open(NewDropZoneComponent, {
|
this.dialog.open(NewDropZoneComponent, {
|
||||||
height: '400px',
|
height: "400px",
|
||||||
width: '600px',
|
width: "600px",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,8 +105,8 @@ export class ListOfDzsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle() {
|
private updateTitle() {
|
||||||
this.translateService.get("ListDz_Title").subscribe(
|
this.translateService.get("ListDz_Title").subscribe((data) => {
|
||||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
this.serviceComm.updatedComponentTitle(data);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Component, OnInit, ViewChild } from "@angular/core";
|
|||||||
import { MatPaginator } from "@angular/material/paginator";
|
import { MatPaginator } from "@angular/material/paginator";
|
||||||
import { MatTableDataSource } from "@angular/material/table";
|
import { MatTableDataSource } from "@angular/material/table";
|
||||||
import { MatDialog } from "@angular/material/dialog";
|
import { MatDialog } from "@angular/material/dialog";
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
import { GearService } from "../../services/gear.service";
|
import { GearService } from "../../services/gear.service";
|
||||||
import { ServiceComm } from "../../services/service-comm.service";
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
@@ -14,7 +14,7 @@ import { NewGearComponent } from "../new-gear/new-gear.component";
|
|||||||
selector: "app-list-of-gears",
|
selector: "app-list-of-gears",
|
||||||
templateUrl: "./list-of-gears.component.html",
|
templateUrl: "./list-of-gears.component.html",
|
||||||
styleUrls: ["./list-of-gears.component.css"],
|
styleUrls: ["./list-of-gears.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class ListOfGearsComponent implements OnInit {
|
export class ListOfGearsComponent implements OnInit {
|
||||||
public displayedColumns: Array<string> = [
|
public displayedColumns: Array<string> = [
|
||||||
@@ -23,19 +23,21 @@ export class ListOfGearsComponent implements OnInit {
|
|||||||
"maxSize",
|
"maxSize",
|
||||||
"aad",
|
"aad",
|
||||||
"mainCanopy",
|
"mainCanopy",
|
||||||
"reserveCanopy"
|
"reserveCanopy",
|
||||||
];
|
];
|
||||||
public dataSourceTable: MatTableDataSource<GearResp>;
|
public dataSourceTable: MatTableDataSource<GearResp>;
|
||||||
public resultsLength = 0;
|
public resultsLength = 0;
|
||||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||||
|
|
||||||
constructor(private serviceApi: GearService,
|
constructor(
|
||||||
|
private serviceApi: GearService,
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
private translateService: TranslateService) {}
|
private translateService: TranslateService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.serviceComm.refreshRequest.subscribe(action => {
|
this.serviceComm.refreshRequest.subscribe((action) => {
|
||||||
if (action === AddAction.Gear) {
|
if (action === AddAction.Gear) {
|
||||||
this.dialog.closeAll();
|
this.dialog.closeAll();
|
||||||
this.getListOfGears();
|
this.getListOfGears();
|
||||||
@@ -52,8 +54,7 @@ export class ListOfGearsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getListOfGears() {
|
getListOfGears() {
|
||||||
this.serviceApi.getListOfGears()
|
this.serviceApi.getListOfGears().subscribe((data) => {
|
||||||
.subscribe(data => {
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
data.sort((a, b) => b.id - a.id);
|
data.sort((a, b) => b.id - a.id);
|
||||||
this.dataSourceTable = new MatTableDataSource<GearResp>(data);
|
this.dataSourceTable = new MatTableDataSource<GearResp>(data);
|
||||||
@@ -66,13 +67,13 @@ export class ListOfGearsComponent implements OnInit {
|
|||||||
openDialogToAdd() {
|
openDialogToAdd() {
|
||||||
this.dialog.open(NewGearComponent, {
|
this.dialog.open(NewGearComponent, {
|
||||||
height: "400px",
|
height: "400px",
|
||||||
width: "600px"
|
width: "600px",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle() {
|
private updateTitle() {
|
||||||
this.translateService.get("ListGears_Title").subscribe(
|
this.translateService.get("ListGears_Title").subscribe((data) => {
|
||||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
this.serviceComm.updatedComponentTitle(data);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||||
import { FormGroup, FormControl, Validators } from '@angular/forms';
|
import { FormGroup, FormControl, Validators } from "@angular/forms";
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from "@angular/material/table";
|
||||||
import { MatPaginator } from '@angular/material/paginator';
|
import { MatPaginator } from "@angular/material/paginator";
|
||||||
import { trigger,state, style } from '@angular/animations';
|
import { trigger, state, style } from "@angular/animations";
|
||||||
|
|
||||||
import { ImageService } from '../../services/image.service';
|
import { ImageService } from "../../services/image.service";
|
||||||
import { ServiceComm } from '../../services/service-comm.service';
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { ImageResp } from '../../models/image';
|
import { ImageResp } from "../../models/image";
|
||||||
import { AddAction } from '../../models/add-action.enum';
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
|
import { TranslateModule } from "@ngx-translate/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list-of-images',
|
selector: "app-list-of-images",
|
||||||
templateUrl: './list-of-images.component.html',
|
templateUrl: "./list-of-images.component.html",
|
||||||
styleUrls: ['./list-of-images.component.css'],
|
styleUrls: ["./list-of-images.component.css"],
|
||||||
animations: [
|
animations: [
|
||||||
trigger('rotatedState', [
|
trigger("rotatedState", [
|
||||||
state('default', style({ transform: 'rotate(0)' })),
|
state("default", style({ transform: "rotate(0)" })),
|
||||||
state('rot90', style({ transform: 'rotate(-90deg)' })),
|
state("rot90", style({ transform: "rotate(-90deg)" })),
|
||||||
state('rot180', style({ transform: 'rotate(-180deg)' })),
|
state("rot180", style({ transform: "rotate(-180deg)" })),
|
||||||
state('rot270', style({ transform: 'rotate(-270deg)' })),
|
state("rot270", style({ transform: "rotate(-270deg)" })),
|
||||||
])
|
]),
|
||||||
],
|
],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class ListOfImagesComponent implements OnInit {
|
export class ListOfImagesComponent implements OnInit {
|
||||||
public displayedColumns: Array<string> = ['comment', 'data'];
|
public displayedColumns: Array<string> = ["comment", "data"];
|
||||||
public imgForm: FormGroup;
|
public imgForm: FormGroup;
|
||||||
public imageError: string;
|
public imageError: string;
|
||||||
private selectedFile: string;
|
private selectedFile: string;
|
||||||
@@ -32,7 +33,7 @@ export class ListOfImagesComponent implements OnInit {
|
|||||||
public showPopin: boolean;
|
public showPopin: boolean;
|
||||||
public dataSourceTable: MatTableDataSource<ImageResp>;
|
public dataSourceTable: MatTableDataSource<ImageResp>;
|
||||||
public resultsLength = 0;
|
public resultsLength = 0;
|
||||||
public stateRotation: string = 'default';
|
public stateRotation: string = "default";
|
||||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -49,14 +50,13 @@ export class ListOfImagesComponent implements OnInit {
|
|||||||
this.getListOfImages();
|
this.getListOfImages();
|
||||||
|
|
||||||
this.imgForm = new FormGroup({
|
this.imgForm = new FormGroup({
|
||||||
comment: new FormControl('', Validators.required),
|
comment: new FormControl("", Validators.required),
|
||||||
image: new FormControl('', Validators.required),
|
image: new FormControl("", Validators.required),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getListOfImages() {
|
private getListOfImages() {
|
||||||
this.serviceApi.getListOfImages()
|
this.serviceApi.getListOfImages().subscribe((data) => {
|
||||||
.subscribe((data) => {
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.dataSourceTable = new MatTableDataSource<ImageResp>(data);
|
this.dataSourceTable = new MatTableDataSource<ImageResp>(data);
|
||||||
this.dataSourceTable.paginator = this.paginator;
|
this.dataSourceTable.paginator = this.paginator;
|
||||||
@@ -69,13 +69,13 @@ export class ListOfImagesComponent implements OnInit {
|
|||||||
const file = fileInput.dataTransfer
|
const file = fileInput.dataTransfer
|
||||||
? fileInput.dataTransfer.files[0]
|
? fileInput.dataTransfer.files[0]
|
||||||
: fileInput.target.files[0];
|
: fileInput.target.files[0];
|
||||||
const allowed_types = ['image/png', 'image/jpeg'];
|
const allowed_types = ["image/png", "image/jpeg"];
|
||||||
const max_size = 20971520;
|
const max_size = 20971520;
|
||||||
|
|
||||||
if (!allowed_types.includes(file.type)) {
|
if (!allowed_types.includes(file.type)) {
|
||||||
this.imageError = 'Only Images are allowed ( JPG | PNG )';
|
this.imageError = "Only Images are allowed ( JPG | PNG )";
|
||||||
} else if (file.size > max_size) {
|
} else if (file.size > max_size) {
|
||||||
this.imageError = 'Maximum size allowed is ' + max_size / 1000 + 'Mb';
|
this.imageError = "Maximum size allowed is " + max_size / 1000 + "Mb";
|
||||||
} else {
|
} else {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = this.checkAndExtractDataToBase64.bind(this);
|
reader.onload = this.checkAndExtractDataToBase64.bind(this);
|
||||||
@@ -90,16 +90,16 @@ export class ListOfImagesComponent implements OnInit {
|
|||||||
const image = new Image();
|
const image = new Image();
|
||||||
image.src = e.target.result;
|
image.src = e.target.result;
|
||||||
image.onload = (rs) => {
|
image.onload = (rs) => {
|
||||||
const img_height = rs.currentTarget['height'];
|
const img_height = rs.currentTarget["height"];
|
||||||
const img_width = rs.currentTarget['width'];
|
const img_width = rs.currentTarget["width"];
|
||||||
|
|
||||||
if (img_height > max_height && img_width > max_width) {
|
if (img_height > max_height && img_width > max_width) {
|
||||||
this.imageError =
|
this.imageError =
|
||||||
'Maximum dimentions allowed ' + max_height + '*' + max_width + 'px';
|
"Maximum dimentions allowed " + max_height + "*" + max_width + "px";
|
||||||
} else {
|
} else {
|
||||||
const imgBase64Path = e.target.result;
|
const imgBase64Path = e.target.result;
|
||||||
this.selectedFile = imgBase64Path;
|
this.selectedFile = imgBase64Path;
|
||||||
this.imageError = 'OK';
|
this.imageError = "OK";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -109,10 +109,11 @@ export class ListOfImagesComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.serviceApi.addImage(formData.comment, this.selectedFile)
|
this.serviceApi
|
||||||
.subscribe(
|
.addImage(formData.comment, this.selectedFile)
|
||||||
() => { this.getListOfImages(); }
|
.subscribe(() => {
|
||||||
);
|
this.getListOfImages();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openModal(image: ImageResp) {
|
openModal(image: ImageResp) {
|
||||||
@@ -125,14 +126,14 @@ export class ListOfImagesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rotate() {
|
rotate() {
|
||||||
if (this.stateRotation === 'default') {
|
if (this.stateRotation === "default") {
|
||||||
this.stateRotation = 'rot90';
|
this.stateRotation = "rot90";
|
||||||
} else if (this.stateRotation === 'rot90') {
|
} else if (this.stateRotation === "rot90") {
|
||||||
this.stateRotation = 'rot180';
|
this.stateRotation = "rot180";
|
||||||
} else if (this.stateRotation === 'rot180') {
|
} else if (this.stateRotation === "rot180") {
|
||||||
this.stateRotation = 'rot270';
|
this.stateRotation = "rot270";
|
||||||
} else {
|
} else {
|
||||||
this.stateRotation = 'default';
|
this.stateRotation = "default";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,20 +2,20 @@ import { Component, OnInit, ViewChild } from "@angular/core";
|
|||||||
import { MatPaginator } from "@angular/material/paginator";
|
import { MatPaginator } from "@angular/material/paginator";
|
||||||
import { MatTableDataSource } from "@angular/material/table";
|
import { MatTableDataSource } from "@angular/material/table";
|
||||||
import { MatDialog } from "@angular/material/dialog";
|
import { MatDialog } from "@angular/material/dialog";
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
import { AddAction } from "../../models/add-action.enum";
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
import { JumpTypeResp } from "../../models/jumpType";
|
import { JumpTypeResp } from "../../models/jumpType";
|
||||||
import { JumpTypeService } from "../../services/jump-type.service";
|
import { JumpTypeService } from "../../services/jump-type.service";
|
||||||
import { ServiceComm } from "../../services/service-comm.service";
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { AuthenticationService } from '../../services/authentication.service';
|
import { AuthenticationService } from "../../services/authentication.service";
|
||||||
import { NewJumpTypeComponent } from "../new-jump-type/new-jump-type.component";
|
import { NewJumpTypeComponent } from "../new-jump-type/new-jump-type.component";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-list-of-jump-types",
|
selector: "app-list-of-jump-types",
|
||||||
templateUrl: "./list-of-jump-types.component.html",
|
templateUrl: "./list-of-jump-types.component.html",
|
||||||
styleUrls: ["./list-of-jump-types.component.css"],
|
styleUrls: ["./list-of-jump-types.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class ListOfJumpTypesComponent implements OnInit {
|
export class ListOfJumpTypesComponent implements OnInit {
|
||||||
public displayedColumns: Array<string> = ["name"];
|
public displayedColumns: Array<string> = ["name"];
|
||||||
@@ -24,16 +24,19 @@ export class ListOfJumpTypesComponent implements OnInit {
|
|||||||
public resultsLength = 0;
|
public resultsLength = 0;
|
||||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||||
|
|
||||||
constructor(private serviceApi: JumpTypeService,
|
constructor(
|
||||||
|
private serviceApi: JumpTypeService,
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
private authenticationService: AuthenticationService,
|
private authenticationService: AuthenticationService,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
private translateService: TranslateService) {
|
private translateService: TranslateService
|
||||||
this.isUserAdmin = this.authenticationService.currentUserValue.roles === "admin";
|
) {
|
||||||
|
this.isUserAdmin =
|
||||||
|
this.authenticationService.currentUserValue.roles === "admin";
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.serviceComm.refreshRequest.subscribe(action => {
|
this.serviceComm.refreshRequest.subscribe((action) => {
|
||||||
if (action === AddAction.JumpType) {
|
if (action === AddAction.JumpType) {
|
||||||
this.dialog.closeAll();
|
this.dialog.closeAll();
|
||||||
this.getListOfJumpTypes();
|
this.getListOfJumpTypes();
|
||||||
@@ -50,7 +53,7 @@ export class ListOfJumpTypesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getListOfJumpTypes() {
|
getListOfJumpTypes() {
|
||||||
this.serviceApi.getListOfJumpTypes().subscribe(data => {
|
this.serviceApi.getListOfJumpTypes().subscribe((data) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
data.sort((a, b) => a.name.localeCompare(b.name));
|
data.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
this.dataSourceTable = new MatTableDataSource<JumpTypeResp>(data);
|
this.dataSourceTable = new MatTableDataSource<JumpTypeResp>(data);
|
||||||
@@ -65,8 +68,8 @@ export class ListOfJumpTypesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle() {
|
private updateTitle() {
|
||||||
this.translateService.get("ListJumpTypes_Title").subscribe(
|
this.translateService.get("ListJumpTypes_Title").subscribe((data) => {
|
||||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
this.serviceComm.updatedComponentTitle(data);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Component, OnInit, ViewChild } from "@angular/core";
|
|||||||
import { MatPaginator, PageEvent } from "@angular/material/paginator";
|
import { MatPaginator, PageEvent } from "@angular/material/paginator";
|
||||||
import { MatTableDataSource } from "@angular/material/table";
|
import { MatTableDataSource } from "@angular/material/table";
|
||||||
import { MatDialog } from "@angular/material/dialog";
|
import { MatDialog } from "@angular/material/dialog";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
import { AddAction } from "../../models/add-action.enum";
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
import { Jump } from "../../models/jump";
|
import { Jump } from "../../models/jump";
|
||||||
@@ -15,7 +15,7 @@ import { StatsService } from "../../services/stats.service";
|
|||||||
selector: "app-list-of-jumps",
|
selector: "app-list-of-jumps",
|
||||||
templateUrl: "./list-of-jumps.component.html",
|
templateUrl: "./list-of-jumps.component.html",
|
||||||
styleUrls: ["./list-of-jumps.component.css"],
|
styleUrls: ["./list-of-jumps.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class ListOfJumpsComponent implements OnInit {
|
export class ListOfJumpsComponent implements OnInit {
|
||||||
public displayedColumns: Array<string> = [
|
public displayedColumns: Array<string> = [
|
||||||
@@ -31,7 +31,8 @@ export class ListOfJumpsComponent implements OnInit {
|
|||||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||||
public isLoading: boolean = false;
|
public isLoading: boolean = false;
|
||||||
|
|
||||||
constructor(private serviceApi: JumpService,
|
constructor(
|
||||||
|
private serviceApi: JumpService,
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
@@ -62,7 +63,8 @@ export class ListOfJumpsComponent implements OnInit {
|
|||||||
getListOfJumps(pageSize: number = 20, pageIndex: number = 0) {
|
getListOfJumps(pageSize: number = 20, pageIndex: number = 0) {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
|
||||||
this.serviceApi.getJumps(pageIndex * pageSize, pageIndex * pageSize + pageSize)
|
this.serviceApi
|
||||||
|
.getJumps(pageIndex * pageSize, pageIndex * pageSize + pageSize)
|
||||||
.subscribe((data) => {
|
.subscribe((data) => {
|
||||||
this.dataSourceTable.data = data.rows;
|
this.dataSourceTable.data = data.rows;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
</mat-nav-list>
|
</mat-nav-list>
|
||||||
|
|
||||||
<div class="chart-container">
|
<div class="chart-container">
|
||||||
|
<!-- https://www.freecodecamp.org/news/how-to-make-bar-and-line-charts-using-chartjs-in-angular/ -->
|
||||||
<canvas
|
<canvas
|
||||||
baseChart
|
baseChart
|
||||||
[data]="barChartData"
|
[data]="barChartData"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { formatDate } from "@angular/common";
|
import { formatDate } from "@angular/common";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
import { MatTableDataSource } from "@angular/material/table";
|
import { MatTableDataSource } from "@angular/material/table";
|
||||||
import { ChartConfiguration, ChartData, ChartType } from "chart.js";
|
import { ChartConfiguration, ChartData, ChartType } from "chart.js";
|
||||||
import { from, of, groupBy, mergeMap, reduce, map, Observable } from "rxjs";
|
import { from, groupBy, mergeMap, reduce, map } from "rxjs";
|
||||||
|
|
||||||
import { ServiceComm } from "../../services/service-comm.service";
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { TunnelFlightService } from "../../services/tunnel-flight.service";
|
import { TunnelFlightService } from "../../services/tunnel-flight.service";
|
||||||
@@ -14,7 +14,7 @@ import { TunnelFlight, TunnelFlightByMonth } from "../../models/tunnel-flight";
|
|||||||
selector: "app-list-of-tunnel-flights",
|
selector: "app-list-of-tunnel-flights",
|
||||||
templateUrl: "./list-of-tunnel-flights.component.html",
|
templateUrl: "./list-of-tunnel-flights.component.html",
|
||||||
styleUrls: ["./list-of-tunnel-flights.component.css"],
|
styleUrls: ["./list-of-tunnel-flights.component.css"],
|
||||||
standalone: false,
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class ListOfTunnelFlightsComponent implements OnInit {
|
export class ListOfTunnelFlightsComponent implements OnInit {
|
||||||
public barChartLegend = true;
|
public barChartLegend = true;
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import { MatInput } from "@angular/material/input";
|
|||||||
import { first } from "rxjs/operators";
|
import { first } from "rxjs/operators";
|
||||||
|
|
||||||
import { AuthenticationService } from "../../services/authentication.service";
|
import { AuthenticationService } from "../../services/authentication.service";
|
||||||
|
import { TranslateModule } from "@ngx-translate/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-login-user",
|
selector: "app-login-user",
|
||||||
templateUrl: "./login-user.component.html",
|
templateUrl: "./login-user.component.html",
|
||||||
styleUrls: ["./login-user.component.css"],
|
styleUrls: ["./login-user.component.css"],
|
||||||
standalone: false,
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class LoginUserComponent implements OnInit, AfterViewInit {
|
export class LoginUserComponent implements OnInit, AfterViewInit {
|
||||||
loginForm: FormGroup;
|
loginForm: FormGroup;
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-login",
|
selector: "app-login",
|
||||||
templateUrl: "./login.component.html",
|
templateUrl: "./login.component.html",
|
||||||
styleUrls: ["./login.component.css"],
|
styleUrls: ["./login.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class LoginComponent implements OnInit {
|
export class LoginComponent implements OnInit {
|
||||||
public selectedLanguageFlag: string;
|
public selectedLanguageFlag: string;
|
||||||
|
|
||||||
constructor(private translate: TranslateService) {
|
constructor(private translate: TranslateService) {
|
||||||
translate.addLangs(['en', 'fr']);
|
translate.addLangs(["en", "fr"]);
|
||||||
translate.setDefaultLang('en');
|
translate.setDefaultLang("en");
|
||||||
this.selectedLanguageFlag = "en";
|
this.selectedLanguageFlag = "en";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,30 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
import { FormControl, FormGroup, Validators } from "@angular/forms";
|
||||||
import { AircraftService } from '../../services/aircraft.service';
|
import { AircraftService } from "../../services/aircraft.service";
|
||||||
import { ServiceComm } from '../../services/service-comm.service';
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { AddAction } from '../../models/add-action.enum';
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
|
import { TranslateModule } from "@ngx-translate/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-new-aircraft',
|
selector: "app-new-aircraft",
|
||||||
templateUrl: './new-aircraft.component.html',
|
templateUrl: "./new-aircraft.component.html",
|
||||||
styleUrls: ['./new-aircraft.component.css'],
|
styleUrls: ["./new-aircraft.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class NewAircraftComponent implements OnInit {
|
export class NewAircraftComponent implements OnInit {
|
||||||
public addForm: FormGroup;
|
public addForm: FormGroup;
|
||||||
public imageError: string;
|
public imageError: string;
|
||||||
private selectedFile: string;
|
private selectedFile: string;
|
||||||
|
|
||||||
constructor(private serviceComm: ServiceComm,
|
constructor(
|
||||||
private serviceApi: AircraftService) {
|
private serviceComm: ServiceComm,
|
||||||
|
private serviceApi: AircraftService
|
||||||
|
) {
|
||||||
this.addForm = new FormGroup(
|
this.addForm = new FormGroup(
|
||||||
{
|
{
|
||||||
aircraftName: new FormControl('', Validators.required)
|
aircraftName: new FormControl("", Validators.required),
|
||||||
},
|
},
|
||||||
{ updateOn: 'blur' }
|
{ updateOn: "blur" }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,21 +35,24 @@ export class NewAircraftComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.serviceApi.addAircraft(formData.aircraftName, this.selectedFile)
|
this.serviceApi
|
||||||
|
.addAircraft(formData.aircraftName, this.selectedFile)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.serviceComm.refreshData(AddAction.Aircraft);
|
this.serviceComm.refreshData(AddAction.Aircraft);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public onFileChanged(fileInput: any) {
|
public onFileChanged(fileInput: any) {
|
||||||
const file = fileInput.dataTransfer ? fileInput.dataTransfer.files[0] : fileInput.target.files[0];
|
const file = fileInput.dataTransfer
|
||||||
const allowed_types = ['image/png', 'image/jpeg'];
|
? fileInput.dataTransfer.files[0]
|
||||||
|
: fileInput.target.files[0];
|
||||||
|
const allowed_types = ["image/png", "image/jpeg"];
|
||||||
const max_size = 20971520;
|
const max_size = 20971520;
|
||||||
|
|
||||||
if (!allowed_types.includes(file.type)) {
|
if (!allowed_types.includes(file.type)) {
|
||||||
this.imageError = 'Only Images are allowed ( JPG | PNG )';
|
this.imageError = "Only Images are allowed ( JPG | PNG )";
|
||||||
} else if (file.size > max_size) {
|
} else if (file.size > max_size) {
|
||||||
this.imageError = 'Maximum size allowed is ' + max_size / 1000 + 'Mb';
|
this.imageError = "Maximum size allowed is " + max_size / 1000 + "Mb";
|
||||||
} else {
|
} else {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = this.checkAndExtractDataToBase64.bind(this);
|
reader.onload = this.checkAndExtractDataToBase64.bind(this);
|
||||||
@@ -61,16 +67,16 @@ export class NewAircraftComponent implements OnInit {
|
|||||||
const image = new Image();
|
const image = new Image();
|
||||||
image.src = e.target.result;
|
image.src = e.target.result;
|
||||||
image.onload = (rs) => {
|
image.onload = (rs) => {
|
||||||
const img_height = rs.currentTarget['height'];
|
const img_height = rs.currentTarget["height"];
|
||||||
const img_width = rs.currentTarget['width'];
|
const img_width = rs.currentTarget["width"];
|
||||||
|
|
||||||
if (img_height > max_height && img_width > max_width) {
|
if (img_height > max_height && img_width > max_width) {
|
||||||
this.imageError =
|
this.imageError =
|
||||||
'Maximum dimentions allowed ' + max_height + '*' + max_width + 'px';
|
"Maximum dimentions allowed " + max_height + "*" + max_width + "px";
|
||||||
} else {
|
} else {
|
||||||
const imgBase64Path = e.target.result;
|
const imgBase64Path = e.target.result;
|
||||||
this.selectedFile = imgBase64Path;
|
this.selectedFile = imgBase64Path;
|
||||||
this.imageError = 'OK';
|
this.imageError = "OK";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ import { FormControl, FormGroup, Validators } from "@angular/forms";
|
|||||||
import { AddAction } from "../../models/add-action.enum";
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
import { ServiceComm } from "../../services/service-comm.service";
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { DropzoneService } from "../../services/dropzone.service";
|
import { DropzoneService } from "../../services/dropzone.service";
|
||||||
|
import { TranslateModule } from "@ngx-translate/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-new-drop-zone",
|
selector: "app-new-drop-zone",
|
||||||
templateUrl: "./new-drop-zone.component.html",
|
templateUrl: "./new-drop-zone.component.html",
|
||||||
styleUrls: ["./new-drop-zone.component.css"],
|
styleUrls: ["./new-drop-zone.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class NewDropZoneComponent implements OnInit {
|
export class NewDropZoneComponent implements OnInit {
|
||||||
public addForm: FormGroup;
|
public addForm: FormGroup;
|
||||||
@@ -22,16 +23,16 @@ export class NewDropZoneComponent implements OnInit {
|
|||||||
dzName: new FormControl("", Validators.required),
|
dzName: new FormControl("", Validators.required),
|
||||||
gps: new FormControl("x.x,y.y", [
|
gps: new FormControl("x.x,y.y", [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.pattern("d+.d+,d+.d+")
|
Validators.pattern("d+.d+,d+.d+"),
|
||||||
]),
|
]),
|
||||||
address: new FormControl("", Validators.required),
|
address: new FormControl("", Validators.required),
|
||||||
website: new FormControl("", Validators.required),
|
website: new FormControl("", Validators.required),
|
||||||
contactMail: new FormControl("", [
|
contactMail: new FormControl("", [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.email
|
Validators.email,
|
||||||
]),
|
]),
|
||||||
isDz: new FormControl(true),
|
isDz: new FormControl(true),
|
||||||
isTunnel: new FormControl(false)
|
isTunnel: new FormControl(false),
|
||||||
},
|
},
|
||||||
{ updateOn: "blur" }
|
{ updateOn: "blur" }
|
||||||
);
|
);
|
||||||
@@ -50,14 +51,17 @@ export class NewDropZoneComponent implements OnInit {
|
|||||||
dzType.push("tunnel");
|
dzType.push("tunnel");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dropzoneService.addDropZone(splitGps[0],
|
this.dropzoneService
|
||||||
|
.addDropZone(
|
||||||
|
splitGps[0],
|
||||||
splitGps[1],
|
splitGps[1],
|
||||||
formData.dzName,
|
formData.dzName,
|
||||||
formData.address,
|
formData.address,
|
||||||
formData.website,
|
formData.website,
|
||||||
formData.contactMail,
|
formData.contactMail,
|
||||||
dzType,
|
dzType,
|
||||||
false)
|
false
|
||||||
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.serviceComm.refreshData(AddAction.Dropzone);
|
this.serviceComm.refreshData(AddAction.Dropzone);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,19 +4,21 @@ import { FormControl, FormGroup, Validators } from "@angular/forms";
|
|||||||
import { ServiceComm } from "../../services/service-comm.service";
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { GearService } from "../../services/gear.service";
|
import { GearService } from "../../services/gear.service";
|
||||||
import { AddAction } from "../../models/add-action.enum";
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
|
import { TranslateModule } from "@ngx-translate/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-new-gear",
|
selector: "app-new-gear",
|
||||||
templateUrl: "./new-gear.component.html",
|
templateUrl: "./new-gear.component.html",
|
||||||
styleUrls: ["./new-gear.component.css"],
|
styleUrls: ["./new-gear.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class NewGearComponent implements OnInit {
|
export class NewGearComponent implements OnInit {
|
||||||
public addForm: FormGroup;
|
public addForm: FormGroup;
|
||||||
|
|
||||||
constructor(private serviceComm: ServiceComm,
|
constructor(
|
||||||
private serviceApi: GearService)
|
private serviceComm: ServiceComm,
|
||||||
{
|
private serviceApi: GearService
|
||||||
|
) {
|
||||||
this.addForm = new FormGroup(
|
this.addForm = new FormGroup(
|
||||||
{
|
{
|
||||||
name: new FormControl("", Validators.required),
|
name: new FormControl("", Validators.required),
|
||||||
@@ -24,24 +26,24 @@ export class NewGearComponent implements OnInit {
|
|||||||
minSize: new FormControl("", [
|
minSize: new FormControl("", [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.min(60),
|
Validators.min(60),
|
||||||
Validators.max(320)
|
Validators.max(320),
|
||||||
]),
|
]),
|
||||||
maxSize: new FormControl("", [
|
maxSize: new FormControl("", [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.min(60),
|
Validators.min(60),
|
||||||
Validators.max(320)
|
Validators.max(320),
|
||||||
]),
|
]),
|
||||||
aad: new FormControl("", Validators.required),
|
aad: new FormControl("", Validators.required),
|
||||||
mainCanopy: new FormControl("", [
|
mainCanopy: new FormControl("", [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.min(60),
|
Validators.min(60),
|
||||||
Validators.max(320)
|
Validators.max(320),
|
||||||
]),
|
]),
|
||||||
reserveCanopy: new FormControl("", [
|
reserveCanopy: new FormControl("", [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.min(60),
|
Validators.min(60),
|
||||||
Validators.max(320)
|
Validators.max(320),
|
||||||
])
|
]),
|
||||||
},
|
},
|
||||||
{ updateOn: "blur" }
|
{ updateOn: "blur" }
|
||||||
);
|
);
|
||||||
@@ -50,13 +52,16 @@ export class NewGearComponent implements OnInit {
|
|||||||
ngOnInit() {}
|
ngOnInit() {}
|
||||||
|
|
||||||
onSubmit(formData) {
|
onSubmit(formData) {
|
||||||
this.serviceApi.addGear(formData.name,
|
this.serviceApi
|
||||||
|
.addGear(
|
||||||
|
formData.name,
|
||||||
formData.manufacturer,
|
formData.manufacturer,
|
||||||
+formData.minSize,
|
+formData.minSize,
|
||||||
+formData.maxSize,
|
+formData.maxSize,
|
||||||
formData.aad,
|
formData.aad,
|
||||||
formData.mainCanopy,
|
formData.mainCanopy,
|
||||||
formData.reserveCanopy)
|
formData.reserveCanopy
|
||||||
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.serviceComm.refreshData(AddAction.Gear);
|
this.serviceComm.refreshData(AddAction.Gear);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,21 +3,24 @@ import { FormControl, FormGroup, Validators } from "@angular/forms";
|
|||||||
import { AddAction } from "../../models/add-action.enum";
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
import { ServiceComm } from "../../services/service-comm.service";
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { JumpTypeService } from "../../services/jump-type.service";
|
import { JumpTypeService } from "../../services/jump-type.service";
|
||||||
|
import { TranslateModule } from "@ngx-translate/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-new-jump-type",
|
selector: "app-new-jump-type",
|
||||||
templateUrl: "./new-jump-type.component.html",
|
templateUrl: "./new-jump-type.component.html",
|
||||||
styleUrls: ["./new-jump-type.component.css"],
|
styleUrls: ["./new-jump-type.component.css"],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class NewJumpTypeComponent implements OnInit {
|
export class NewJumpTypeComponent implements OnInit {
|
||||||
public addForm: FormGroup;
|
public addForm: FormGroup;
|
||||||
|
|
||||||
constructor(private serviceComm: ServiceComm,
|
constructor(
|
||||||
private jumpTypeService: JumpTypeService) {
|
private serviceComm: ServiceComm,
|
||||||
|
private jumpTypeService: JumpTypeService
|
||||||
|
) {
|
||||||
this.addForm = new FormGroup(
|
this.addForm = new FormGroup(
|
||||||
{
|
{
|
||||||
jumptypeName: new FormControl("", Validators.required)
|
jumptypeName: new FormControl("", Validators.required),
|
||||||
},
|
},
|
||||||
{ updateOn: "blur" }
|
{ updateOn: "blur" }
|
||||||
);
|
);
|
||||||
@@ -26,8 +29,7 @@ export class NewJumpTypeComponent implements OnInit {
|
|||||||
ngOnInit() {}
|
ngOnInit() {}
|
||||||
|
|
||||||
onSubmit(formData) {
|
onSubmit(formData) {
|
||||||
this.jumpTypeService.addJumpType(formData.jumptypeName)
|
this.jumpTypeService.addJumpType(formData.jumptypeName).subscribe(() => {
|
||||||
.subscribe(() => {
|
|
||||||
this.serviceComm.refreshData(AddAction.JumpType);
|
this.serviceComm.refreshData(AddAction.JumpType);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { formatDate } from '@angular/common';
|
import { formatDate } from "@angular/common";
|
||||||
import { DateAdapter, MAT_DATE_FORMATS, NativeDateAdapter } from "@angular/material/core";
|
import {
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
DateAdapter,
|
||||||
|
MAT_DATE_FORMATS,
|
||||||
|
NativeDateAdapter,
|
||||||
|
} from "@angular/material/core";
|
||||||
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
import { JumpTypeResp } from "../../models/jumpType";
|
import { JumpTypeResp } from "../../models/jumpType";
|
||||||
import { AircraftResp } from "../../models/aircraft";
|
import { AircraftResp } from "../../models/aircraft";
|
||||||
@@ -17,18 +21,17 @@ import { JumpTypeService } from "../../services/jump-type.service";
|
|||||||
import { GearService } from "../../services/gear.service";
|
import { GearService } from "../../services/gear.service";
|
||||||
import { StatsService } from "../../services/stats.service";
|
import { StatsService } from "../../services/stats.service";
|
||||||
|
|
||||||
|
|
||||||
export const PICK_FORMATS = {
|
export const PICK_FORMATS = {
|
||||||
parse: { dateInput: 'yy MM dd' },
|
parse: { dateInput: "yy MM dd" },
|
||||||
display: {
|
display: {
|
||||||
dateInput: 'yyyy-MM-dd',
|
dateInput: "yyyy-MM-dd",
|
||||||
monthYearLabel: 'yyyy MMM',
|
monthYearLabel: "yyyy MMM",
|
||||||
dateA11yLabel: 'yyyy MM dd',
|
dateA11yLabel: "yyyy MM dd",
|
||||||
monthYearA11yLabel: 'yyyy MMMM',
|
monthYearA11yLabel: "yyyy MMMM",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
class PickDateAdapter extends NativeDateAdapter {
|
class PickDateAdapter extends NativeDateAdapter {
|
||||||
format(date: Date, displayFormat: Object): string {
|
override format(date: Date, displayFormat: Object): string {
|
||||||
return formatDate(date, displayFormat.toString(), "en");
|
return formatDate(date, displayFormat.toString(), "en");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,9 +42,9 @@ class PickDateAdapter extends NativeDateAdapter {
|
|||||||
styleUrls: ["./new-jump.component.css"],
|
styleUrls: ["./new-jump.component.css"],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: DateAdapter, useClass: PickDateAdapter },
|
{ provide: DateAdapter, useClass: PickDateAdapter },
|
||||||
{ provide: MAT_DATE_FORMATS, useValue: PICK_FORMATS }
|
{ provide: MAT_DATE_FORMATS, useValue: PICK_FORMATS },
|
||||||
],
|
],
|
||||||
standalone: false
|
imports: [TranslateModule],
|
||||||
})
|
})
|
||||||
export class NewJumpComponent implements OnInit {
|
export class NewJumpComponent implements OnInit {
|
||||||
public beginDate: Date;
|
public beginDate: Date;
|
||||||
@@ -66,7 +69,8 @@ export class NewJumpComponent implements OnInit {
|
|||||||
private listOfDropZone: Array<DropZoneResp>;
|
private listOfDropZone: Array<DropZoneResp>;
|
||||||
public maxDate: Date;
|
public maxDate: Date;
|
||||||
|
|
||||||
constructor(private serviceComm: ServiceComm,
|
constructor(
|
||||||
|
private serviceComm: ServiceComm,
|
||||||
private serviceJump: JumpService,
|
private serviceJump: JumpService,
|
||||||
private serviceJumpType: JumpTypeService,
|
private serviceJumpType: JumpTypeService,
|
||||||
private serviceAircraft: AircraftService,
|
private serviceAircraft: AircraftService,
|
||||||
@@ -74,7 +78,8 @@ export class NewJumpComponent implements OnInit {
|
|||||||
private serviceGear: GearService,
|
private serviceGear: GearService,
|
||||||
private dateService: DateService,
|
private dateService: DateService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private statsService : StatsService) {}
|
private statsService: StatsService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||||
@@ -94,7 +99,9 @@ export class NewJumpComponent implements OnInit {
|
|||||||
onFormSubmit() {
|
onFormSubmit() {
|
||||||
this.pendingAddRequest = true;
|
this.pendingAddRequest = true;
|
||||||
|
|
||||||
this.serviceJump.addListOfJump(this.selectedJumpType.id,
|
this.serviceJump
|
||||||
|
.addListOfJump(
|
||||||
|
this.selectedJumpType.id,
|
||||||
this.selectedAircraft.id,
|
this.selectedAircraft.id,
|
||||||
this.selectedDz.id,
|
this.selectedDz.id,
|
||||||
this.selectedGear.id,
|
this.selectedGear.id,
|
||||||
@@ -105,7 +112,8 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.deployAltitude,
|
this.deployAltitude,
|
||||||
this.countOfJumps,
|
this.countOfJumps,
|
||||||
this.comments,
|
this.comments,
|
||||||
this.isSpecial === undefined ? false : this.isSpecial)
|
this.isSpecial === undefined ? false : this.isSpecial
|
||||||
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.statsService.resetStats();
|
this.statsService.resetStats();
|
||||||
this.comments = undefined;
|
this.comments = undefined;
|
||||||
@@ -120,7 +128,8 @@ export class NewJumpComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public isValidatedForm(): boolean {
|
public isValidatedForm(): boolean {
|
||||||
return (this.selectedDz !== undefined &&
|
return (
|
||||||
|
this.selectedDz !== undefined &&
|
||||||
this.selectedDz.id !== undefined &&
|
this.selectedDz.id !== undefined &&
|
||||||
this.selectedGear !== undefined &&
|
this.selectedGear !== undefined &&
|
||||||
this.selectedGear.id !== undefined &&
|
this.selectedGear.id !== undefined &&
|
||||||
@@ -133,12 +142,12 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.deployAltitude !== undefined &&
|
this.deployAltitude !== undefined &&
|
||||||
typeof this.deployAltitude === "number" &&
|
typeof this.deployAltitude === "number" &&
|
||||||
this.countOfJumps !== undefined &&
|
this.countOfJumps !== undefined &&
|
||||||
typeof this.countOfJumps === "number");
|
typeof this.countOfJumps === "number"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getListOfJumpTypes() {
|
private getListOfJumpTypes() {
|
||||||
this.serviceJumpType.getListOfJumpTypes()
|
this.serviceJumpType.getListOfJumpTypes().subscribe((data) => {
|
||||||
.subscribe((data) => {
|
|
||||||
data.sort((a, b) => a.name.localeCompare(b.name));
|
data.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
this.listOfJumpType = data;
|
this.listOfJumpType = data;
|
||||||
this.countDatasLoaded = 1;
|
this.countDatasLoaded = 1;
|
||||||
@@ -150,8 +159,7 @@ export class NewJumpComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getListOfAircrafts() {
|
private getListOfAircrafts() {
|
||||||
this.serviceAircraft.getListOfAircrafts(true)
|
this.serviceAircraft.getListOfAircrafts(true).subscribe((data) => {
|
||||||
.subscribe((data) => {
|
|
||||||
data.sort((a, b) => a.name.localeCompare(b.name));
|
data.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
this.listOfAircraft = data;
|
this.listOfAircraft = data;
|
||||||
this.countDatasLoaded++;
|
this.countDatasLoaded++;
|
||||||
@@ -159,9 +167,12 @@ export class NewJumpComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getListOfDropZones() {
|
private getListOfDropZones() {
|
||||||
this.serviceDropzone.getListOfDropZones(true)
|
this.serviceDropzone.getListOfDropZones(true).subscribe((data) => {
|
||||||
.subscribe((data) => {
|
data.sort(
|
||||||
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0) || a.name.localeCompare(b.name));
|
(a, b) =>
|
||||||
|
(b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0) ||
|
||||||
|
a.name.localeCompare(b.name)
|
||||||
|
);
|
||||||
this.listOfDropZone = data;
|
this.listOfDropZone = data;
|
||||||
this.listOfFilteredDropZone = data;
|
this.listOfFilteredDropZone = data;
|
||||||
this.countDatasLoaded++;
|
this.countDatasLoaded++;
|
||||||
@@ -169,8 +180,7 @@ export class NewJumpComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getListOfGears() {
|
private getListOfGears() {
|
||||||
this.serviceGear.getListOfGears()
|
this.serviceGear.getListOfGears().subscribe((data) => {
|
||||||
.subscribe((data) => {
|
|
||||||
data.sort((a, b) => b.id - a.id);
|
data.sort((a, b) => b.id - a.id);
|
||||||
this.listOfGear = data;
|
this.listOfGear = data;
|
||||||
this.countDatasLoaded++;
|
this.countDatasLoaded++;
|
||||||
@@ -212,8 +222,8 @@ export class NewJumpComponent implements OnInit {
|
|||||||
filterValue = event.toLowerCase();
|
filterValue = event.toLowerCase();
|
||||||
|
|
||||||
this.listOfFilteredDropZone = this.listOfDropZone;
|
this.listOfFilteredDropZone = this.listOfDropZone;
|
||||||
this.listOfFilteredDropZone = this.listOfFilteredDropZone.filter((option) =>
|
this.listOfFilteredDropZone = this.listOfFilteredDropZone.filter(
|
||||||
option.name.toLowerCase().includes(filterValue)
|
(option) => option.name.toLowerCase().includes(filterValue)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,12 +238,12 @@ export class NewJumpComponent implements OnInit {
|
|||||||
|
|
||||||
public resetDz() {
|
public resetDz() {
|
||||||
this.selectedDz = undefined;
|
this.selectedDz = undefined;
|
||||||
this.onChangeDz('');
|
this.onChangeDz("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle() {
|
private updateTitle() {
|
||||||
this.translateService.get("NewJump_Title").subscribe(
|
this.translateService.get("NewJump_Title").subscribe((data) => {
|
||||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
this.serviceComm.updatedComponentTitle(data);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +1,46 @@
|
|||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { formatDate } from '@angular/common';
|
import { formatDate } from "@angular/common";
|
||||||
import { DateAdapter, MAT_DATE_FORMATS, NativeDateAdapter } from "@angular/material/core";
|
import {
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
DateAdapter,
|
||||||
|
MAT_DATE_FORMATS,
|
||||||
|
NativeDateAdapter,
|
||||||
|
} from "@angular/material/core";
|
||||||
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
import { TunnelResp } from "../../models/tunnel";
|
import { TunnelResp } from "../../models/tunnel";
|
||||||
|
|
||||||
import { JumpTypeResp } from "../../models/jumpType";
|
import { JumpTypeResp } from "../../models/jumpType";
|
||||||
import { TunnelService } from '../../services/tunnel.service';
|
import { TunnelService } from "../../services/tunnel.service";
|
||||||
import { ServiceComm } from '../../services/service-comm.service';
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { TunnelFlightService } from "../../services/tunnel-flight.service";
|
import { TunnelFlightService } from "../../services/tunnel-flight.service";
|
||||||
import { JumpTypeService } from "../../services/jump-type.service";
|
import { JumpTypeService } from "../../services/jump-type.service";
|
||||||
import { DateService } from "../../services/date.service";
|
import { DateService } from "../../services/date.service";
|
||||||
|
import { MatAutocompleteModule } from "@angular/material/autocomplete";
|
||||||
|
|
||||||
export const PICK_FORMATS = {
|
export const PICK_FORMATS = {
|
||||||
parse: { dateInput: 'yy MM dd' },
|
parse: { dateInput: "yy MM dd" },
|
||||||
display: {
|
display: {
|
||||||
dateInput: 'yyyy-MM-dd',
|
dateInput: "yyyy-MM-dd",
|
||||||
monthYearLabel: 'yyyy MMM',
|
monthYearLabel: "yyyy MMM",
|
||||||
dateA11yLabel: 'yyyy MM dd',
|
dateA11yLabel: "yyyy MM dd",
|
||||||
monthYearA11yLabel: 'yyyy MMMM',
|
monthYearA11yLabel: "yyyy MMMM",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
class PickDateAdapter extends NativeDateAdapter {
|
class PickDateAdapter extends NativeDateAdapter {
|
||||||
format(date: Date, displayFormat: Object): string {
|
override format(date: Date, displayFormat: Object): string {
|
||||||
return formatDate(date, displayFormat.toString(), "en");
|
return formatDate(date, displayFormat.toString(), "en");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-new-tunnel-flight',
|
selector: "app-new-tunnel-flight",
|
||||||
templateUrl: './new-tunnel-flight.component.html',
|
templateUrl: "./new-tunnel-flight.component.html",
|
||||||
styleUrls: ['./new-tunnel-flight.component.css'],
|
styleUrls: ["./new-tunnel-flight.component.css"],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: DateAdapter, useClass: PickDateAdapter },
|
{ provide: DateAdapter, useClass: PickDateAdapter },
|
||||||
{ provide: MAT_DATE_FORMATS, useValue: PICK_FORMATS }
|
{ provide: MAT_DATE_FORMATS, useValue: PICK_FORMATS },
|
||||||
],
|
],
|
||||||
standalone: false
|
imports: [MatAutocompleteModule, TranslateModule],
|
||||||
})
|
})
|
||||||
export class NewTunnelFlightComponent implements OnInit {
|
export class NewTunnelFlightComponent implements OnInit {
|
||||||
public flightDate: Date;
|
public flightDate: Date;
|
||||||
@@ -51,12 +56,14 @@ export class NewTunnelFlightComponent implements OnInit {
|
|||||||
public listOfJumpType: Array<JumpTypeResp>;
|
public listOfJumpType: Array<JumpTypeResp>;
|
||||||
public maxDate: Date;
|
public maxDate: Date;
|
||||||
|
|
||||||
constructor(private serviceComm: ServiceComm,
|
constructor(
|
||||||
|
private serviceComm: ServiceComm,
|
||||||
private serviceTunnel: TunnelService,
|
private serviceTunnel: TunnelService,
|
||||||
private serviceTunnelFlight: TunnelFlightService,
|
private serviceTunnelFlight: TunnelFlightService,
|
||||||
private serviceJumpType: JumpTypeService,
|
private serviceJumpType: JumpTypeService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private dateService: DateService) { }
|
private dateService: DateService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||||
@@ -77,11 +84,14 @@ export class NewTunnelFlightComponent implements OnInit {
|
|||||||
public onFormSubmit() {
|
public onFormSubmit() {
|
||||||
this.pendingAddRequest = true;
|
this.pendingAddRequest = true;
|
||||||
|
|
||||||
this.serviceTunnelFlight.addFlight(this.selectedTunnel.id,
|
this.serviceTunnelFlight
|
||||||
|
.addFlight(
|
||||||
|
this.selectedTunnel.id,
|
||||||
this.selectedJumpType.id,
|
this.selectedJumpType.id,
|
||||||
this.flightDate,
|
this.flightDate,
|
||||||
this.minutesOfFlight,
|
this.minutesOfFlight,
|
||||||
this.comments)
|
this.comments
|
||||||
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.comments = undefined;
|
this.comments = undefined;
|
||||||
|
|
||||||
@@ -93,15 +103,16 @@ export class NewTunnelFlightComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public isValidatedForm(): boolean {
|
public isValidatedForm(): boolean {
|
||||||
return (this.selectedTunnel !== undefined &&
|
return (
|
||||||
|
this.selectedTunnel !== undefined &&
|
||||||
this.selectedTunnel.id !== undefined &&
|
this.selectedTunnel.id !== undefined &&
|
||||||
this.minutesOfFlight !== undefined &&
|
this.minutesOfFlight !== undefined &&
|
||||||
typeof this.minutesOfFlight === "number");
|
typeof this.minutesOfFlight === "number"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getListOfTunnels() {
|
private getListOfTunnels() {
|
||||||
this.serviceTunnel.getListOfTunnels()
|
this.serviceTunnel.getListOfTunnels().subscribe((data) => {
|
||||||
.subscribe((data) => {
|
|
||||||
data.sort((a, b) => a.name.localeCompare(b.name));
|
data.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
this.listOfTunnel = data;
|
this.listOfTunnel = data;
|
||||||
this.listOfFilteredTunnel = data;
|
this.listOfFilteredTunnel = data;
|
||||||
@@ -110,8 +121,7 @@ export class NewTunnelFlightComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getListOfJumpTypes() {
|
private getListOfJumpTypes() {
|
||||||
this.serviceJumpType.getListOfJumpTypesForTunnel()
|
this.serviceJumpType.getListOfJumpTypesForTunnel().subscribe((data) => {
|
||||||
.subscribe((data) => {
|
|
||||||
data.sort((a, b) => a.name.localeCompare(b.name));
|
data.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
this.listOfJumpType = data;
|
this.listOfJumpType = data;
|
||||||
this.countDatasLoaded++;
|
this.countDatasLoaded++;
|
||||||
@@ -123,9 +133,9 @@ export class NewTunnelFlightComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle() {
|
private updateTitle() {
|
||||||
this.translateService.get("NewTunnelFlight_Title").subscribe(
|
this.translateService.get("NewTunnelFlight_Title").subscribe((data) => {
|
||||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
this.serviceComm.updatedComponentTitle(data);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private initForm() {
|
private initForm() {
|
||||||
@@ -139,7 +149,7 @@ export class NewTunnelFlightComponent implements OnInit {
|
|||||||
|
|
||||||
public resetTunnel() {
|
public resetTunnel() {
|
||||||
this.selectedTunnel = undefined;
|
this.selectedTunnel = undefined;
|
||||||
this.onChangeTunnel('');
|
this.onChangeTunnel("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public onChangeTunnel(event: any) {
|
public onChangeTunnel(event: any) {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||||
import { MatTableDataSource } from "@angular/material/table";
|
import { MatTableDataSource } from "@angular/material/table";
|
||||||
import { MatTabChangeEvent, MatTabGroup } from "@angular/material/tabs";
|
import { MatTabChangeEvent, MatTabGroup } from "@angular/material/tabs";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||||
import { DatePipe } from "@angular/common";
|
import { DatePipe } from "@angular/common";
|
||||||
import { ChartConfiguration, ChartData, ChartType, Colors } from "chart.js";
|
import { ChartConfiguration, ChartData, ChartType } from "chart.js";
|
||||||
|
import { MatTabsModule } from "@angular/material/tabs";
|
||||||
|
|
||||||
import { ServiceComm } from "../../services/service-comm.service";
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { StatsService } from "../../services/stats.service";
|
import { StatsService } from "../../services/stats.service";
|
||||||
@@ -19,7 +20,7 @@ import {
|
|||||||
selector: "app-summary",
|
selector: "app-summary",
|
||||||
templateUrl: "./summary.component.html",
|
templateUrl: "./summary.component.html",
|
||||||
styleUrls: ["./summary.component.css"],
|
styleUrls: ["./summary.component.css"],
|
||||||
standalone: false,
|
imports: [MatTabsModule, TranslateModule],
|
||||||
})
|
})
|
||||||
export class SummaryComponent implements OnInit {
|
export class SummaryComponent implements OnInit {
|
||||||
public dsNbJumpByDz: MatTableDataSource<StatsByDzResp>;
|
public dsNbJumpByDz: MatTableDataSource<StatsByDzResp>;
|
||||||
@@ -39,7 +40,7 @@ export class SummaryComponent implements OnInit {
|
|||||||
];
|
];
|
||||||
|
|
||||||
public barChartLegend = true;
|
public barChartLegend = true;
|
||||||
public barChartPlugins = [];
|
public barChartPlugins: any = [];
|
||||||
public barChartData: ChartData<"line">;
|
public barChartData: ChartData<"line">;
|
||||||
public barChartOptions: ChartConfiguration["options"];
|
public barChartOptions: ChartConfiguration["options"];
|
||||||
public barChartType: ChartType;
|
public barChartType: ChartType;
|
||||||
@@ -176,7 +177,15 @@ export class SummaryComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const results = [];
|
const results: {
|
||||||
|
label: string;
|
||||||
|
data: number[];
|
||||||
|
backgroundColor: string;
|
||||||
|
borderColor: string;
|
||||||
|
pointBackgroundColor: string;
|
||||||
|
fill: boolean;
|
||||||
|
pointRadius: number;
|
||||||
|
}[] = [];
|
||||||
tmpResults.forEach((value, key) => {
|
tmpResults.forEach((value, key) => {
|
||||||
const color = this.jumpTypeToColor.get(key);
|
const color = this.jumpTypeToColor.get(key);
|
||||||
let tmp = {
|
let tmp = {
|
||||||
|
|||||||
@@ -40,7 +40,9 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<button type="submit" mat-raised-button color="accent">Update my profile</button>
|
<button type="submit" mat-raised-button color="accent">
|
||||||
|
Update my profile
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,21 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { FormGroup, FormControl, Validators } from '@angular/forms';
|
import { FormGroup, FormControl, Validators } from "@angular/forms";
|
||||||
import { AuthenticationService } from '../../services/authentication.service';
|
import { AuthenticationService } from "../../services/authentication.service";
|
||||||
import { User } from '../../models/user';
|
import { User } from "../../models/user";
|
||||||
|
import { ListOfImagesComponent } from "../list-of-images/list-of-images.component";
|
||||||
|
import { MatLabel, MatFormFieldModule } from "@angular/material/form-field";
|
||||||
|
import { TranslateModule } from "@ngx-translate/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-profile',
|
selector: "app-user-profile",
|
||||||
templateUrl: './user-profile.component.html',
|
templateUrl: "./user-profile.component.html",
|
||||||
styleUrls: ['./user-profile.component.css'],
|
styleUrls: ["./user-profile.component.css"],
|
||||||
standalone: false
|
imports: [
|
||||||
|
ListOfImagesComponent,
|
||||||
|
MatLabel,
|
||||||
|
MatFormFieldModule,
|
||||||
|
TranslateModule,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class UserProfileComponent implements OnInit {
|
export class UserProfileComponent implements OnInit {
|
||||||
public userForm: FormGroup;
|
public userForm: FormGroup;
|
||||||
@@ -33,15 +41,15 @@ export class UserProfileComponent implements OnInit {
|
|||||||
Validators.email,
|
Validators.email,
|
||||||
]),
|
]),
|
||||||
currentPassword: new FormControl(
|
currentPassword: new FormControl(
|
||||||
'',
|
"",
|
||||||
Validators.pattern('^[A-Za-z0-9_-]{8,15}$')
|
Validators.pattern("^[A-Za-z0-9_-]{8,15}$")
|
||||||
),
|
),
|
||||||
newPassword: new FormControl(
|
newPassword: new FormControl(
|
||||||
'',
|
"",
|
||||||
Validators.pattern('^[A-Za-z0-9_-]{8,15}$')
|
Validators.pattern("^[A-Za-z0-9_-]{8,15}$")
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{ updateOn: 'blur' }
|
{ updateOn: "blur" }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user