This commit is contained in:
Sébastien André
2021-03-29 09:36:37 +02:00
parent 201a563fbc
commit b2941cf6d4
6 changed files with 25 additions and 33 deletions

View File

@@ -14,10 +14,8 @@ export class NewAircraftComponent implements OnInit {
public imageError: string; public imageError: string;
private selectedFile: string; private selectedFile: string;
constructor( constructor(private serviceComm: ServiceComm,
private serviceComm: ServiceComm, private serviceApi: AircraftService) {
private serviceApi: AircraftService
) {
this.addForm = new FormGroup( this.addForm = new FormGroup(
{ {
aircraftName: new FormControl('', Validators.required) aircraftName: new FormControl('', Validators.required)
@@ -38,9 +36,7 @@ export class NewAircraftComponent implements OnInit {
} }
public onFileChanged(fileInput: any) { public onFileChanged(fileInput: any) {
const file = fileInput.dataTransfer const file = fileInput.dataTransfer ? fileInput.dataTransfer.files[0] : fileInput.target.files[0];
? 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; const max_size = 20971520;

View File

@@ -50,14 +50,13 @@ export class NewGearComponent implements OnInit {
ngOnInit() {} ngOnInit() {}
onSubmit(formData) { onSubmit(formData) {
this.serviceApi.AddGear( this.serviceApi.AddGear(formData.name,
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
); );
this.serviceComm.RefreshData(AddAction.Gear); this.serviceComm.RefreshData(AddAction.Gear);
} }

View File

@@ -12,10 +12,8 @@ import { JumpTypeService } from "../../services/jump-type.service";
export class NewJumpTypeComponent implements OnInit { export class NewJumpTypeComponent implements OnInit {
public addForm: FormGroup; public addForm: FormGroup;
constructor( constructor(private serviceComm: ServiceComm,
private serviceComm: ServiceComm, private jumpTypeService: JumpTypeService) {
private jumpTypeService: JumpTypeService
) {
this.addForm = new FormGroup( this.addForm = new FormGroup(
{ {
jumptypeName: new FormControl("", Validators.required) jumptypeName: new FormControl("", Validators.required)

View File

@@ -24,6 +24,7 @@ export class DropzoneService extends BaseService {
public SetFavoriteDropZone(selectedDz: DropZoneResp): boolean { public SetFavoriteDropZone(selectedDz: DropZoneResp): boolean {
selectedDz.isFavorite = true; selectedDz.isFavorite = true;
this.http.put(`${this.apiUrl}/DropZone/AddToFavorite/${selectedDz.id}`, this.http.put(`${this.apiUrl}/DropZone/AddToFavorite/${selectedDz.id}`,
selectedDz, selectedDz,
{ headers: this.headers }) { headers: this.headers })
@@ -34,6 +35,7 @@ export class DropzoneService extends BaseService {
public RemoveFavoriteDropZone(selectedDz: DropZoneResp): boolean { public RemoveFavoriteDropZone(selectedDz: DropZoneResp): boolean {
selectedDz.isFavorite = false; selectedDz.isFavorite = false;
this.http.put(`${this.apiUrl}/DropZone/RemoveToFavorite${selectedDz.id}`, this.http.put(`${this.apiUrl}/DropZone/RemoveToFavorite${selectedDz.id}`,
selectedDz, selectedDz,
{ headers: this.headers }) { headers: this.headers })

View File

@@ -18,15 +18,13 @@ export class GearService extends BaseService {
}); });
} }
public AddGear( public AddGear(name: string,
name: string, manufacturer: string,
manufacturer: string, minSize: number,
minSize: number, maxSize: number,
maxSize: number, aad: string,
aad: string, mainCanopy: string,
mainCanopy: string, reserveCanopy: string) {
reserveCanopy: string
) {
const bodyNewGear: GearReq = { const bodyNewGear: GearReq = {
id: 0, id: 0,
name: name, name: name,

View File

@@ -24,10 +24,9 @@ export class JumpTypeService extends BaseService {
name: jumptypetName name: jumptypetName
}; };
this.http this.http.post(`${this.apiUrl}/JumpType`,
.post(`${this.apiUrl}/JumpType`, bodyJumpType, { bodyJumpType,
headers: this.headers { headers: this.headers })
}) .subscribe(data => console.log(data));
.subscribe(data => console.log(data));
} }
} }