Possibilité d'éditer un saut (sur 3 infos)

Indication d'un saut est spécial.
This commit is contained in:
Sébastien André
2021-04-21 15:18:40 +02:00
parent 69c49ab011
commit a2ea873ae3
11 changed files with 110 additions and 42 deletions
@@ -1,3 +1,11 @@
<p><span>Gear : {{data.gear.name}} ({{data.gear.mainCanopy}})</span></p>
<p><mat-checkbox [(ngModel)]="data.withCutaway" labelPosition="before">Cutaway : </mat-checkbox></p>
<p><span>Notes : {{data.notes}}</span></p>
<form (ngSubmit)="updateJump()">
<p><span>Gear : {{jump.gear.name}} ({{jump.gear.mainCanopy}})</span></p>
<p><mat-checkbox [(ngModel)]="jump.isSpecial" name="isSpecial" labelPosition="before">Special jump</mat-checkbox></p>
<p><mat-checkbox [(ngModel)]="jump.withCutaway" name="withCutaway" labelPosition="before">Cutaway</mat-checkbox></p>
<mat-form-field>
<textarea matInput placeholder="Comments" name="comments" [(ngModel)]="jump.notes" name="comments" type="text"></textarea>
</mat-form-field>
<br />
<button mat-raised-button color="accent" *ngIf="editMode">Update</button>
</form>
@@ -1,7 +1,10 @@
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { AddAction } from '../../models/add-action.enum';
import { JumpResp } from '../../models/jump';
import { JumpService } from '../../services/jump.service';
import { ServiceComm } from '../../services/service-comm.service';
@Component({
selector: 'app-jump-infos',
@@ -9,10 +12,25 @@ import { JumpResp } from '../../models/jump';
styleUrls: ['./jump-infos.component.css']
})
export class JumpInfosComponent implements OnInit {
public editMode: boolean;
public jump: JumpResp
constructor(@Inject(MAT_DIALOG_DATA) public data: JumpResp) {}
ngOnInit(): void {
constructor(@Inject(MAT_DIALOG_DATA) public data: any,
private serviceJump: JumpService,
private serviceComm: ServiceComm) {
this.jump = new JumpResp(data.jump);
this.editMode = data.editMode;
}
ngOnInit(): void {}
public updateJump() {
this.serviceJump.UpdateJump(this.jump.id,
this.jump.isSpecial,
this.jump.withCutaway,
this.jump.notes)
.subscribe(() => {
this.serviceComm.RefreshData(AddAction.Jump);
});
}
}