Add an equipement when you add and update a gear
This commit is contained in:
@@ -71,6 +71,14 @@
|
|||||||
{{ element.reserveCanopy }}
|
{{ element.reserveCanopy }}
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="equipment">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>
|
||||||
|
{{ "ListGears_Header_Equipment" | translate }}
|
||||||
|
</th>
|
||||||
|
<td mat-cell *matCellDef="let element">
|
||||||
|
{{ element.equipment }}
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
<tr
|
<tr
|
||||||
mat-header-row
|
mat-header-row
|
||||||
*matHeaderRowDef="displayedColumns; sticky: true"
|
*matHeaderRowDef="displayedColumns; sticky: true"
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export class ListOfGearsComponent implements OnInit {
|
|||||||
"aad",
|
"aad",
|
||||||
"mainCanopy",
|
"mainCanopy",
|
||||||
"reserveCanopy",
|
"reserveCanopy",
|
||||||
|
"equipment",
|
||||||
];
|
];
|
||||||
public dataSourceTable: MatTableDataSource<GearResp>;
|
public dataSourceTable: MatTableDataSource<GearResp>;
|
||||||
public resultsLength = 0;
|
public resultsLength = 0;
|
||||||
|
|||||||
@@ -42,6 +42,12 @@
|
|||||||
<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,6 +60,11 @@ 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" },
|
||||||
);
|
);
|
||||||
@@ -85,6 +90,7 @@ 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);
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
"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",
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
"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",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ 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 {
|
||||||
@@ -26,4 +27,5 @@ export class GearResp {
|
|||||||
public aad: string;
|
public aad: string;
|
||||||
public mainCanopy: string;
|
public mainCanopy: string;
|
||||||
public reserveCanopy: string;
|
public reserveCanopy: string;
|
||||||
|
public equipment: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,18 +15,25 @@ export class GearService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getListOfGears(): Observable<Array<GearResp>> {
|
public getListOfGears(): Observable<Array<GearResp>> {
|
||||||
let callToApi = this.http.get<Array<GearResp>>(`${this.apiUrl}/Gear`, { headers: this.headers });
|
let callToApi = this.http.get<Array<GearResp>>(`${this.apiUrl}/Gear`, {
|
||||||
return this.serviceCacheApi.get<Array<GearResp>>(CacheApiKey.Gear, callToApi);
|
headers: this.headers,
|
||||||
|
});
|
||||||
|
return this.serviceCacheApi.get<Array<GearResp>>(
|
||||||
|
CacheApiKey.Gear,
|
||||||
|
callToApi,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public addGear(name: string,
|
public addGear(
|
||||||
|
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,
|
||||||
{
|
equipment: string,
|
||||||
|
) {
|
||||||
const bodyNewGear: GearReq = {
|
const bodyNewGear: GearReq = {
|
||||||
id: 0,
|
id: 0,
|
||||||
name: name,
|
name: name,
|
||||||
@@ -35,18 +42,24 @@ export class GearService extends BaseService {
|
|||||||
maxSize: maxSize,
|
maxSize: maxSize,
|
||||||
aad: aad,
|
aad: aad,
|
||||||
mainCanopy: mainCanopy,
|
mainCanopy: mainCanopy,
|
||||||
reserveCanopy: reserveCanopy
|
reserveCanopy: reserveCanopy,
|
||||||
|
equipment: equipment,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.serviceCacheApi.delete(CacheApiKey.Gear);
|
this.serviceCacheApi.delete(CacheApiKey.Gear);
|
||||||
return this.http.post(`${this.apiUrl}/Gear`, bodyNewGear, { headers: this.headers});
|
return this.http.post(`${this.apiUrl}/Gear`, bodyNewGear, {
|
||||||
|
headers: this.headers,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public getById(id: number): Observable<GearResp> {
|
public getById(id: number): Observable<GearResp> {
|
||||||
return this.serviceCacheApi.getByKey<Array<GearResp>>(CacheApiKey.Gear)
|
return this.serviceCacheApi
|
||||||
.pipe(map(data => {
|
.getByKey<Array<GearResp>>(CacheApiKey.Gear)
|
||||||
return data.find(f => f.id === id);
|
.pipe(
|
||||||
}));
|
map((data) => {
|
||||||
|
return data.find((f) => f.id === id);
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getFromCache(): Observable<Array<GearResp>> {
|
public getFromCache(): Observable<Array<GearResp>> {
|
||||||
|
|||||||
Reference in New Issue
Block a user