Fix sur les ajouts d'infos
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,3 +14,4 @@
|
||||
/Back/skydiveLogs-api.Ioc/obj
|
||||
/Back/skydiveLogs-api.Data/bin
|
||||
/Back/skydiveLogs-api.Business/bin
|
||||
/Back/dist
|
||||
|
||||
@@ -28,7 +28,8 @@ export class ListOfAircraftsComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe(action => {
|
||||
if (action === AddAction.Gear) {
|
||||
if (action === AddAction.Aircraft) {
|
||||
this.dialog.closeAll();
|
||||
this.getListOfAircrafts();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,8 @@ export class ListOfDzsComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe(action => {
|
||||
if (action === AddAction.Gear) {
|
||||
if (action === AddAction.Dropzone) {
|
||||
this.dialog.closeAll();
|
||||
this.getListOfDropZones();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,6 +37,7 @@ export class ListOfGearsComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe(action => {
|
||||
if (action === AddAction.Gear) {
|
||||
this.dialog.closeAll();
|
||||
this.getListOfGears();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -28,7 +28,8 @@ export class ListOfJumpTypesComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe(action => {
|
||||
if (action === AddAction.Gear) {
|
||||
if (action === AddAction.JumpType) {
|
||||
this.dialog.closeAll();
|
||||
this.getListOfJumpTypes();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,3 +11,9 @@ table {
|
||||
min-width: 200px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.smallSpanWithBreakWord {
|
||||
display: inline-block;
|
||||
min-width: 50px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
@@ -7,21 +7,32 @@
|
||||
|
||||
<ng-container matColumnDef="jumpDate">
|
||||
<th mat-header-cell *matHeaderCellDef>Date</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.jumpDate | date: 'yyyy-MM-dd'}} </td>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span class="smallSpanWithBreakWord" [innerHTML]="element.jumpDate | date: 'yyyy-MM-dd'"></span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="jumpType">
|
||||
<th mat-header-cell *matHeaderCellDef>Jump Type</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.jumpType.name}}</td>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span class="smallSpanWithBreakWord" [innerHTML]="element.jumpType.name"></span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="aircraft">
|
||||
<th mat-header-cell *matHeaderCellDef>Aircraft</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.aircraft.name}}</td>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span class="smallSpanWithBreakWord" [innerHTML]="element.aircraft.name"></span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="dropZone">
|
||||
<th mat-header-cell *matHeaderCellDef>Drop Zone</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.dropZone.name}}</td>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span class="spanWithBreakWord" [innerHTML]="element.dropZone.name"></span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="gear">
|
||||
<th mat-header-cell *matHeaderCellDef>Gear</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.gear.name}}</td>
|
||||
|
||||
@@ -16,18 +16,18 @@ export class NewAircraftComponent implements OnInit {
|
||||
private serviceComm: ServiceComm,
|
||||
private serviceApi: AircraftService
|
||||
) {
|
||||
this.addForm = new FormGroup({
|
||||
aircraftName: new FormControl("", Validators.required)
|
||||
});
|
||||
this.addForm = new FormGroup(
|
||||
{
|
||||
aircraftName: new FormControl("", Validators.required)
|
||||
},
|
||||
{ updateOn: "blur" }
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
onSubmit(formData) {
|
||||
this.serviceApi.AddAircraft(formData.value.aircraftName);
|
||||
this.serviceApi.AddAircraft(formData.aircraftName);
|
||||
this.serviceComm.RefreshData(AddAction.Aircraft);
|
||||
|
||||
this.serviceComm.RefreshData(AddAction.Aircraft);
|
||||
this.addForm.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,12 @@
|
||||
<textarea matInput formControlName="address"></textarea>
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Web site</mat-label>
|
||||
<input matInput type="text" formControlName="website" />
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Mail of contact</mat-label>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Component, OnInit } from "@angular/core";
|
||||
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";
|
||||
|
||||
@Component({
|
||||
selector: "app-new-drop-zone",
|
||||
@@ -11,27 +12,53 @@ import { ServiceComm } from "../../services/service-comm.service";
|
||||
export class NewDropZoneComponent implements OnInit {
|
||||
public addForm: FormGroup;
|
||||
|
||||
constructor(private serviceComm: ServiceComm) {
|
||||
this.addForm = new FormGroup({
|
||||
dzName: new FormControl("", Validators.required),
|
||||
gps: new FormControl("x.x,y.y", [
|
||||
Validators.required,
|
||||
Validators.pattern("d+.d+,d+.d+")
|
||||
]),
|
||||
address: new FormControl("", Validators.required),
|
||||
contactMail: new FormControl("", [Validators.required, Validators.email]),
|
||||
isDz: new FormControl(true),
|
||||
isTunnel: new FormControl(false)
|
||||
});
|
||||
constructor(
|
||||
private serviceComm: ServiceComm,
|
||||
private dropzoneService: DropzoneService
|
||||
) {
|
||||
this.addForm = new FormGroup(
|
||||
{
|
||||
dzName: new FormControl("", Validators.required),
|
||||
gps: new FormControl("x.x,y.y", [
|
||||
Validators.required,
|
||||
Validators.pattern("d+.d+,d+.d+")
|
||||
]),
|
||||
address: new FormControl("", Validators.required),
|
||||
website: new FormControl("", Validators.required),
|
||||
contactMail: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.email
|
||||
]),
|
||||
isDz: new FormControl(true),
|
||||
isTunnel: new FormControl(false)
|
||||
},
|
||||
{ updateOn: "blur" }
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
onSubmit(formData) {
|
||||
console.log(formData.status);
|
||||
console.warn("New data : ", formData);
|
||||
const splitGps: Array<string> = formData.gps.split(",");
|
||||
let dzType: Array<string> = new Array<string>();
|
||||
|
||||
this.serviceComm.RefreshData(AddAction.Gear);
|
||||
this.addForm.reset();
|
||||
if (formData.isDz === true) {
|
||||
dzType.push("dz");
|
||||
}
|
||||
if (formData.isTunnel === true) {
|
||||
dzType.push("tunnel");
|
||||
}
|
||||
|
||||
this.dropzoneService.AddDropZone(
|
||||
splitGps[0],
|
||||
splitGps[1],
|
||||
formData.dzName,
|
||||
formData.address,
|
||||
formData.website,
|
||||
formData.contactMail,
|
||||
dzType,
|
||||
false
|
||||
);
|
||||
this.serviceComm.RefreshData(AddAction.Dropzone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,47 +17,48 @@ export class NewGearComponent implements OnInit {
|
||||
private serviceComm: ServiceComm,
|
||||
private serviceApi: GearService
|
||||
) {
|
||||
this.addForm = new FormGroup({
|
||||
name: new FormControl("", Validators.required),
|
||||
manufacturer: new FormControl("", Validators.required),
|
||||
minSize: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
]),
|
||||
maxSize: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
]),
|
||||
aad: new FormControl("", Validators.required),
|
||||
mainCanopy: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
]),
|
||||
reserveCanopy: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
])
|
||||
});
|
||||
this.addForm = new FormGroup(
|
||||
{
|
||||
name: new FormControl("", Validators.required),
|
||||
manufacturer: new FormControl("", Validators.required),
|
||||
minSize: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
]),
|
||||
maxSize: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
]),
|
||||
aad: new FormControl("", Validators.required),
|
||||
mainCanopy: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
]),
|
||||
reserveCanopy: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320)
|
||||
])
|
||||
},
|
||||
{ updateOn: "blur" }
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
onSubmit(formData) {
|
||||
this.serviceApi.AddGear(
|
||||
formData.value.name,
|
||||
formData.value.manufacturer,
|
||||
formData.value.minSize,
|
||||
formData.value.maxSize,
|
||||
formData.value.aad,
|
||||
formData.value.mainCanopy,
|
||||
formData.value.reserveCanopy
|
||||
formData.name,
|
||||
formData.manufacturer,
|
||||
+formData.minSize,
|
||||
+formData.maxSize,
|
||||
formData.aad,
|
||||
formData.mainCanopy,
|
||||
formData.reserveCanopy
|
||||
);
|
||||
|
||||
this.serviceComm.RefreshData(AddAction.Gear);
|
||||
this.addForm.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Component, OnInit } from "@angular/core";
|
||||
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";
|
||||
|
||||
@Component({
|
||||
selector: "app-new-jump-type",
|
||||
@@ -11,19 +12,22 @@ import { ServiceComm } from "../../services/service-comm.service";
|
||||
export class NewJumpTypeComponent implements OnInit {
|
||||
public addForm: FormGroup;
|
||||
|
||||
constructor(private serviceComm: ServiceComm) {
|
||||
this.addForm = new FormGroup({
|
||||
jumptypeName: new FormControl("", Validators.required)
|
||||
});
|
||||
constructor(
|
||||
private serviceComm: ServiceComm,
|
||||
private jumpTypeService: JumpTypeService
|
||||
) {
|
||||
this.addForm = new FormGroup(
|
||||
{
|
||||
jumptypeName: new FormControl("", Validators.required)
|
||||
},
|
||||
{ updateOn: "blur" }
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
onSubmit(formData) {
|
||||
console.log(formData.status);
|
||||
console.warn("New data : ", formData);
|
||||
|
||||
this.serviceComm.RefreshData(AddAction.Gear);
|
||||
this.addForm.reset();
|
||||
this.jumpTypeService.AddJumpType(formData.jumptypeName);
|
||||
this.serviceComm.RefreshData(AddAction.JumpType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Injectable } from "@angular/core";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
import { AircraftResp, AircraftReq } from '../models/aircraft';
|
||||
|
||||
import { BaseService } from './base.service';
|
||||
import { AircraftResp, AircraftReq } from "../models/aircraft";
|
||||
|
||||
import { BaseService } from "./base.service";
|
||||
|
||||
@Injectable()
|
||||
export class AircraftService extends BaseService {
|
||||
@@ -14,10 +13,9 @@ export class AircraftService extends BaseService {
|
||||
}
|
||||
|
||||
public getListOfAircrafts(): Observable<Array<AircraftResp>> {
|
||||
return this.http.get<Array<AircraftResp>>(
|
||||
`${this.apiUrl}/Aircraft`,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
return this.http.get<Array<AircraftResp>>(`${this.apiUrl}/Aircraft`, {
|
||||
headers: this.headers
|
||||
});
|
||||
}
|
||||
|
||||
public AddAircraft(aircraftName: string) {
|
||||
@@ -32,5 +30,4 @@ export class AircraftService extends BaseService {
|
||||
})
|
||||
.subscribe(data => console.log(data));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { Injectable } from "@angular/core";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
import { map } from "rxjs/operators";
|
||||
|
||||
import { DropZoneResp } from '../models/dropzone';
|
||||
|
||||
import { BaseService } from './base.service';
|
||||
import { DropZoneResp, DropZoneReq } from "../models/dropzone";
|
||||
|
||||
import { BaseService } from "./base.service";
|
||||
|
||||
@Injectable()
|
||||
export class DropzoneService extends BaseService {
|
||||
@@ -48,4 +47,33 @@ export class DropzoneService extends BaseService {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public AddDropZone(
|
||||
latitude: string,
|
||||
longitude: string,
|
||||
name: string,
|
||||
address: string,
|
||||
website: string,
|
||||
email: string,
|
||||
type: Array<string>,
|
||||
isFavorite: boolean
|
||||
) {
|
||||
const bodyNewDropZone: DropZoneReq = {
|
||||
id: 0,
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
name: name,
|
||||
address: address,
|
||||
website: website,
|
||||
email: email,
|
||||
type: type,
|
||||
isFavorite: isFavorite
|
||||
};
|
||||
|
||||
this.http
|
||||
.post(`${this.apiUrl}/DropZone`, bodyNewDropZone, {
|
||||
headers: this.headers
|
||||
})
|
||||
.subscribe(data => console.log(data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Injectable } from "@angular/core";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
import { GearResp, GearReq } from '../models/gear';
|
||||
|
||||
import { BaseService } from './base.service';
|
||||
import { GearResp, GearReq } from "../models/gear";
|
||||
|
||||
import { BaseService } from "./base.service";
|
||||
|
||||
@Injectable()
|
||||
export class GearService extends BaseService {
|
||||
@@ -19,13 +18,15 @@ export class GearService extends BaseService {
|
||||
});
|
||||
}
|
||||
|
||||
public AddGear(name: string,
|
||||
public AddGear(
|
||||
name: string,
|
||||
manufacturer: string,
|
||||
minSize: number,
|
||||
maxSize: number,
|
||||
aad: string,
|
||||
mainCanopy: string,
|
||||
reserveCanopy: string) {
|
||||
reserveCanopy: string
|
||||
) {
|
||||
const bodyNewGear: GearReq = {
|
||||
id: 0,
|
||||
name: name,
|
||||
@@ -43,5 +44,4 @@ export class GearService extends BaseService {
|
||||
})
|
||||
.subscribe(data => console.log(data));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Injectable } from "@angular/core";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
import { JumpTypeResp } from '../models/jumpType';
|
||||
|
||||
import { BaseService } from './base.service';
|
||||
import { JumpTypeResp, JumpTypeReq } from "../models/jumpType";
|
||||
|
||||
import { BaseService } from "./base.service";
|
||||
|
||||
@Injectable()
|
||||
export class JumpTypeService extends BaseService {
|
||||
@@ -14,9 +13,21 @@ export class JumpTypeService extends BaseService {
|
||||
}
|
||||
|
||||
public getListOfJumpTypes(): Observable<Array<JumpTypeResp>> {
|
||||
return this.http.get<Array<JumpTypeResp>>(
|
||||
`${this.apiUrl}/JumpType`,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
return this.http.get<Array<JumpTypeResp>>(`${this.apiUrl}/JumpType`, {
|
||||
headers: this.headers
|
||||
});
|
||||
}
|
||||
|
||||
public AddJumpType(jumptypetName: string) {
|
||||
const bodyJumpType: JumpTypeReq = {
|
||||
id: 0,
|
||||
name: jumptypetName
|
||||
};
|
||||
|
||||
this.http
|
||||
.post(`${this.apiUrl}/JumpType`, bodyJumpType, {
|
||||
headers: this.headers
|
||||
})
|
||||
.subscribe(data => console.log(data));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user