Revert "Add connected user when updating gear"
This reverts commit 76ef368700.
This commit is contained in:
Generated
+1979
-1692
File diff suppressed because it is too large
Load Diff
@@ -1,110 +0,0 @@
|
||||
<form (ngSubmit)="updateGear()">
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
placeholder="Name"
|
||||
name="name"
|
||||
[(ngModel)]="gear.name"
|
||||
name="name"
|
||||
type="text"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
placeholder="Manufacturer"
|
||||
name="manufacturer"
|
||||
[(ngModel)]="gear.manufacturer"
|
||||
name="manufacturer"
|
||||
type="text"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
placeholder="minSize"
|
||||
name="minSize"
|
||||
[(ngModel)]="gear.minSize"
|
||||
name="minSize"
|
||||
type="text"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
placeholder="maxSize"
|
||||
name="maxSize"
|
||||
[(ngModel)]="gear.maxSize"
|
||||
name="maxSize"
|
||||
type="text"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
placeholder="aad"
|
||||
name="aad"
|
||||
[(ngModel)]="gear.aad"
|
||||
name="aad"
|
||||
type="text"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
placeholder="mainCanopy"
|
||||
name="mainCanopy"
|
||||
[(ngModel)]="gear.mainCanopy"
|
||||
name="mainCanopy"
|
||||
type="text"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
placeholder="reserveCanopy"
|
||||
name="reserveCanopy"
|
||||
[(ngModel)]="gear.reserveCanopy"
|
||||
name="reserveCanopy"
|
||||
type="text"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</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 />
|
||||
@if (editMode) {
|
||||
<button mat-raised-button color="accent">Update</button>
|
||||
}
|
||||
</form>
|
||||
@@ -1,63 +0,0 @@
|
||||
import { Component, Inject, OnInit } from "@angular/core";
|
||||
|
||||
import { MAT_DIALOG_DATA } from "@angular/material/dialog";
|
||||
import { TranslateModule } from "@ngx-translate/core";
|
||||
import { MatCheckboxModule } from "@angular/material/checkbox";
|
||||
import { MatFormFieldModule } from "@angular/material/form-field";
|
||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||
import { MatInputModule } from "@angular/material/input";
|
||||
import { MatButtonModule } from "@angular/material/button";
|
||||
|
||||
import { AddAction } from "../../models/add-action.enum";
|
||||
import { GearResp } from "../../models/gear";
|
||||
|
||||
import { GearService } from "../../services/gear.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
|
||||
@Component({
|
||||
selector: "app-gear-infos",
|
||||
templateUrl: "./gear-infos.component.html",
|
||||
styleUrls: ["./gear-infos.component.css"],
|
||||
imports: [
|
||||
TranslateModule,
|
||||
FormsModule,
|
||||
MatCheckboxModule,
|
||||
MatFormFieldModule,
|
||||
ReactiveFormsModule,
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
})
|
||||
export class GearInfosComponent implements OnInit {
|
||||
public editMode: boolean;
|
||||
public gear: GearResp;
|
||||
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private serviceGear: GearService,
|
||||
private serviceComm: ServiceComm,
|
||||
) {
|
||||
this.gear = new GearResp(data.gear);
|
||||
this.editMode = data.editMode;
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public updateGear() {
|
||||
this.serviceGear
|
||||
.updateGear(
|
||||
this.gear.id,
|
||||
this.gear.name,
|
||||
this.gear.manufacturer,
|
||||
this.gear.minSize,
|
||||
this.gear.maxSize,
|
||||
this.gear.aad,
|
||||
this.gear.mainCanopy,
|
||||
this.gear.reserveCanopy,
|
||||
this.gear.equipment,
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.serviceComm.refreshData(AddAction.Gear);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
<form (ngSubmit)="updateJump()">
|
||||
<p>
|
||||
<span
|
||||
>Gear : {{ jump.gear.name }} ({{ jump.gear.mainCanopy }} -
|
||||
{{ jump.gear.equipment }})</span
|
||||
>
|
||||
<span>Gear : {{ jump.gear.name }} ({{ jump.gear.mainCanopy }})</span>
|
||||
</p>
|
||||
<p>
|
||||
<mat-checkbox
|
||||
|
||||
@@ -79,27 +79,6 @@
|
||||
{{ element.equipment }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th
|
||||
mat-header-cell
|
||||
*matHeaderCellDef
|
||||
style="min-width: 80px; text-wrap: nowrap"
|
||||
></th>
|
||||
<td
|
||||
mat-cell
|
||||
*matCellDef="let element"
|
||||
style="text-align: left; text-wrap: nowrap"
|
||||
>
|
||||
<mat-icon
|
||||
aria-hidden="false"
|
||||
aria-label="Update this gear"
|
||||
style="cursor: pointer; margin-left: 10px"
|
||||
(click)="openDialog(element, true)"
|
||||
svgIcon="edit"
|
||||
></mat-icon>
|
||||
</td>
|
||||
</ng-container>
|
||||
<tr
|
||||
mat-header-row
|
||||
*matHeaderRowDef="displayedColumns; sticky: true"
|
||||
|
||||
@@ -6,14 +6,12 @@ import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||
|
||||
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
||||
import { MatButtonModule } from "@angular/material/button";
|
||||
import { MatIconModule } from "@angular/material/icon";
|
||||
|
||||
import { GearService } from "../../services/gear.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
import { GearResp } from "../../models/gear";
|
||||
import { AddAction } from "../../models/add-action.enum";
|
||||
import { NewGearComponent } from "../new-gear/new-gear.component";
|
||||
import { GearInfosComponent } from "../gear-infos/gear-infos.component";
|
||||
|
||||
@Component({
|
||||
selector: "app-list-of-gears",
|
||||
@@ -25,7 +23,6 @@ import { GearInfosComponent } from "../gear-infos/gear-infos.component";
|
||||
MatProgressSpinnerModule,
|
||||
MatTableModule,
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
],
|
||||
})
|
||||
export class ListOfGearsComponent implements OnInit {
|
||||
@@ -37,7 +34,6 @@ export class ListOfGearsComponent implements OnInit {
|
||||
"mainCanopy",
|
||||
"reserveCanopy",
|
||||
"equipment",
|
||||
"actions",
|
||||
];
|
||||
public dataSourceTable: MatTableDataSource<GearResp>;
|
||||
public resultsLength = 0;
|
||||
@@ -85,14 +81,6 @@ export class ListOfGearsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
openDialog(item: GearResp, editMode: boolean) {
|
||||
this.dialog.open(GearInfosComponent, {
|
||||
data: { gear: item, editMode: editMode },
|
||||
maxHeight: "400px",
|
||||
minWidth: "350px",
|
||||
});
|
||||
}
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListGears_Title").subscribe((data) => {
|
||||
this.serviceComm.updatedComponentTitle(data);
|
||||
|
||||
@@ -137,8 +137,7 @@
|
||||
>
|
||||
@for (gear of listOfGear; track gear) {
|
||||
<mat-option [value]="gear">
|
||||
{{ gear.name }} ({{ gear.mainCanopy }} -
|
||||
{{ gear.equipment }})
|
||||
{{ gear.name }} ({{ gear.mainCanopy }})
|
||||
</mat-option>
|
||||
}
|
||||
</mat-autocomplete>
|
||||
|
||||
@@ -65,33 +65,4 @@ export class GearService extends BaseService {
|
||||
public getFromCache(): Observable<Array<GearResp>> {
|
||||
return this.serviceCacheApi.getByKey<Array<GearResp>>(CacheApiKey.Gear);
|
||||
}
|
||||
|
||||
public updateGear(
|
||||
id: number,
|
||||
name: string,
|
||||
manufacturer: string,
|
||||
minSize: number,
|
||||
maxSize: number,
|
||||
aad: string,
|
||||
mainCanopy: string,
|
||||
reserveCanopy: string,
|
||||
equipment: string,
|
||||
) {
|
||||
const gearData = {
|
||||
id: id,
|
||||
name: name,
|
||||
manufacturer: manufacturer,
|
||||
minSize: minSize,
|
||||
maxSize: maxSize,
|
||||
aad: aad,
|
||||
mainCanopy: mainCanopy,
|
||||
reserveCanopy: reserveCanopy,
|
||||
equipment: equipment,
|
||||
};
|
||||
const bodyUpdatedGear = new GearReq(gearData);
|
||||
|
||||
return this.http.put(`${this.apiUrl}/Gear/${id}`, bodyUpdatedGear, {
|
||||
headers: this.headers,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user