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

View File

@@ -7,8 +7,9 @@
<ng-container matColumnDef="infos">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element" style="text-align: left;">
<mat-icon aria-hidden="false" aria-label="All informations of the jump" style="cursor: pointer;"
(click)='openDialog(element)'>info</mat-icon>
<mat-icon aria-hidden="false" aria-label="Special jump" [style.visibility]="element.isSpecial ? 'visible' : 'hidden'">celebration</mat-icon>
<mat-icon aria-hidden="false" aria-label="Additional informations of the jump" style="cursor: pointer;"
(click)='openDialog(element, false)' *ngIf="toShow(element)">info</mat-icon>
</td>
</ng-container>
@@ -55,6 +56,8 @@
<td mat-cell *matCellDef="let element" style="text-align: left;">
<mat-icon aria-hidden="false" aria-label="Delete this jump" style="cursor: pointer;"
(click)='delete(element)'>delete</mat-icon>
<mat-icon aria-hidden="false" aria-label="Update some informations of the jump" style="cursor: pointer; margin-left: 10px;"
(click)='openDialog(element, true)'>edit</mat-icon>
</td>
</ng-container>

View File

@@ -8,6 +8,7 @@ import { JumpResp } from '../../models/jump';
import { JumpService } from '../../services/jump.service';
import { ServiceComm } from '../../services/service-comm.service';
import { JumpInfosComponent } from "../jump-infos/jump-infos.component";
import { AddAction } from '../../models/add-action.enum';
@Component({
selector: 'app-list-of-jumps',
@@ -34,12 +35,18 @@ export class ListOfJumpsComponent implements OnInit {
public dialog: MatDialog) { }
ngOnInit() {
this.serviceComm.refreshRequest.subscribe(action => {
if (action === AddAction.Jump) {
this.dialog.closeAll();
this.getListOfJumps();
}
});
this.serviceComm.UpdatedComponentTitle('List of jumps');
this.getListOfJumps();
}
getListOfJumps() {
this.listOfJumps = this.serviceApi.getListOfJumps();
this.listOfJumps = this.serviceApi.GetListOfJumps();
this.listOfJumps.subscribe(data => {
setTimeout(() => {
data.sort((a, b) => b.jumpDate.getTime() - a.jumpDate.getTime());
@@ -50,10 +57,16 @@ export class ListOfJumpsComponent implements OnInit {
});
}
openDialog(item: JumpResp) {
this.dialog.open(JumpInfosComponent, {
data: item
});
openDialog(item: JumpResp, editMode: boolean) {
this.dialog.open(JumpInfosComponent,
{ data: { "jump": item, "editMode": editMode},
maxHeight: "400px",
minWidth: "350px"
});
}
toShow(item: JumpResp) {
return item.withCutaway === true || item.notes != undefined;
}
delete(item: JumpResp) {