Import "TranslateModule"

This commit is contained in:
2026-01-14 10:56:01 +01:00
parent 7a667f10c3
commit c4cc91bb06
23 changed files with 653 additions and 569 deletions

View File

@@ -14,7 +14,7 @@ import { ServiceCacheApi } from "../services/service-cache-api.service";
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"],
standalone: false
imports: [],
})
export class AppComponent implements OnInit {
public title = "app";
@@ -22,23 +22,23 @@ export class AppComponent implements OnInit {
public version: string;
public selectedLanguageFlag: string;
constructor(private router: Router,
constructor(
private router: Router,
private authenticationService: AuthenticationService,
private serviceComm: ServiceComm,
private serviceCacheApi: ServiceCacheApi,
private translateService: TranslateService)
{
this.authenticationService.currentUser.subscribe(user => {
private translateService: TranslateService
) {
this.authenticationService.currentUser.subscribe((user) => {
if (user) {
this.currentUser = user;
this.translateService.addLangs(['en', 'fr']);
this.translateService.addLangs(["en", "fr"]);
this.translateService.use(user.language);
this.selectedLanguageFlag = user.language;
}
});
ConfigurationHelper.settings.subscribe(settings =>
{
ConfigurationHelper.settings.subscribe((settings) => {
if (settings != null) {
this.version = settings.version;
}
@@ -46,7 +46,7 @@ export class AppComponent implements OnInit {
}
ngOnInit() {
this.serviceComm.componentTitle.subscribe(title => (this.title = title));
this.serviceComm.componentTitle.subscribe((title) => (this.title = title));
}
public show() {

View File

@@ -1,7 +1,7 @@
import { Component, OnInit } from "@angular/core";
import { Router, ActivatedRoute } from "@angular/router";
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";
@@ -12,7 +12,7 @@ import { User } from "../../models/user";
selector: "app-create-user",
templateUrl: "./create-user.component.html",
styleUrls: ["./create-user.component.css"],
standalone: false,
imports: [TranslateModule],
})
export class CreateUserComponent implements OnInit {
createForm: FormGroup;

View File

@@ -1,5 +1,5 @@
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 { AircraftService } from "../../services/aircraft.service";
@@ -13,21 +13,25 @@ import { ServiceComm } from "../../services/service-comm.service";
selector: "app-default",
templateUrl: "./default.component.html",
styleUrls: ["./default.component.css"],
standalone: false
imports: [TranslateModule],
})
export class DefaultComponent implements OnInit {
constructor(private serviceComm: ServiceComm,
constructor(
private serviceComm: ServiceComm,
private translateService: TranslateService,
private authenticationService: AuthenticationService,
private serviceApiAircraft: AircraftService,
private serviceApiJumpType: JumpTypeService,
private serviceApiDropzone: DropzoneService,
private serviceApiGear : GearService) {}
private serviceApiGear: GearService
) {}
ngOnInit() {
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.serviceComm.forceTranslateTitle.subscribe((data) => {
if (data === true) {
@@ -46,8 +50,8 @@ export class DefaultComponent implements OnInit {
}
private updateTitle() {
this.translateService.get("Default_Title").subscribe(
data => { this.serviceComm.updatedComponentTitle(data); }
);
this.translateService.get("Default_Title").subscribe((data) => {
this.serviceComm.updatedComponentTitle(data);
});
}
}

View File

@@ -1,24 +1,27 @@
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Component, Inject, OnInit } from "@angular/core";
import { MAT_DIALOG_DATA } from "@angular/material/dialog";
import { AddAction } from '../../models/add-action.enum';
import { JumpResp } from '../../models/jump';
import { JumpService } from '../../services/jump.service';
import { ServiceComm } from '../../services/service-comm.service';
import { AddAction } from "../../models/add-action.enum";
import { JumpResp } from "../../models/jump";
import { JumpService } from "../../services/jump.service";
import { ServiceComm } from "../../services/service-comm.service";
import { TranslateModule } from "@ngx-translate/core";
@Component({
selector: 'app-jump-infos',
templateUrl: './jump-infos.component.html',
styleUrls: ['./jump-infos.component.css'],
standalone: false
selector: "app-jump-infos",
templateUrl: "./jump-infos.component.html",
styleUrls: ["./jump-infos.component.css"],
imports: [TranslateModule],
})
export class JumpInfosComponent implements OnInit {
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 serviceComm: ServiceComm) {
private serviceComm: ServiceComm
) {
this.jump = new JumpResp(data.jump);
this.editMode = data.editMode;
}
@@ -26,10 +29,13 @@ export class JumpInfosComponent implements OnInit {
ngOnInit(): void {}
public updateJump() {
this.serviceJump.updateJump(this.jump.id,
this.serviceJump
.updateJump(
this.jump.id,
this.jump.isSpecial,
this.jump.withCutaway,
this.jump.notes)
this.jump.notes
)
.subscribe(() => {
this.serviceComm.refreshData(AddAction.Jump);
});

View File

@@ -1,39 +1,42 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { MatDialog } from '@angular/material/dialog';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, ViewChild } from "@angular/core";
import { MatPaginator } from "@angular/material/paginator";
import { MatTableDataSource } from "@angular/material/table";
import { MatDialog } from "@angular/material/dialog";
import { TranslateModule, TranslateService } from "@ngx-translate/core";
import { AircraftService } from '../../services/aircraft.service';
import { ServiceComm } from '../../services/service-comm.service';
import { AuthenticationService } from '../../services/authentication.service';
import { NewAircraftComponent } from '../new-aircraft/new-aircraft.component';
import { AddAction } from '../../models/add-action.enum';
import { AircraftResp } from '../../models/aircraft';
import { AircraftService } from "../../services/aircraft.service";
import { ServiceComm } from "../../services/service-comm.service";
import { AuthenticationService } from "../../services/authentication.service";
import { NewAircraftComponent } from "../new-aircraft/new-aircraft.component";
import { AddAction } from "../../models/add-action.enum";
import { AircraftResp } from "../../models/aircraft";
@Component({
selector: 'app-list-of-aircrafts',
templateUrl: './list-of-aircrafts.component.html',
styleUrls: ['./list-of-aircrafts.component.css'],
standalone: false
selector: "app-list-of-aircrafts",
templateUrl: "./list-of-aircrafts.component.html",
styleUrls: ["./list-of-aircrafts.component.css"],
imports: [TranslateModule],
})
export class ListOfAircraftsComponent implements OnInit {
public displayedColumns: Array<string> = ['name', 'imageData'];
public displayedColumns: Array<string> = ["name", "imageData"];
public dataSourceTable: MatTableDataSource<AircraftResp>;
public resultsLength = 0;
public isUserAdmin: boolean;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
constructor(private serviceApi: AircraftService,
constructor(
private serviceApi: AircraftService,
private serviceComm: ServiceComm,
private authenticationService: AuthenticationService,
public dialog: MatDialog,
private translateService: TranslateService) {
this.isUserAdmin = this.authenticationService.currentUserValue.roles === "admin";
private translateService: TranslateService
) {
this.isUserAdmin =
this.authenticationService.currentUserValue.roles === "admin";
}
ngOnInit() {
this.serviceComm.refreshRequest.subscribe(action => {
this.serviceComm.refreshRequest.subscribe((action) => {
if (action === AddAction.Aircraft) {
this.dialog.closeAll();
this.getListOfAircrafts();
@@ -50,7 +53,7 @@ export class ListOfAircraftsComponent implements OnInit {
}
private getListOfAircrafts() {
this.serviceApi.getListOfAircrafts().subscribe(data => {
this.serviceApi.getListOfAircrafts().subscribe((data) => {
setTimeout(() => {
data.sort((a, b) => a.name.localeCompare(b.name));
this.dataSourceTable = new MatTableDataSource<AircraftResp>(data);
@@ -65,8 +68,8 @@ export class ListOfAircraftsComponent implements OnInit {
}
private updateTitle() {
this.translateService.get("ListAircrafts_Title").subscribe(
data => { this.serviceComm.updatedComponentTitle(data); }
);
this.translateService.get("ListAircrafts_Title").subscribe((data) => {
this.serviceComm.updatedComponentTitle(data);
});
}
}

View File

@@ -1,40 +1,43 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { MatDialog } from '@angular/material/dialog';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, ViewChild } from "@angular/core";
import { MatPaginator } from "@angular/material/paginator";
import { MatTableDataSource } from "@angular/material/table";
import { MatDialog } from "@angular/material/dialog";
import { TranslateModule, TranslateService } from "@ngx-translate/core";
import { AddAction } from '../../models/add-action.enum';
import { DropZoneResp } from '../../models/dropzone';
import { DropzoneService } from '../../services/dropzone.service';
import { ServiceComm } from '../../services/service-comm.service';
import { AuthenticationService } from '../../services/authentication.service';
import { NewDropZoneComponent } from '../new-drop-zone/new-drop-zone.component';
import { AddAction } from "../../models/add-action.enum";
import { DropZoneResp } from "../../models/dropzone";
import { DropzoneService } from "../../services/dropzone.service";
import { ServiceComm } from "../../services/service-comm.service";
import { AuthenticationService } from "../../services/authentication.service";
import { NewDropZoneComponent } from "../new-drop-zone/new-drop-zone.component";
@Component({
selector: 'app-list-of-dzs',
templateUrl: './list-of-dzs.component.html',
styleUrls: ['./list-of-dzs.component.css'],
standalone: false
selector: "app-list-of-dzs",
templateUrl: "./list-of-dzs.component.html",
styleUrls: ["./list-of-dzs.component.css"],
imports: [TranslateModule],
})
export class ListOfDzsComponent implements OnInit {
public displayedColumns: Array<string> = [
'isfavorite',
'name',
'address',
'type',
"isfavorite",
"name",
"address",
"type",
];
public dataSourceTable: MatTableDataSource<DropZoneResp>;
public isUserAdmin: boolean;
public resultsLength = 0;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
constructor(private serviceApi: DropzoneService,
constructor(
private serviceApi: DropzoneService,
private serviceComm: ServiceComm,
private authenticationService: AuthenticationService,
public dialog: MatDialog,
private translateService: TranslateService) {
this.isUserAdmin = this.authenticationService.currentUserValue.roles === "admin";
private translateService: TranslateService
) {
this.isUserAdmin =
this.authenticationService.currentUserValue.roles === "admin";
}
ngOnInit() {
@@ -55,10 +58,13 @@ export class ListOfDzsComponent implements OnInit {
}
private getListOfDropZones() {
this.serviceApi.getListOfDropZones()
.subscribe((data) => {
this.serviceApi.getListOfDropZones().subscribe((data) => {
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.paginator = this.paginator;
this.resultsLength = data.length;
@@ -88,8 +94,8 @@ export class ListOfDzsComponent implements OnInit {
openDialogToAdd() {
this.dialog.open(NewDropZoneComponent, {
height: '400px',
width: '600px',
height: "400px",
width: "600px",
});
}
@@ -99,8 +105,8 @@ export class ListOfDzsComponent implements OnInit {
}
private updateTitle() {
this.translateService.get("ListDz_Title").subscribe(
data => { this.serviceComm.updatedComponentTitle(data); }
);
this.translateService.get("ListDz_Title").subscribe((data) => {
this.serviceComm.updatedComponentTitle(data);
});
}
}

View File

@@ -2,7 +2,7 @@ import { Component, OnInit, ViewChild } from "@angular/core";
import { MatPaginator } from "@angular/material/paginator";
import { MatTableDataSource } from "@angular/material/table";
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 { ServiceComm } from "../../services/service-comm.service";
@@ -14,7 +14,7 @@ import { NewGearComponent } from "../new-gear/new-gear.component";
selector: "app-list-of-gears",
templateUrl: "./list-of-gears.component.html",
styleUrls: ["./list-of-gears.component.css"],
standalone: false
imports: [TranslateModule],
})
export class ListOfGearsComponent implements OnInit {
public displayedColumns: Array<string> = [
@@ -23,19 +23,21 @@ export class ListOfGearsComponent implements OnInit {
"maxSize",
"aad",
"mainCanopy",
"reserveCanopy"
"reserveCanopy",
];
public dataSourceTable: MatTableDataSource<GearResp>;
public resultsLength = 0;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
constructor(private serviceApi: GearService,
constructor(
private serviceApi: GearService,
private serviceComm: ServiceComm,
public dialog: MatDialog,
private translateService: TranslateService) {}
private translateService: TranslateService
) {}
ngOnInit() {
this.serviceComm.refreshRequest.subscribe(action => {
this.serviceComm.refreshRequest.subscribe((action) => {
if (action === AddAction.Gear) {
this.dialog.closeAll();
this.getListOfGears();
@@ -52,8 +54,7 @@ export class ListOfGearsComponent implements OnInit {
}
getListOfGears() {
this.serviceApi.getListOfGears()
.subscribe(data => {
this.serviceApi.getListOfGears().subscribe((data) => {
setTimeout(() => {
data.sort((a, b) => b.id - a.id);
this.dataSourceTable = new MatTableDataSource<GearResp>(data);
@@ -66,13 +67,13 @@ export class ListOfGearsComponent implements OnInit {
openDialogToAdd() {
this.dialog.open(NewGearComponent, {
height: "400px",
width: "600px"
width: "600px",
});
}
private updateTitle() {
this.translateService.get("ListGears_Title").subscribe(
data => { this.serviceComm.updatedComponentTitle(data); }
);
this.translateService.get("ListGears_Title").subscribe((data) => {
this.serviceComm.updatedComponentTitle(data);
});
}
}

View File

@@ -1,30 +1,31 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { MatTableDataSource } from '@angular/material/table';
import { MatPaginator } from '@angular/material/paginator';
import { trigger,state, style } from '@angular/animations';
import { Component, OnInit, ViewChild } from "@angular/core";
import { FormGroup, FormControl, Validators } from "@angular/forms";
import { MatTableDataSource } from "@angular/material/table";
import { MatPaginator } from "@angular/material/paginator";
import { trigger, state, style } from "@angular/animations";
import { ImageService } from '../../services/image.service';
import { ServiceComm } from '../../services/service-comm.service';
import { ImageResp } from '../../models/image';
import { AddAction } from '../../models/add-action.enum';
import { ImageService } from "../../services/image.service";
import { ServiceComm } from "../../services/service-comm.service";
import { ImageResp } from "../../models/image";
import { AddAction } from "../../models/add-action.enum";
import { TranslateModule } from "@ngx-translate/core";
@Component({
selector: 'app-list-of-images',
templateUrl: './list-of-images.component.html',
styleUrls: ['./list-of-images.component.css'],
selector: "app-list-of-images",
templateUrl: "./list-of-images.component.html",
styleUrls: ["./list-of-images.component.css"],
animations: [
trigger('rotatedState', [
state('default', style({ transform: 'rotate(0)' })),
state('rot90', style({ transform: 'rotate(-90deg)' })),
state('rot180', style({ transform: 'rotate(-180deg)' })),
state('rot270', style({ transform: 'rotate(-270deg)' })),
])
trigger("rotatedState", [
state("default", style({ transform: "rotate(0)" })),
state("rot90", style({ transform: "rotate(-90deg)" })),
state("rot180", style({ transform: "rotate(-180deg)" })),
state("rot270", style({ transform: "rotate(-270deg)" })),
]),
],
standalone: false
imports: [TranslateModule],
})
export class ListOfImagesComponent implements OnInit {
public displayedColumns: Array<string> = ['comment', 'data'];
public displayedColumns: Array<string> = ["comment", "data"];
public imgForm: FormGroup;
public imageError: string;
private selectedFile: string;
@@ -32,7 +33,7 @@ export class ListOfImagesComponent implements OnInit {
public showPopin: boolean;
public dataSourceTable: MatTableDataSource<ImageResp>;
public resultsLength = 0;
public stateRotation: string = 'default';
public stateRotation: string = "default";
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
constructor(
@@ -49,14 +50,13 @@ export class ListOfImagesComponent implements OnInit {
this.getListOfImages();
this.imgForm = new FormGroup({
comment: new FormControl('', Validators.required),
image: new FormControl('', Validators.required),
comment: new FormControl("", Validators.required),
image: new FormControl("", Validators.required),
});
}
private getListOfImages() {
this.serviceApi.getListOfImages()
.subscribe((data) => {
this.serviceApi.getListOfImages().subscribe((data) => {
setTimeout(() => {
this.dataSourceTable = new MatTableDataSource<ImageResp>(data);
this.dataSourceTable.paginator = this.paginator;
@@ -69,13 +69,13 @@ export class ListOfImagesComponent implements OnInit {
const file = fileInput.dataTransfer
? fileInput.dataTransfer.files[0]
: fileInput.target.files[0];
const allowed_types = ['image/png', 'image/jpeg'];
const allowed_types = ["image/png", "image/jpeg"];
const max_size = 20971520;
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) {
this.imageError = 'Maximum size allowed is ' + max_size / 1000 + 'Mb';
this.imageError = "Maximum size allowed is " + max_size / 1000 + "Mb";
} else {
const reader = new FileReader();
reader.onload = this.checkAndExtractDataToBase64.bind(this);
@@ -90,16 +90,16 @@ export class ListOfImagesComponent implements OnInit {
const image = new Image();
image.src = e.target.result;
image.onload = (rs) => {
const img_height = rs.currentTarget['height'];
const img_width = rs.currentTarget['width'];
const img_height = rs.currentTarget["height"];
const img_width = rs.currentTarget["width"];
if (img_height > max_height && img_width > max_width) {
this.imageError =
'Maximum dimentions allowed ' + max_height + '*' + max_width + 'px';
"Maximum dimentions allowed " + max_height + "*" + max_width + "px";
} else {
const imgBase64Path = e.target.result;
this.selectedFile = imgBase64Path;
this.imageError = 'OK';
this.imageError = "OK";
}
};
}
@@ -109,10 +109,11 @@ export class ListOfImagesComponent implements OnInit {
return;
}
this.serviceApi.addImage(formData.comment, this.selectedFile)
.subscribe(
() => { this.getListOfImages(); }
);
this.serviceApi
.addImage(formData.comment, this.selectedFile)
.subscribe(() => {
this.getListOfImages();
});
}
openModal(image: ImageResp) {
@@ -125,14 +126,14 @@ export class ListOfImagesComponent implements OnInit {
}
rotate() {
if (this.stateRotation === 'default') {
this.stateRotation = 'rot90';
} else if (this.stateRotation === 'rot90') {
this.stateRotation = 'rot180';
} else if (this.stateRotation === 'rot180') {
this.stateRotation = 'rot270';
if (this.stateRotation === "default") {
this.stateRotation = "rot90";
} else if (this.stateRotation === "rot90") {
this.stateRotation = "rot180";
} else if (this.stateRotation === "rot180") {
this.stateRotation = "rot270";
} else {
this.stateRotation = 'default';
this.stateRotation = "default";
}
}
}

View File

@@ -2,20 +2,20 @@ import { Component, OnInit, ViewChild } from "@angular/core";
import { MatPaginator } from "@angular/material/paginator";
import { MatTableDataSource } from "@angular/material/table";
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 { JumpTypeResp } from "../../models/jumpType";
import { JumpTypeService } from "../../services/jump-type.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";
@Component({
selector: "app-list-of-jump-types",
templateUrl: "./list-of-jump-types.component.html",
styleUrls: ["./list-of-jump-types.component.css"],
standalone: false
imports: [TranslateModule],
})
export class ListOfJumpTypesComponent implements OnInit {
public displayedColumns: Array<string> = ["name"];
@@ -24,16 +24,19 @@ export class ListOfJumpTypesComponent implements OnInit {
public resultsLength = 0;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
constructor(private serviceApi: JumpTypeService,
constructor(
private serviceApi: JumpTypeService,
private serviceComm: ServiceComm,
private authenticationService: AuthenticationService,
public dialog: MatDialog,
private translateService: TranslateService) {
this.isUserAdmin = this.authenticationService.currentUserValue.roles === "admin";
private translateService: TranslateService
) {
this.isUserAdmin =
this.authenticationService.currentUserValue.roles === "admin";
}
ngOnInit() {
this.serviceComm.refreshRequest.subscribe(action => {
this.serviceComm.refreshRequest.subscribe((action) => {
if (action === AddAction.JumpType) {
this.dialog.closeAll();
this.getListOfJumpTypes();
@@ -50,7 +53,7 @@ export class ListOfJumpTypesComponent implements OnInit {
}
getListOfJumpTypes() {
this.serviceApi.getListOfJumpTypes().subscribe(data => {
this.serviceApi.getListOfJumpTypes().subscribe((data) => {
setTimeout(() => {
data.sort((a, b) => a.name.localeCompare(b.name));
this.dataSourceTable = new MatTableDataSource<JumpTypeResp>(data);
@@ -65,8 +68,8 @@ export class ListOfJumpTypesComponent implements OnInit {
}
private updateTitle() {
this.translateService.get("ListJumpTypes_Title").subscribe(
data => { this.serviceComm.updatedComponentTitle(data); }
);
this.translateService.get("ListJumpTypes_Title").subscribe((data) => {
this.serviceComm.updatedComponentTitle(data);
});
}
}

View File

@@ -2,7 +2,7 @@ import { Component, OnInit, ViewChild } from "@angular/core";
import { MatPaginator, PageEvent } from "@angular/material/paginator";
import { MatTableDataSource } from "@angular/material/table";
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 { Jump } from "../../models/jump";
@@ -15,7 +15,7 @@ import { StatsService } from "../../services/stats.service";
selector: "app-list-of-jumps",
templateUrl: "./list-of-jumps.component.html",
styleUrls: ["./list-of-jumps.component.css"],
standalone: false
imports: [TranslateModule],
})
export class ListOfJumpsComponent implements OnInit {
public displayedColumns: Array<string> = [
@@ -31,7 +31,8 @@ export class ListOfJumpsComponent implements OnInit {
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
public isLoading: boolean = false;
constructor(private serviceApi: JumpService,
constructor(
private serviceApi: JumpService,
private serviceComm: ServiceComm,
public dialog: MatDialog,
private translateService: TranslateService,
@@ -62,7 +63,8 @@ export class ListOfJumpsComponent implements OnInit {
getListOfJumps(pageSize: number = 20, pageIndex: number = 0) {
this.isLoading = true;
this.serviceApi.getJumps(pageIndex * pageSize, pageIndex * pageSize + pageSize)
this.serviceApi
.getJumps(pageIndex * pageSize, pageIndex * pageSize + pageSize)
.subscribe((data) => {
this.dataSourceTable.data = data.rows;
setTimeout(() => {

View File

@@ -38,6 +38,7 @@
</mat-nav-list>
<div class="chart-container">
<!-- https://www.freecodecamp.org/news/how-to-make-bar-and-line-charts-using-chartjs-in-angular/ -->
<canvas
baseChart
[data]="barChartData"

View File

@@ -1,9 +1,9 @@
import { Component, OnInit } from "@angular/core";
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 { 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 { TunnelFlightService } from "../../services/tunnel-flight.service";
@@ -14,7 +14,7 @@ import { TunnelFlight, TunnelFlightByMonth } from "../../models/tunnel-flight";
selector: "app-list-of-tunnel-flights",
templateUrl: "./list-of-tunnel-flights.component.html",
styleUrls: ["./list-of-tunnel-flights.component.css"],
standalone: false,
imports: [TranslateModule],
})
export class ListOfTunnelFlightsComponent implements OnInit {
public barChartLegend = true;

View File

@@ -6,12 +6,13 @@ import { MatInput } from "@angular/material/input";
import { first } from "rxjs/operators";
import { AuthenticationService } from "../../services/authentication.service";
import { TranslateModule } from "@ngx-translate/core";
@Component({
selector: "app-login-user",
templateUrl: "./login-user.component.html",
styleUrls: ["./login-user.component.css"],
standalone: false,
imports: [TranslateModule],
})
export class LoginUserComponent implements OnInit, AfterViewInit {
loginForm: FormGroup;

View File

@@ -1,18 +1,18 @@
import { Component, OnInit } from "@angular/core";
import { TranslateService } from "@ngx-translate/core";
import { TranslateModule, TranslateService } from "@ngx-translate/core";
@Component({
selector: "app-login",
templateUrl: "./login.component.html",
styleUrls: ["./login.component.css"],
standalone: false
imports: [TranslateModule],
})
export class LoginComponent implements OnInit {
public selectedLanguageFlag: string;
constructor(private translate: TranslateService) {
translate.addLangs(['en', 'fr']);
translate.setDefaultLang('en');
translate.addLangs(["en", "fr"]);
translate.setDefaultLang("en");
this.selectedLanguageFlag = "en";
}

View File

@@ -1,27 +1,30 @@
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { AircraftService } from '../../services/aircraft.service';
import { ServiceComm } from '../../services/service-comm.service';
import { AddAction } from '../../models/add-action.enum';
import { Component, OnInit } from "@angular/core";
import { FormControl, FormGroup, Validators } from "@angular/forms";
import { AircraftService } from "../../services/aircraft.service";
import { ServiceComm } from "../../services/service-comm.service";
import { AddAction } from "../../models/add-action.enum";
import { TranslateModule } from "@ngx-translate/core";
@Component({
selector: 'app-new-aircraft',
templateUrl: './new-aircraft.component.html',
styleUrls: ['./new-aircraft.component.css'],
standalone: false
selector: "app-new-aircraft",
templateUrl: "./new-aircraft.component.html",
styleUrls: ["./new-aircraft.component.css"],
imports: [TranslateModule],
})
export class NewAircraftComponent implements OnInit {
public addForm: FormGroup;
public imageError: string;
private selectedFile: string;
constructor(private serviceComm: ServiceComm,
private serviceApi: AircraftService) {
constructor(
private serviceComm: ServiceComm,
private serviceApi: AircraftService
) {
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;
}
this.serviceApi.addAircraft(formData.aircraftName, this.selectedFile)
this.serviceApi
.addAircraft(formData.aircraftName, this.selectedFile)
.subscribe(() => {
this.serviceComm.refreshData(AddAction.Aircraft);
});
}
public onFileChanged(fileInput: any) {
const file = fileInput.dataTransfer ? fileInput.dataTransfer.files[0] : fileInput.target.files[0];
const allowed_types = ['image/png', 'image/jpeg'];
const file = fileInput.dataTransfer
? fileInput.dataTransfer.files[0]
: fileInput.target.files[0];
const allowed_types = ["image/png", "image/jpeg"];
const max_size = 20971520;
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) {
this.imageError = 'Maximum size allowed is ' + max_size / 1000 + 'Mb';
this.imageError = "Maximum size allowed is " + max_size / 1000 + "Mb";
} else {
const reader = new FileReader();
reader.onload = this.checkAndExtractDataToBase64.bind(this);
@@ -61,16 +67,16 @@ export class NewAircraftComponent implements OnInit {
const image = new Image();
image.src = e.target.result;
image.onload = (rs) => {
const img_height = rs.currentTarget['height'];
const img_width = rs.currentTarget['width'];
const img_height = rs.currentTarget["height"];
const img_width = rs.currentTarget["width"];
if (img_height > max_height && img_width > max_width) {
this.imageError =
'Maximum dimentions allowed ' + max_height + '*' + max_width + 'px';
"Maximum dimentions allowed " + max_height + "*" + max_width + "px";
} else {
const imgBase64Path = e.target.result;
this.selectedFile = imgBase64Path;
this.imageError = 'OK';
this.imageError = "OK";
}
};
}

View File

@@ -3,12 +3,13 @@ import { FormControl, FormGroup, Validators } from "@angular/forms";
import { AddAction } from "../../models/add-action.enum";
import { ServiceComm } from "../../services/service-comm.service";
import { DropzoneService } from "../../services/dropzone.service";
import { TranslateModule } from "@ngx-translate/core";
@Component({
selector: "app-new-drop-zone",
templateUrl: "./new-drop-zone.component.html",
styleUrls: ["./new-drop-zone.component.css"],
standalone: false
imports: [TranslateModule],
})
export class NewDropZoneComponent implements OnInit {
public addForm: FormGroup;
@@ -22,16 +23,16 @@ export class NewDropZoneComponent implements OnInit {
dzName: new FormControl("", Validators.required),
gps: new FormControl("x.x,y.y", [
Validators.required,
Validators.pattern("d+.d+,d+.d+")
Validators.pattern("d+.d+,d+.d+"),
]),
address: new FormControl("", Validators.required),
website: new FormControl("", Validators.required),
contactMail: new FormControl("", [
Validators.required,
Validators.email
Validators.email,
]),
isDz: new FormControl(true),
isTunnel: new FormControl(false)
isTunnel: new FormControl(false),
},
{ updateOn: "blur" }
);
@@ -50,14 +51,17 @@ export class NewDropZoneComponent implements OnInit {
dzType.push("tunnel");
}
this.dropzoneService.addDropZone(splitGps[0],
this.dropzoneService
.addDropZone(
splitGps[0],
splitGps[1],
formData.dzName,
formData.address,
formData.website,
formData.contactMail,
dzType,
false)
false
)
.subscribe(() => {
this.serviceComm.refreshData(AddAction.Dropzone);
});

View File

@@ -4,19 +4,21 @@ import { FormControl, FormGroup, Validators } from "@angular/forms";
import { ServiceComm } from "../../services/service-comm.service";
import { GearService } from "../../services/gear.service";
import { AddAction } from "../../models/add-action.enum";
import { TranslateModule } from "@ngx-translate/core";
@Component({
selector: "app-new-gear",
templateUrl: "./new-gear.component.html",
styleUrls: ["./new-gear.component.css"],
standalone: false
imports: [TranslateModule],
})
export class NewGearComponent implements OnInit {
public addForm: FormGroup;
constructor(private serviceComm: ServiceComm,
private serviceApi: GearService)
{
constructor(
private serviceComm: ServiceComm,
private serviceApi: GearService
) {
this.addForm = new FormGroup(
{
name: new FormControl("", Validators.required),
@@ -24,24 +26,24 @@ export class NewGearComponent implements OnInit {
minSize: new FormControl("", [
Validators.required,
Validators.min(60),
Validators.max(320)
Validators.max(320),
]),
maxSize: new FormControl("", [
Validators.required,
Validators.min(60),
Validators.max(320)
Validators.max(320),
]),
aad: new FormControl("", Validators.required),
mainCanopy: new FormControl("", [
Validators.required,
Validators.min(60),
Validators.max(320)
Validators.max(320),
]),
reserveCanopy: new FormControl("", [
Validators.required,
Validators.min(60),
Validators.max(320)
])
Validators.max(320),
]),
},
{ updateOn: "blur" }
);
@@ -50,13 +52,16 @@ export class NewGearComponent implements OnInit {
ngOnInit() {}
onSubmit(formData) {
this.serviceApi.addGear(formData.name,
this.serviceApi
.addGear(
formData.name,
formData.manufacturer,
+formData.minSize,
+formData.maxSize,
formData.aad,
formData.mainCanopy,
formData.reserveCanopy)
formData.reserveCanopy
)
.subscribe(() => {
this.serviceComm.refreshData(AddAction.Gear);
});

View File

@@ -3,21 +3,24 @@ import { FormControl, FormGroup, Validators } from "@angular/forms";
import { AddAction } from "../../models/add-action.enum";
import { ServiceComm } from "../../services/service-comm.service";
import { JumpTypeService } from "../../services/jump-type.service";
import { TranslateModule } from "@ngx-translate/core";
@Component({
selector: "app-new-jump-type",
templateUrl: "./new-jump-type.component.html",
styleUrls: ["./new-jump-type.component.css"],
standalone: false
imports: [TranslateModule],
})
export class NewJumpTypeComponent implements OnInit {
public addForm: FormGroup;
constructor(private serviceComm: ServiceComm,
private jumpTypeService: JumpTypeService) {
constructor(
private serviceComm: ServiceComm,
private jumpTypeService: JumpTypeService
) {
this.addForm = new FormGroup(
{
jumptypeName: new FormControl("", Validators.required)
jumptypeName: new FormControl("", Validators.required),
},
{ updateOn: "blur" }
);
@@ -26,8 +29,7 @@ export class NewJumpTypeComponent implements OnInit {
ngOnInit() {}
onSubmit(formData) {
this.jumpTypeService.addJumpType(formData.jumptypeName)
.subscribe(() => {
this.jumpTypeService.addJumpType(formData.jumptypeName).subscribe(() => {
this.serviceComm.refreshData(AddAction.JumpType);
});
}

View File

@@ -1,7 +1,11 @@
import { Component, OnInit } from "@angular/core";
import { formatDate } from '@angular/common';
import { DateAdapter, MAT_DATE_FORMATS, NativeDateAdapter } from "@angular/material/core";
import { TranslateService } from '@ngx-translate/core';
import { formatDate } from "@angular/common";
import {
DateAdapter,
MAT_DATE_FORMATS,
NativeDateAdapter,
} from "@angular/material/core";
import { TranslateModule, TranslateService } from "@ngx-translate/core";
import { JumpTypeResp } from "../../models/jumpType";
import { AircraftResp } from "../../models/aircraft";
@@ -17,18 +21,17 @@ import { JumpTypeService } from "../../services/jump-type.service";
import { GearService } from "../../services/gear.service";
import { StatsService } from "../../services/stats.service";
export const PICK_FORMATS = {
parse: { dateInput: 'yy MM dd' },
parse: { dateInput: "yy MM dd" },
display: {
dateInput: 'yyyy-MM-dd',
monthYearLabel: 'yyyy MMM',
dateA11yLabel: 'yyyy MM dd',
monthYearA11yLabel: 'yyyy MMMM',
}
dateInput: "yyyy-MM-dd",
monthYearLabel: "yyyy MMM",
dateA11yLabel: "yyyy MM dd",
monthYearA11yLabel: "yyyy MMMM",
},
};
class PickDateAdapter extends NativeDateAdapter {
format(date: Date, displayFormat: Object): string {
override format(date: Date, displayFormat: Object): string {
return formatDate(date, displayFormat.toString(), "en");
}
}
@@ -39,9 +42,9 @@ class PickDateAdapter extends NativeDateAdapter {
styleUrls: ["./new-jump.component.css"],
providers: [
{ 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 {
public beginDate: Date;
@@ -66,7 +69,8 @@ export class NewJumpComponent implements OnInit {
private listOfDropZone: Array<DropZoneResp>;
public maxDate: Date;
constructor(private serviceComm: ServiceComm,
constructor(
private serviceComm: ServiceComm,
private serviceJump: JumpService,
private serviceJumpType: JumpTypeService,
private serviceAircraft: AircraftService,
@@ -74,7 +78,8 @@ export class NewJumpComponent implements OnInit {
private serviceGear: GearService,
private dateService: DateService,
private translateService: TranslateService,
private statsService : StatsService) {}
private statsService: StatsService
) {}
ngOnInit() {
this.serviceComm.forceTranslateTitle.subscribe((data) => {
@@ -94,7 +99,9 @@ export class NewJumpComponent implements OnInit {
onFormSubmit() {
this.pendingAddRequest = true;
this.serviceJump.addListOfJump(this.selectedJumpType.id,
this.serviceJump
.addListOfJump(
this.selectedJumpType.id,
this.selectedAircraft.id,
this.selectedDz.id,
this.selectedGear.id,
@@ -105,7 +112,8 @@ export class NewJumpComponent implements OnInit {
this.deployAltitude,
this.countOfJumps,
this.comments,
this.isSpecial === undefined ? false : this.isSpecial)
this.isSpecial === undefined ? false : this.isSpecial
)
.subscribe(() => {
this.statsService.resetStats();
this.comments = undefined;
@@ -120,7 +128,8 @@ export class NewJumpComponent implements OnInit {
}
public isValidatedForm(): boolean {
return (this.selectedDz !== undefined &&
return (
this.selectedDz !== undefined &&
this.selectedDz.id !== undefined &&
this.selectedGear !== undefined &&
this.selectedGear.id !== undefined &&
@@ -133,12 +142,12 @@ export class NewJumpComponent implements OnInit {
this.deployAltitude !== undefined &&
typeof this.deployAltitude === "number" &&
this.countOfJumps !== undefined &&
typeof this.countOfJumps === "number");
typeof this.countOfJumps === "number"
);
}
private getListOfJumpTypes() {
this.serviceJumpType.getListOfJumpTypes()
.subscribe((data) => {
this.serviceJumpType.getListOfJumpTypes().subscribe((data) => {
data.sort((a, b) => a.name.localeCompare(b.name));
this.listOfJumpType = data;
this.countDatasLoaded = 1;
@@ -150,8 +159,7 @@ export class NewJumpComponent implements OnInit {
}
private getListOfAircrafts() {
this.serviceAircraft.getListOfAircrafts(true)
.subscribe((data) => {
this.serviceAircraft.getListOfAircrafts(true).subscribe((data) => {
data.sort((a, b) => a.name.localeCompare(b.name));
this.listOfAircraft = data;
this.countDatasLoaded++;
@@ -159,9 +167,12 @@ export class NewJumpComponent implements OnInit {
}
private getListOfDropZones() {
this.serviceDropzone.getListOfDropZones(true)
.subscribe((data) => {
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0) || a.name.localeCompare(b.name));
this.serviceDropzone.getListOfDropZones(true).subscribe((data) => {
data.sort(
(a, b) =>
(b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0) ||
a.name.localeCompare(b.name)
);
this.listOfDropZone = data;
this.listOfFilteredDropZone = data;
this.countDatasLoaded++;
@@ -169,8 +180,7 @@ export class NewJumpComponent implements OnInit {
}
private getListOfGears() {
this.serviceGear.getListOfGears()
.subscribe((data) => {
this.serviceGear.getListOfGears().subscribe((data) => {
data.sort((a, b) => b.id - a.id);
this.listOfGear = data;
this.countDatasLoaded++;
@@ -212,8 +222,8 @@ export class NewJumpComponent implements OnInit {
filterValue = event.toLowerCase();
this.listOfFilteredDropZone = this.listOfDropZone;
this.listOfFilteredDropZone = this.listOfFilteredDropZone.filter((option) =>
option.name.toLowerCase().includes(filterValue)
this.listOfFilteredDropZone = this.listOfFilteredDropZone.filter(
(option) => option.name.toLowerCase().includes(filterValue)
);
}
}
@@ -228,12 +238,12 @@ export class NewJumpComponent implements OnInit {
public resetDz() {
this.selectedDz = undefined;
this.onChangeDz('');
this.onChangeDz("");
}
private updateTitle() {
this.translateService.get("NewJump_Title").subscribe(
data => { this.serviceComm.updatedComponentTitle(data); }
);
this.translateService.get("NewJump_Title").subscribe((data) => {
this.serviceComm.updatedComponentTitle(data);
});
}
}

View File

@@ -1,41 +1,46 @@
import { Component, OnInit } from "@angular/core";
import { formatDate } from '@angular/common';
import { DateAdapter, MAT_DATE_FORMATS, NativeDateAdapter } from "@angular/material/core";
import { TranslateService } from '@ngx-translate/core';
import { formatDate } from "@angular/common";
import {
DateAdapter,
MAT_DATE_FORMATS,
NativeDateAdapter,
} from "@angular/material/core";
import { TranslateModule, TranslateService } from "@ngx-translate/core";
import { TunnelResp } from "../../models/tunnel";
import { JumpTypeResp } from "../../models/jumpType";
import { TunnelService } from '../../services/tunnel.service';
import { ServiceComm } from '../../services/service-comm.service';
import { TunnelService } from "../../services/tunnel.service";
import { ServiceComm } from "../../services/service-comm.service";
import { TunnelFlightService } from "../../services/tunnel-flight.service";
import { JumpTypeService } from "../../services/jump-type.service";
import { DateService } from "../../services/date.service";
import { MatAutocompleteModule } from "@angular/material/autocomplete";
export const PICK_FORMATS = {
parse: { dateInput: 'yy MM dd' },
parse: { dateInput: "yy MM dd" },
display: {
dateInput: 'yyyy-MM-dd',
monthYearLabel: 'yyyy MMM',
dateA11yLabel: 'yyyy MM dd',
monthYearA11yLabel: 'yyyy MMMM',
}
dateInput: "yyyy-MM-dd",
monthYearLabel: "yyyy MMM",
dateA11yLabel: "yyyy MM dd",
monthYearA11yLabel: "yyyy MMMM",
},
};
class PickDateAdapter extends NativeDateAdapter {
format(date: Date, displayFormat: Object): string {
override format(date: Date, displayFormat: Object): string {
return formatDate(date, displayFormat.toString(), "en");
}
}
@Component({
selector: 'app-new-tunnel-flight',
templateUrl: './new-tunnel-flight.component.html',
styleUrls: ['./new-tunnel-flight.component.css'],
selector: "app-new-tunnel-flight",
templateUrl: "./new-tunnel-flight.component.html",
styleUrls: ["./new-tunnel-flight.component.css"],
providers: [
{ 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 {
public flightDate: Date;
@@ -51,12 +56,14 @@ export class NewTunnelFlightComponent implements OnInit {
public listOfJumpType: Array<JumpTypeResp>;
public maxDate: Date;
constructor(private serviceComm: ServiceComm,
constructor(
private serviceComm: ServiceComm,
private serviceTunnel: TunnelService,
private serviceTunnelFlight: TunnelFlightService,
private serviceJumpType: JumpTypeService,
private translateService: TranslateService,
private dateService: DateService) { }
private dateService: DateService
) {}
ngOnInit() {
this.serviceComm.forceTranslateTitle.subscribe((data) => {
@@ -77,11 +84,14 @@ export class NewTunnelFlightComponent implements OnInit {
public onFormSubmit() {
this.pendingAddRequest = true;
this.serviceTunnelFlight.addFlight(this.selectedTunnel.id,
this.serviceTunnelFlight
.addFlight(
this.selectedTunnel.id,
this.selectedJumpType.id,
this.flightDate,
this.minutesOfFlight,
this.comments)
this.comments
)
.subscribe(() => {
this.comments = undefined;
@@ -93,15 +103,16 @@ export class NewTunnelFlightComponent implements OnInit {
}
public isValidatedForm(): boolean {
return (this.selectedTunnel !== undefined &&
return (
this.selectedTunnel !== undefined &&
this.selectedTunnel.id !== undefined &&
this.minutesOfFlight !== undefined &&
typeof this.minutesOfFlight === "number");
typeof this.minutesOfFlight === "number"
);
}
private getListOfTunnels() {
this.serviceTunnel.getListOfTunnels()
.subscribe((data) => {
this.serviceTunnel.getListOfTunnels().subscribe((data) => {
data.sort((a, b) => a.name.localeCompare(b.name));
this.listOfTunnel = data;
this.listOfFilteredTunnel = data;
@@ -110,8 +121,7 @@ export class NewTunnelFlightComponent implements OnInit {
}
private getListOfJumpTypes() {
this.serviceJumpType.getListOfJumpTypesForTunnel()
.subscribe((data) => {
this.serviceJumpType.getListOfJumpTypesForTunnel().subscribe((data) => {
data.sort((a, b) => a.name.localeCompare(b.name));
this.listOfJumpType = data;
this.countDatasLoaded++;
@@ -123,9 +133,9 @@ export class NewTunnelFlightComponent implements OnInit {
}
private updateTitle() {
this.translateService.get("NewTunnelFlight_Title").subscribe(
data => { this.serviceComm.updatedComponentTitle(data); }
);
this.translateService.get("NewTunnelFlight_Title").subscribe((data) => {
this.serviceComm.updatedComponentTitle(data);
});
}
private initForm() {
@@ -139,7 +149,7 @@ export class NewTunnelFlightComponent implements OnInit {
public resetTunnel() {
this.selectedTunnel = undefined;
this.onChangeTunnel('');
this.onChangeTunnel("");
}
public onChangeTunnel(event: any) {

View File

@@ -1,9 +1,10 @@
import { Component, OnInit, ViewChild } from "@angular/core";
import { MatTableDataSource } from "@angular/material/table";
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 { 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 { StatsService } from "../../services/stats.service";
@@ -19,7 +20,7 @@ import {
selector: "app-summary",
templateUrl: "./summary.component.html",
styleUrls: ["./summary.component.css"],
standalone: false,
imports: [MatTabsModule, TranslateModule],
})
export class SummaryComponent implements OnInit {
public dsNbJumpByDz: MatTableDataSource<StatsByDzResp>;
@@ -39,7 +40,7 @@ export class SummaryComponent implements OnInit {
];
public barChartLegend = true;
public barChartPlugins = [];
public barChartPlugins: any = [];
public barChartData: ChartData<"line">;
public barChartOptions: ChartConfiguration["options"];
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) => {
const color = this.jumpTypeToColor.get(key);
let tmp = {

View File

@@ -40,7 +40,9 @@
</mat-form-field>
</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>
</fieldset>

View File

@@ -1,13 +1,21 @@
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { AuthenticationService } from '../../services/authentication.service';
import { User } from '../../models/user';
import { Component, OnInit } from "@angular/core";
import { FormGroup, FormControl, Validators } from "@angular/forms";
import { AuthenticationService } from "../../services/authentication.service";
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({
selector: 'app-user-profile',
templateUrl: './user-profile.component.html',
styleUrls: ['./user-profile.component.css'],
standalone: false
selector: "app-user-profile",
templateUrl: "./user-profile.component.html",
styleUrls: ["./user-profile.component.css"],
imports: [
ListOfImagesComponent,
MatLabel,
MatFormFieldModule,
TranslateModule,
],
})
export class UserProfileComponent implements OnInit {
public userForm: FormGroup;
@@ -33,15 +41,15 @@ export class UserProfileComponent implements OnInit {
Validators.email,
]),
currentPassword: new FormControl(
'',
Validators.pattern('^[A-Za-z0-9_-]{8,15}$')
"",
Validators.pattern("^[A-Za-z0-9_-]{8,15}$")
),
newPassword: new FormControl(
'',
Validators.pattern('^[A-Za-z0-9_-]{8,15}$')
"",
Validators.pattern("^[A-Za-z0-9_-]{8,15}$")
),
},
{ updateOn: 'blur' }
{ updateOn: "blur" }
);
}