New view to add and update the equipment

This commit is contained in:
2026-05-10 23:22:54 +02:00
parent b441ad7d5d
commit 861f1f64cf
4 changed files with 53 additions and 23 deletions
@@ -30,7 +30,15 @@
</mat-form-field> </mat-form-field>
<p> <p>
<mat-form-field> <mat-form-field>
<input <mat-label>{{ "NewJump_Equipment" | translate }}</mat-label>
<mat-select [(value)]="selectedEquipment">
@for (equipment of listOfEquipment; track equipment) {
<mat-option [value]="equipment.value">{{
equipment.viewValue
}}</mat-option>
}
</mat-select>
<!-- <input
type="text" type="text"
matInput matInput
placeholder="equipment" placeholder="equipment"
@@ -38,7 +46,7 @@
[(ngModel)]="jump.equipment" [(ngModel)]="jump.equipment"
name="equipment" name="equipment"
type="text" type="text"
/> /> -->
</mat-form-field> </mat-form-field>
</p> </p>
<br /> <br />
@@ -7,6 +7,7 @@ import { MatFormFieldModule } from "@angular/material/form-field";
import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { MatInputModule } from "@angular/material/input"; import { MatInputModule } from "@angular/material/input";
import { MatButtonModule } from "@angular/material/button"; import { MatButtonModule } from "@angular/material/button";
import { MatSelectModule } from "@angular/material/select";
import { AddAction } from "../../models/add-action.enum"; import { AddAction } from "../../models/add-action.enum";
import { JumpResp } from "../../models/jump"; import { JumpResp } from "../../models/jump";
@@ -14,6 +15,11 @@ import { JumpResp } from "../../models/jump";
import { JumpService } from "../../services/jump.service"; import { JumpService } from "../../services/jump.service";
import { ServiceComm } from "../../services/service-comm.service"; import { ServiceComm } from "../../services/service-comm.service";
interface Equipment {
value: string;
viewValue: string;
}
@Component({ @Component({
selector: "app-jump-infos", selector: "app-jump-infos",
templateUrl: "./jump-infos.component.html", templateUrl: "./jump-infos.component.html",
@@ -26,11 +32,21 @@ import { ServiceComm } from "../../services/service-comm.service";
ReactiveFormsModule, ReactiveFormsModule,
MatInputModule, MatInputModule,
MatButtonModule, MatButtonModule,
MatSelectModule,
], ],
}) })
export class JumpInfosComponent implements OnInit { export class JumpInfosComponent implements OnInit {
public editMode: boolean; public editMode: boolean;
public jump: JumpResp; public jump: JumpResp;
public selectedEquipment: string = "";
public listOfEquipment: Array<Equipment> = [
{ value: "", viewValue: "<None>" },
{ value: "Freak 6", viewValue: "Freak 6" },
{ value: "ATC 4", viewValue: "ATC 4" },
{ value: "ATC 2", viewValue: "ATC 2" },
{ value: "Havok", viewValue: "Havok" },
{ value: "Hawk", viewValue: "Hawk" },
];
constructor( constructor(
@Inject(MAT_DIALOG_DATA) public data: any, @Inject(MAT_DIALOG_DATA) public data: any,
@@ -153,23 +153,14 @@
} }
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input <mat-label>{{ "NewJump_Equipment" | translate }}</mat-label>
matInput <mat-select [(value)]="selectedEquipment">
placeholder="{{ 'NewJump_Equipment' | translate }}" @for (equipment of listOfEquipment; track equipment) {
[(ngModel)]="equipment" <mat-option [value]="equipment.value">{{
name="equipment" equipment.viewValue
type="text" }}</mat-option>
/> }
@if (exitAltitude) { </mat-select>
<button
matSuffix
mat-icon-button
aria-label="Clear"
(click)="equipment = undefined"
>
<mat-icon svgIcon="close"></mat-icon>
</button>
}
</mat-form-field> </mat-form-field>
<mat-checkbox [(ngModel)]="withCutaway" name="withCutaway">{{ <mat-checkbox [(ngModel)]="withCutaway" name="withCutaway">{{
"NewJump_Cutaway" | translate "NewJump_Cutaway" | translate
@@ -18,6 +18,7 @@ import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { MatInputModule } from "@angular/material/input"; import { MatInputModule } from "@angular/material/input";
import { MatButtonModule } from "@angular/material/button"; import { MatButtonModule } from "@angular/material/button";
import { MatSelectModule } from "@angular/material/select";
import { JumpTypeResp } from "../../models/jumpType"; import { JumpTypeResp } from "../../models/jumpType";
import { AircraftResp } from "../../models/aircraft"; import { AircraftResp } from "../../models/aircraft";
@@ -48,6 +49,11 @@ class PickDateAdapter extends NativeDateAdapter {
} }
} }
interface Equipment {
value: string;
viewValue: string;
}
@Component({ @Component({
selector: "app-new-jump", selector: "app-new-jump",
templateUrl: "./new-jump.component.html", templateUrl: "./new-jump.component.html",
@@ -72,6 +78,7 @@ class PickDateAdapter extends NativeDateAdapter {
ReactiveFormsModule, ReactiveFormsModule,
MatInputModule, MatInputModule,
MatButtonModule, MatButtonModule,
MatSelectModule,
], ],
}) })
export class NewJumpComponent implements OnInit { export class NewJumpComponent implements OnInit {
@@ -96,7 +103,15 @@ export class NewJumpComponent implements OnInit {
private pendingAddRequest: boolean; private pendingAddRequest: boolean;
private listOfDropZone: Array<DropZoneResp>; private listOfDropZone: Array<DropZoneResp>;
public maxDate: Date; public maxDate: Date;
public equipment: string; public selectedEquipment: string = "";
public listOfEquipment: Array<Equipment> = [
{ value: "", viewValue: "<None>" },
{ value: "Freak 6", viewValue: "Freak 6" },
{ value: "ATC 4", viewValue: "ATC 4" },
{ value: "ATC 2", viewValue: "ATC 2" },
{ value: "Havok", viewValue: "Havok" },
{ value: "Hawk", viewValue: "Hawk" },
];
constructor( constructor(
private serviceComm: ServiceComm, private serviceComm: ServiceComm,
@@ -143,12 +158,12 @@ export class NewJumpComponent implements OnInit {
this.countOfJumps, this.countOfJumps,
this.comments, this.comments,
this.isSpecial === undefined ? false : this.isSpecial, this.isSpecial === undefined ? false : this.isSpecial,
this.equipment, this.selectedEquipment,
) )
.subscribe(() => { .subscribe(() => {
this.statsService.resetStats(); this.statsService.resetStats();
this.comments = undefined; this.comments = undefined;
this.equipment = undefined; this.selectedEquipment = "";
this.withCutaway = false; this.withCutaway = false;
this.isSpecial = false; this.isSpecial = false;
@@ -236,7 +251,7 @@ export class NewJumpComponent implements OnInit {
this.listOfFilteredDropZone = this.listOfDropZone; this.listOfFilteredDropZone = this.listOfDropZone;
this.comments = undefined; this.comments = undefined;
this.equipment = undefined; this.selectedEquipment = "";
this.withCutaway = false; this.withCutaway = false;
this.isSpecial = false; this.isSpecial = false;