fix
This commit is contained in:
@@ -12,8 +12,6 @@ import { JumpTypeService } from "../../services/jump-type.service";
|
|||||||
import { GearService } from "../../services/gear.service";
|
import { GearService } from "../../services/gear.service";
|
||||||
import { isNumber } from "util";
|
import { isNumber } from "util";
|
||||||
|
|
||||||
import { FormControl } from "@angular/forms";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-new-jump",
|
selector: "app-new-jump",
|
||||||
templateUrl: "./new-jump.component.html",
|
templateUrl: "./new-jump.component.html",
|
||||||
@@ -54,7 +52,7 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.beginDate = this.dateService.AddDays(new Date(), -1);
|
this.beginDate = this.dateService.AddDays(new Date(), -1);
|
||||||
|
|
||||||
this.exitAltitude = 4000;
|
this.exitAltitude = 4000;
|
||||||
this.deployAltitude = 1500;
|
this.deployAltitude = 1000;
|
||||||
this.countOfJumps = 1;
|
this.countOfJumps = 1;
|
||||||
|
|
||||||
this.getListOfJumpTypes();
|
this.getListOfJumpTypes();
|
||||||
@@ -73,6 +71,8 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.deployAltitude,
|
this.deployAltitude,
|
||||||
this.countOfJumps
|
this.countOfJumps
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.initForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public isValidatedForm(): boolean {
|
public isValidatedForm(): boolean {
|
||||||
@@ -128,6 +128,20 @@ export class NewJumpComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private initForm() {
|
||||||
|
this.endDate = new Date();
|
||||||
|
this.beginDate = this.dateService.AddDays(new Date(), -1);
|
||||||
|
|
||||||
|
this.exitAltitude = 4000;
|
||||||
|
this.deployAltitude = 1000;
|
||||||
|
this.countOfJumps = 1;
|
||||||
|
|
||||||
|
this.selectedDz = undefined;
|
||||||
|
this.selectedGear = undefined;
|
||||||
|
this.selectedAircraft = undefined;
|
||||||
|
this.selectedJumpType = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
public displayFn(data?: JumpTypeResp): string | undefined {
|
public displayFn(data?: JumpTypeResp): string | undefined {
|
||||||
return data ? data.name : undefined;
|
return data ? data.name : undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from "rxjs";
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from "rxjs/operators";
|
||||||
|
|
||||||
import { JumpResp, JumpReq } from '../models/jump';
|
import { JumpResp, JumpReq } from "../models/jump";
|
||||||
|
|
||||||
import { DateService } from './date.service';
|
|
||||||
import { BaseService } from './base.service';
|
|
||||||
|
|
||||||
|
import { DateService } from "./date.service";
|
||||||
|
import { BaseService } from "./base.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JumpService extends BaseService {
|
export class JumpService extends BaseService {
|
||||||
@@ -16,12 +15,13 @@ export class JumpService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getListOfJumps(): Observable<Array<JumpResp>> {
|
public getListOfJumps(): Observable<Array<JumpResp>> {
|
||||||
return this.http.get<Array<JumpResp>>(`${this.apiUrl}/Jump`, {
|
return this.http
|
||||||
headers: this.headers
|
.get<Array<JumpResp>>(`${this.apiUrl}/Jump`, {
|
||||||
})
|
headers: this.headers,
|
||||||
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(response => {
|
map((response) => {
|
||||||
const details = response.map(data => new JumpResp(data));
|
const details = response.map((data) => new JumpResp(data));
|
||||||
return details;
|
return details;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -60,6 +60,7 @@ export class JumpService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const restfJumps = countOfJumps - countOfJumpsPerDay * (diffInDays - 1);
|
const restfJumps = countOfJumps - countOfJumpsPerDay * (diffInDays - 1);
|
||||||
|
|
||||||
this.AddJumps(
|
this.AddJumps(
|
||||||
selectedJumpType,
|
selectedJumpType,
|
||||||
selectedAircraft,
|
selectedAircraft,
|
||||||
@@ -93,16 +94,14 @@ export class JumpService extends BaseService {
|
|||||||
exitAltitude: defaultExitAltitude,
|
exitAltitude: defaultExitAltitude,
|
||||||
deployAltitude: defaultDeployAltitude,
|
deployAltitude: defaultDeployAltitude,
|
||||||
gearId: selectedRig,
|
gearId: selectedRig,
|
||||||
notes: '',
|
notes: "",
|
||||||
id: 0,
|
id: 0,
|
||||||
jumpDate: jumpDate
|
jumpDate: jumpDate,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.http
|
this.http.post(`${this.apiUrl}/Jump`, bodyNewjump, {
|
||||||
.post(`${this.apiUrl}/Jump`, bodyNewjump, {
|
headers: this.headers,
|
||||||
headers: this.headers
|
});
|
||||||
})
|
|
||||||
.subscribe(data => console.log(data));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user