Little test with AI + Add the equipment #8
@@ -90,19 +90,6 @@
|
|||||||
/>
|
/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
|
||||||
<mat-form-field>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
matInput
|
|
||||||
placeholder="equipment"
|
|
||||||
name="equipment"
|
|
||||||
[(ngModel)]="gear.equipment"
|
|
||||||
name="equipment"
|
|
||||||
type="text"
|
|
||||||
/>
|
|
||||||
</mat-form-field>
|
|
||||||
</p>
|
|
||||||
<br />
|
<br />
|
||||||
@if (editMode) {
|
@if (editMode) {
|
||||||
<button mat-raised-button color="accent">Update</button>
|
<button mat-raised-button color="accent">Update</button>
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ export class GearInfosComponent implements OnInit {
|
|||||||
this.gear.aad,
|
this.gear.aad,
|
||||||
this.gear.mainCanopy,
|
this.gear.mainCanopy,
|
||||||
this.gear.reserveCanopy,
|
this.gear.reserveCanopy,
|
||||||
this.gear.equipment,
|
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.serviceComm.refreshData(AddAction.Gear);
|
this.serviceComm.refreshData(AddAction.Gear);
|
||||||
|
|||||||
@@ -28,7 +28,19 @@
|
|||||||
type="text"
|
type="text"
|
||||||
></textarea>
|
></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<p>
|
||||||
|
<mat-form-field>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
matInput
|
||||||
|
placeholder="equipment"
|
||||||
|
name="equipment"
|
||||||
|
[(ngModel)]="jump.equipment"
|
||||||
|
name="equipment"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
</p>
|
||||||
<br />
|
<br />
|
||||||
@if (editMode) {
|
@if (editMode) {
|
||||||
<button mat-raised-button color="accent">Update</button>
|
<button mat-raised-button color="accent">Update</button>
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export class JumpInfosComponent implements OnInit {
|
|||||||
this.jump.isSpecial,
|
this.jump.isSpecial,
|
||||||
this.jump.withCutaway,
|
this.jump.withCutaway,
|
||||||
this.jump.notes,
|
this.jump.notes,
|
||||||
|
this.jump.equipment,
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.serviceComm.refreshData(AddAction.Jump);
|
this.serviceComm.refreshData(AddAction.Jump);
|
||||||
|
|||||||
@@ -42,12 +42,6 @@
|
|||||||
<input matInput type="text" formControlName="reserveCanopy" />
|
<input matInput type="text" formControlName="reserveCanopy" />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
|
||||||
<mat-form-field>
|
|
||||||
<mat-label>Equipment</mat-label>
|
|
||||||
<input matInput type="text" formControlName="equipment" />
|
|
||||||
</mat-form-field>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<button mat-raised-button color="accent" type="submit">Add</button>
|
<button mat-raised-button color="accent" type="submit">Add</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -60,11 +60,6 @@ export class NewGearComponent implements OnInit {
|
|||||||
Validators.min(60),
|
Validators.min(60),
|
||||||
Validators.max(320),
|
Validators.max(320),
|
||||||
]),
|
]),
|
||||||
equipment: new FormControl("RAS", [
|
|
||||||
Validators.required,
|
|
||||||
Validators.min(60),
|
|
||||||
Validators.max(320),
|
|
||||||
]),
|
|
||||||
},
|
},
|
||||||
{ updateOn: "blur" },
|
{ updateOn: "blur" },
|
||||||
);
|
);
|
||||||
@@ -90,7 +85,6 @@ export class NewGearComponent implements OnInit {
|
|||||||
formData.aad,
|
formData.aad,
|
||||||
formData.mainCanopy,
|
formData.mainCanopy,
|
||||||
formData.reserveCanopy,
|
formData.reserveCanopy,
|
||||||
formData.equipment,
|
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.serviceComm.refreshData(AddAction.Gear);
|
this.serviceComm.refreshData(AddAction.Gear);
|
||||||
|
|||||||
@@ -137,8 +137,7 @@
|
|||||||
>
|
>
|
||||||
@for (gear of listOfGear; track gear) {
|
@for (gear of listOfGear; track gear) {
|
||||||
<mat-option [value]="gear">
|
<mat-option [value]="gear">
|
||||||
{{ gear.name }} ({{ gear.mainCanopy }} -
|
{{ gear.name }} ({{ gear.mainCanopy }})
|
||||||
{{ gear.equipment }})
|
|
||||||
</mat-option>
|
</mat-option>
|
||||||
}
|
}
|
||||||
</mat-autocomplete>
|
</mat-autocomplete>
|
||||||
@@ -153,6 +152,25 @@
|
|||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
placeholder="{{ 'NewJump_Equipment' | translate }}"
|
||||||
|
[(ngModel)]="equipment"
|
||||||
|
name="equipment"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
@if (exitAltitude) {
|
||||||
|
<button
|
||||||
|
matSuffix
|
||||||
|
mat-icon-button
|
||||||
|
aria-label="Clear"
|
||||||
|
(click)="equipment = undefined"
|
||||||
|
>
|
||||||
|
<mat-icon svgIcon="close"></mat-icon>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</mat-form-field>
|
||||||
<mat-checkbox [(ngModel)]="withCutaway" name="withCutaway">{{
|
<mat-checkbox [(ngModel)]="withCutaway" name="withCutaway">{{
|
||||||
"NewJump_Cutaway" | translate
|
"NewJump_Cutaway" | translate
|
||||||
}}</mat-checkbox>
|
}}</mat-checkbox>
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ export class NewJumpComponent implements OnInit {
|
|||||||
private pendingAddRequest: boolean;
|
private pendingAddRequest: boolean;
|
||||||
private listOfDropZone: Array<DropZoneResp>;
|
private listOfDropZone: Array<DropZoneResp>;
|
||||||
public maxDate: Date;
|
public maxDate: Date;
|
||||||
|
public equipment: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
@@ -142,10 +143,12 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.countOfJumps,
|
this.countOfJumps,
|
||||||
this.comments,
|
this.comments,
|
||||||
this.isSpecial === undefined ? false : this.isSpecial,
|
this.isSpecial === undefined ? false : this.isSpecial,
|
||||||
|
this.equipment,
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.statsService.resetStats();
|
this.statsService.resetStats();
|
||||||
this.comments = undefined;
|
this.comments = undefined;
|
||||||
|
this.equipment = undefined;
|
||||||
this.withCutaway = false;
|
this.withCutaway = false;
|
||||||
this.isSpecial = false;
|
this.isSpecial = false;
|
||||||
|
|
||||||
@@ -233,6 +236,7 @@ export class NewJumpComponent implements OnInit {
|
|||||||
|
|
||||||
this.listOfFilteredDropZone = this.listOfDropZone;
|
this.listOfFilteredDropZone = this.listOfDropZone;
|
||||||
this.comments = undefined;
|
this.comments = undefined;
|
||||||
|
this.equipment = undefined;
|
||||||
|
|
||||||
this.withCutaway = false;
|
this.withCutaway = false;
|
||||||
this.isSpecial = false;
|
this.isSpecial = false;
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ export class SummaryComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public refreshStats() {
|
public refreshStats() {
|
||||||
|
this.serviceApi.resetStats();
|
||||||
this.serviceApi.deleteAllCache();
|
this.serviceApi.deleteAllCache();
|
||||||
this.tabGroup.selectedIndex = 0;
|
this.tabGroup.selectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,6 @@
|
|||||||
"ListGears_Header_Aad": "AAD system",
|
"ListGears_Header_Aad": "AAD system",
|
||||||
"ListGears_Header_Main": "Main canopy",
|
"ListGears_Header_Main": "Main canopy",
|
||||||
"ListGears_Header_Reserve": "Reserve canopy",
|
"ListGears_Header_Reserve": "Reserve canopy",
|
||||||
"ListGears_Header_Equipment": "Equipment",
|
|
||||||
|
|
||||||
"ListJumpType_Add": "Add a jump type",
|
"ListJumpType_Add": "Add a jump type",
|
||||||
"ListJumpType_Header_Id": "ID",
|
"ListJumpType_Header_Id": "ID",
|
||||||
@@ -121,6 +120,7 @@
|
|||||||
"NewJump_Count": "Count of jumps",
|
"NewJump_Count": "Count of jumps",
|
||||||
"NewJump_Comments": "Comments",
|
"NewJump_Comments": "Comments",
|
||||||
"NewJump_Submit": "Submit",
|
"NewJump_Submit": "Submit",
|
||||||
|
"NewJump_Equipment": "Equipment",
|
||||||
|
|
||||||
"NewTunnelFlight_ChooseTunnel": "Choose the tunnel",
|
"NewTunnelFlight_ChooseTunnel": "Choose the tunnel",
|
||||||
"NewTunnelFlight_Minutes": "Minutes of the flight",
|
"NewTunnelFlight_Minutes": "Minutes of the flight",
|
||||||
|
|||||||
@@ -69,7 +69,6 @@
|
|||||||
"ListGears_Header_Aad": "Système de sécurité",
|
"ListGears_Header_Aad": "Système de sécurité",
|
||||||
"ListGears_Header_Main": "Principale",
|
"ListGears_Header_Main": "Principale",
|
||||||
"ListGears_Header_Reserve": "Réserve",
|
"ListGears_Header_Reserve": "Réserve",
|
||||||
"ListGears_Header_Equipment": "Équipment",
|
|
||||||
|
|
||||||
"ListJumpType_Add": "Ajouter un type de saut",
|
"ListJumpType_Add": "Ajouter un type de saut",
|
||||||
"ListJumpType_Header_Id": "ID",
|
"ListJumpType_Header_Id": "ID",
|
||||||
@@ -121,6 +120,7 @@
|
|||||||
"NewJump_Count": "Nombre de sauts",
|
"NewJump_Count": "Nombre de sauts",
|
||||||
"NewJump_Comments": "Commentaires",
|
"NewJump_Comments": "Commentaires",
|
||||||
"NewJump_Submit": "Ajouter",
|
"NewJump_Submit": "Ajouter",
|
||||||
|
"NewJump_Equipment": "Équipment",
|
||||||
|
|
||||||
"NewTunnelFlight_ChooseTunnel": "Choisir le tunnel",
|
"NewTunnelFlight_ChooseTunnel": "Choisir le tunnel",
|
||||||
"NewTunnelFlight_Minutes": "Temps de vol(minutes)",
|
"NewTunnelFlight_Minutes": "Temps de vol(minutes)",
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ export class GearReq {
|
|||||||
public aad: string;
|
public aad: string;
|
||||||
public mainCanopy: string;
|
public mainCanopy: string;
|
||||||
public reserveCanopy: string;
|
public reserveCanopy: string;
|
||||||
public equipment: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GearResp {
|
export class GearResp {
|
||||||
@@ -27,5 +26,4 @@ export class GearResp {
|
|||||||
public aad: string;
|
public aad: string;
|
||||||
public mainCanopy: string;
|
public mainCanopy: string;
|
||||||
public reserveCanopy: string;
|
public reserveCanopy: string;
|
||||||
public equipment: string;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { GearResp } from './gear';
|
import { GearResp } from "./gear";
|
||||||
import { DropZoneResp } from './dropzone';
|
import { DropZoneResp } from "./dropzone";
|
||||||
import { AircraftResp } from './aircraft';
|
import { AircraftResp } from "./aircraft";
|
||||||
import { JumpTypeResp } from './jumpType';
|
import { JumpTypeResp } from "./jumpType";
|
||||||
|
|
||||||
export class JumpReq {
|
export class JumpReq {
|
||||||
constructor(data: any) {
|
constructor(data: any) {
|
||||||
@@ -19,6 +19,7 @@ export class JumpReq {
|
|||||||
public notes: string;
|
public notes: string;
|
||||||
public jumpDate: string;
|
public jumpDate: string;
|
||||||
public isSpecial: boolean;
|
public isSpecial: boolean;
|
||||||
|
public equipment: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class JumpResp {
|
export class JumpResp {
|
||||||
@@ -44,6 +45,7 @@ export class JumpResp {
|
|||||||
public notes: string;
|
public notes: string;
|
||||||
public jumpDate: Date;
|
public jumpDate: Date;
|
||||||
public isSpecial: boolean;
|
public isSpecial: boolean;
|
||||||
|
public equipment: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Jump {
|
export class Jump {
|
||||||
@@ -63,4 +65,5 @@ export class Jump {
|
|||||||
public notes: string;
|
public notes: string;
|
||||||
public jumpDate: Date;
|
public jumpDate: Date;
|
||||||
public isSpecial: boolean;
|
public isSpecial: boolean;
|
||||||
|
public equipment: string;
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,6 @@ export class GearService extends BaseService {
|
|||||||
aad: string,
|
aad: string,
|
||||||
mainCanopy: string,
|
mainCanopy: string,
|
||||||
reserveCanopy: string,
|
reserveCanopy: string,
|
||||||
equipment: string,
|
|
||||||
) {
|
) {
|
||||||
const bodyNewGear: GearReq = {
|
const bodyNewGear: GearReq = {
|
||||||
id: 0,
|
id: 0,
|
||||||
@@ -43,7 +42,6 @@ export class GearService extends BaseService {
|
|||||||
aad: aad,
|
aad: aad,
|
||||||
mainCanopy: mainCanopy,
|
mainCanopy: mainCanopy,
|
||||||
reserveCanopy: reserveCanopy,
|
reserveCanopy: reserveCanopy,
|
||||||
equipment: equipment,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.serviceCacheApi.delete(CacheApiKey.Gear);
|
this.serviceCacheApi.delete(CacheApiKey.Gear);
|
||||||
@@ -75,7 +73,6 @@ export class GearService extends BaseService {
|
|||||||
aad: string,
|
aad: string,
|
||||||
mainCanopy: string,
|
mainCanopy: string,
|
||||||
reserveCanopy: string,
|
reserveCanopy: string,
|
||||||
equipment: string,
|
|
||||||
) {
|
) {
|
||||||
const gearData = {
|
const gearData = {
|
||||||
id: id,
|
id: id,
|
||||||
@@ -86,10 +83,10 @@ export class GearService extends BaseService {
|
|||||||
aad: aad,
|
aad: aad,
|
||||||
mainCanopy: mainCanopy,
|
mainCanopy: mainCanopy,
|
||||||
reserveCanopy: reserveCanopy,
|
reserveCanopy: reserveCanopy,
|
||||||
equipment: equipment,
|
|
||||||
};
|
};
|
||||||
const bodyUpdatedGear = new GearReq(gearData);
|
const bodyUpdatedGear = new GearReq(gearData);
|
||||||
|
|
||||||
|
this.serviceCacheApi.delete(CacheApiKey.Gear);
|
||||||
return this.http.put(`${this.apiUrl}/Gear/${id}`, bodyUpdatedGear, {
|
return this.http.put(`${this.apiUrl}/Gear/${id}`, bodyUpdatedGear, {
|
||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from "@angular/common";
|
||||||
import { forkJoin, Observable } from "rxjs";
|
import { forkJoin, Observable } from "rxjs";
|
||||||
import { map } from "rxjs/operators";
|
import { map } from "rxjs/operators";
|
||||||
|
|
||||||
@@ -22,39 +22,56 @@ import { GearService } from "./gear.service";
|
|||||||
export class JumpService extends BaseService {
|
export class JumpService extends BaseService {
|
||||||
private callsToAdd: Array<Observable<any>>;
|
private callsToAdd: Array<Observable<any>>;
|
||||||
|
|
||||||
constructor(private http: HttpClient,
|
constructor(
|
||||||
|
private http: HttpClient,
|
||||||
private dateService: DateService,
|
private dateService: DateService,
|
||||||
private datePipe: DatePipe,
|
private datePipe: DatePipe,
|
||||||
private dropzoneService: DropzoneService,
|
private dropzoneService: DropzoneService,
|
||||||
private aircraftService: AircraftService,
|
private aircraftService: AircraftService,
|
||||||
private jumpTypeService: JumpTypeService,
|
private jumpTypeService: JumpTypeService,
|
||||||
private gearService: GearService) {
|
private gearService: GearService,
|
||||||
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getListOfJumps(): Observable<Array<Jump>> {
|
public getListOfJumps(): Observable<Array<Jump>> {
|
||||||
return this.http.get<Array<JumpResp>>(`${this.apiUrl}/Jump`, { headers: this.headers })
|
return this.http
|
||||||
.pipe(map((response) => {
|
.get<
|
||||||
|
Array<JumpResp>
|
||||||
|
>(`${this.apiUrl}/Jump`, { headers: this.headers })
|
||||||
|
.pipe(
|
||||||
|
map((response) => {
|
||||||
return this.mapWithDataInCache(response);
|
return this.mapWithDataInCache(response);
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getJumps(beginIndex: number, endIndex: number): Observable<JumpList> {
|
public getJumps(
|
||||||
return this.http.get<JumpListResp>(`${this.apiUrl}/Jump/${beginIndex}/${endIndex}`, { headers: this.headers })
|
beginIndex: number,
|
||||||
.pipe(map(response => {
|
endIndex: number,
|
||||||
|
): Observable<JumpList> {
|
||||||
|
return this.http
|
||||||
|
.get<JumpListResp>(
|
||||||
|
`${this.apiUrl}/Jump/${beginIndex}/${endIndex}`,
|
||||||
|
{ headers: this.headers },
|
||||||
|
)
|
||||||
|
.pipe(
|
||||||
|
map((response) => {
|
||||||
let result: JumpList = {
|
let result: JumpList = {
|
||||||
rows: this.mapWithDataInCache(response.rows),
|
rows: this.mapWithDataInCache(response.rows),
|
||||||
count: response.count
|
count: response.count,
|
||||||
};
|
};
|
||||||
|
|
||||||
return new JumpList(result);
|
return new JumpList(result);
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public addListOfJump(selectedJumpType: number,
|
public addListOfJump(
|
||||||
|
selectedJumpType: number,
|
||||||
selectedAircraft: number,
|
selectedAircraft: number,
|
||||||
selectedDz: number,
|
selectedDz: number,
|
||||||
selectedRig: number,
|
selectedGear: number,
|
||||||
withCutaway: boolean,
|
withCutaway: boolean,
|
||||||
beginDate: Date,
|
beginDate: Date,
|
||||||
endDate: Date,
|
endDate: Date,
|
||||||
@@ -62,76 +79,94 @@ export class JumpService extends BaseService {
|
|||||||
defaultDeployAltitude: number,
|
defaultDeployAltitude: number,
|
||||||
countOfJumps: number,
|
countOfJumps: number,
|
||||||
notes: string,
|
notes: string,
|
||||||
isSpecial: boolean): Observable<any[]> {
|
isSpecial: boolean,
|
||||||
|
equipment: string,
|
||||||
|
): Observable<any[]> {
|
||||||
this.callsToAdd = new Array<Observable<any>>();
|
this.callsToAdd = new Array<Observable<any>>();
|
||||||
const diffInDays = this.dateService.diffBetweenDates(beginDate, endDate) + 1;
|
const diffInDays =
|
||||||
|
this.dateService.diffBetweenDates(beginDate, endDate) + 1;
|
||||||
const countOfJumpsPerDay = Math.trunc(countOfJumps / diffInDays);
|
const countOfJumpsPerDay = Math.trunc(countOfJumps / diffInDays);
|
||||||
|
|
||||||
for (let i = 1; beginDate.getTime() < endDate.getTime(); i++) {
|
for (let i = 1; beginDate.getTime() < endDate.getTime(); i++) {
|
||||||
this.addJumps(selectedJumpType,
|
this.addJumps(
|
||||||
|
selectedJumpType,
|
||||||
selectedAircraft,
|
selectedAircraft,
|
||||||
selectedDz,
|
selectedDz,
|
||||||
selectedRig,
|
selectedGear,
|
||||||
withCutaway,
|
withCutaway,
|
||||||
beginDate,
|
beginDate,
|
||||||
defaultExitAltitude,
|
defaultExitAltitude,
|
||||||
defaultDeployAltitude,
|
defaultDeployAltitude,
|
||||||
countOfJumpsPerDay,
|
countOfJumpsPerDay,
|
||||||
notes,
|
notes,
|
||||||
isSpecial);
|
isSpecial,
|
||||||
|
equipment,
|
||||||
|
);
|
||||||
|
|
||||||
beginDate = this.dateService.addDays(beginDate, 1);
|
beginDate = this.dateService.addDays(beginDate, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const restfJumps = countOfJumps - countOfJumpsPerDay * (diffInDays - 1);
|
const restfJumps = countOfJumps - countOfJumpsPerDay * (diffInDays - 1);
|
||||||
|
|
||||||
this.addJumps(selectedJumpType,
|
this.addJumps(
|
||||||
|
selectedJumpType,
|
||||||
selectedAircraft,
|
selectedAircraft,
|
||||||
selectedDz,
|
selectedDz,
|
||||||
selectedRig,
|
selectedGear,
|
||||||
withCutaway,
|
withCutaway,
|
||||||
beginDate,
|
beginDate,
|
||||||
defaultExitAltitude,
|
defaultExitAltitude,
|
||||||
defaultDeployAltitude,
|
defaultDeployAltitude,
|
||||||
restfJumps,
|
restfJumps,
|
||||||
notes,
|
notes,
|
||||||
isSpecial);
|
isSpecial,
|
||||||
|
equipment,
|
||||||
|
);
|
||||||
|
|
||||||
return forkJoin(this.callsToAdd);
|
return forkJoin(this.callsToAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteJump(item: Jump) {
|
public deleteJump(item: Jump) {
|
||||||
this.http.delete(`${this.apiUrl}/Jump/${item.id}`, { headers: this.headers }).subscribe();
|
this.http
|
||||||
|
.delete(`${this.apiUrl}/Jump/${item.id}`, { headers: this.headers })
|
||||||
|
.subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateJump(id: number,
|
public updateJump(
|
||||||
|
id: number,
|
||||||
isSpecial: boolean,
|
isSpecial: boolean,
|
||||||
withCutaway: boolean,
|
withCutaway: boolean,
|
||||||
notes: string) {
|
notes: string,
|
||||||
|
equipment: string,
|
||||||
|
) {
|
||||||
const jumpData = {
|
const jumpData = {
|
||||||
id: id,
|
id: id,
|
||||||
isSpecial: isSpecial,
|
isSpecial: isSpecial,
|
||||||
withCutaway: withCutaway,
|
withCutaway: withCutaway,
|
||||||
notes: notes
|
notes: notes,
|
||||||
|
equipment: equipment,
|
||||||
};
|
};
|
||||||
const bodyUpdatedJump = new JumpReq(jumpData);
|
const bodyUpdatedJump = new JumpReq(jumpData);
|
||||||
|
|
||||||
return this.http.put(`${this.apiUrl}/Jump/${id}`,
|
return this.http.put(`${this.apiUrl}/Jump/${id}`, bodyUpdatedJump, {
|
||||||
bodyUpdatedJump,
|
headers: this.headers,
|
||||||
{ headers: this.headers, });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private addJumps(selectedJumpType: number,
|
private addJumps(
|
||||||
|
selectedJumpType: number,
|
||||||
selectedAircraft: number,
|
selectedAircraft: number,
|
||||||
selectedDz: number,
|
selectedDz: number,
|
||||||
selectedRig: number,
|
selectedGear: number,
|
||||||
withCutaway: boolean,
|
withCutaway: boolean,
|
||||||
jumpDate: Date,
|
jumpDate: Date,
|
||||||
defaultExitAltitude: number,
|
defaultExitAltitude: number,
|
||||||
defaultDeployAltitude: number,
|
defaultDeployAltitude: number,
|
||||||
countOfJumps: number,
|
countOfJumps: number,
|
||||||
notes: string,
|
notes: string,
|
||||||
isSpecial: boolean) {
|
isSpecial: boolean,
|
||||||
|
equipment: string,
|
||||||
|
) {
|
||||||
for (let i = 0; i < countOfJumps; i++) {
|
for (let i = 0; i < countOfJumps; i++) {
|
||||||
const bodyNewjump: JumpReq = {
|
const bodyNewjump: JumpReq = {
|
||||||
jumpTypeId: selectedJumpType,
|
jumpTypeId: selectedJumpType,
|
||||||
@@ -140,14 +175,17 @@ export class JumpService extends BaseService {
|
|||||||
withCutaway: withCutaway,
|
withCutaway: withCutaway,
|
||||||
exitAltitude: defaultExitAltitude,
|
exitAltitude: defaultExitAltitude,
|
||||||
deployAltitude: defaultDeployAltitude,
|
deployAltitude: defaultDeployAltitude,
|
||||||
gearId: selectedRig,
|
gearId: selectedGear,
|
||||||
notes: notes,
|
notes: notes,
|
||||||
id: 0,
|
id: 0,
|
||||||
jumpDate: this.datePipe.transform(jumpDate, "yyyy-MM-dd"),
|
jumpDate: this.datePipe.transform(jumpDate, "yyyy-MM-dd"),
|
||||||
isSpecial: isSpecial
|
isSpecial: isSpecial,
|
||||||
|
equipment: equipment,
|
||||||
};
|
};
|
||||||
|
|
||||||
let call = this.http.post(`${this.apiUrl}/Jump`, bodyNewjump, { headers: this.headers });
|
let call = this.http.post(`${this.apiUrl}/Jump`, bodyNewjump, {
|
||||||
|
headers: this.headers,
|
||||||
|
});
|
||||||
|
|
||||||
this.callsToAdd.push(call);
|
this.callsToAdd.push(call);
|
||||||
}
|
}
|
||||||
@@ -155,21 +193,29 @@ export class JumpService extends BaseService {
|
|||||||
|
|
||||||
private mapWithDataInCache(apiResp: Array<JumpResp>): Array<Jump> {
|
private mapWithDataInCache(apiResp: Array<JumpResp>): Array<Jump> {
|
||||||
let allDropzones: Array<DropZoneResp>;
|
let allDropzones: Array<DropZoneResp>;
|
||||||
this.dropzoneService.getFromCache().subscribe(data => { allDropzones = data; });
|
this.dropzoneService.getFromCache().subscribe((data) => {
|
||||||
|
allDropzones = data;
|
||||||
|
});
|
||||||
let allAircrafts: Array<AircraftResp>;
|
let allAircrafts: Array<AircraftResp>;
|
||||||
this.aircraftService.getFromCache().subscribe(data => { allAircrafts = data; });
|
this.aircraftService.getFromCache().subscribe((data) => {
|
||||||
|
allAircrafts = data;
|
||||||
|
});
|
||||||
let allJumpType: Array<JumpTypeResp>;
|
let allJumpType: Array<JumpTypeResp>;
|
||||||
this.jumpTypeService.getFromCache().subscribe(data => { allJumpType = data; });
|
this.jumpTypeService.getFromCache().subscribe((data) => {
|
||||||
|
allJumpType = data;
|
||||||
|
});
|
||||||
let allGears: Array<GearResp>;
|
let allGears: Array<GearResp>;
|
||||||
this.gearService.getFromCache().subscribe(data => { allGears = data; });
|
this.gearService.getFromCache().subscribe((data) => {
|
||||||
|
allGears = data;
|
||||||
|
});
|
||||||
|
|
||||||
return apiResp.map((data) => {
|
return apiResp.map((data) => {
|
||||||
let tmp = new Jump(data);
|
let tmp = new Jump(data);
|
||||||
|
|
||||||
tmp.dropZone = allDropzones.find(d => d.id == data.dropZoneId);
|
tmp.dropZone = allDropzones.find((d) => d.id == data.dropZoneId);
|
||||||
tmp.aircraft = allAircrafts.find(d => d.id == data.aircraftId);
|
tmp.aircraft = allAircrafts.find((d) => d.id == data.aircraftId);
|
||||||
tmp.jumpType = allJumpType.find(d => d.id == data.jumpTypeId);
|
tmp.jumpType = allJumpType.find((d) => d.id == data.jumpTypeId);
|
||||||
tmp.gear = allGears.find(d => d.id == data.gearId);
|
tmp.gear = allGears.find((d) => d.id == data.gearId);
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user