|
2 | 2 | (vehicleCreated)="onVehicleCreated()"
|
3 | 3 | ></app-create-vehicle-form>
|
4 | 4 | <div *ngIf="vehicles">
|
5 |
| - <h2>Vehicle List</h2> |
| 5 | + <div> |
| 6 | + <h2>Vehicle List</h2> |
| 7 | + <button mat-icon-button> |
| 8 | + <mat-icon>add</mat-icon> |
| 9 | + </button> |
| 10 | + </div> |
6 | 11 | <table mat-table [dataSource]="vehicles" class="mat-elevation-z8">
|
7 | 12 | <!--- Note that these columns can be defined in any order.
|
8 | 13 | The actual rendered columns are set as a property on the row definition" -->
|
@@ -44,19 +49,33 @@ <h2>Vehicle List</h2>
|
44 | 49 | <ng-container matColumnDef="actions">
|
45 | 50 | <th mat-header-cell *matHeaderCellDef>Actions</th>
|
46 | 51 | <td mat-cell *matCellDef="let element">
|
47 |
| - <button mat-icon-button [matMenuTriggerFor]="menu"> |
48 |
| - <mat-icon>more_vert</mat-icon> |
49 |
| - </button> |
50 |
| - <mat-menu #menu="matMenu"> |
51 |
| - <button mat-menu-item (click)="editVehicle(element)"> |
52 |
| - <mat-icon>edit</mat-icon> |
53 |
| - <span>Edytuj</span> |
| 52 | + <div |
| 53 | + *ngIf=" |
| 54 | + !editedVehicle || (editedVehicle && editedVehicle.id !== element.id) |
| 55 | + " |
| 56 | + > |
| 57 | + <button mat-icon-button [matMenuTriggerFor]="menu"> |
| 58 | + <mat-icon>more_vert</mat-icon> |
54 | 59 | </button>
|
55 |
| - <button mat-menu-item (click)="removeVehicle(element)"> |
56 |
| - <mat-icon>delete</mat-icon> |
57 |
| - <span>Usuń</span> |
| 60 | + <mat-menu #menu="matMenu"> |
| 61 | + <button mat-menu-item (click)="editVehicle(element)"> |
| 62 | + <mat-icon class="edit-icon">edit</mat-icon> |
| 63 | + <span>Edytuj</span> |
| 64 | + </button> |
| 65 | + <button mat-menu-item (click)="removeVehicle(element)"> |
| 66 | + <mat-icon>delete</mat-icon> |
| 67 | + <span>Usuń</span> |
| 68 | + </button> |
| 69 | + </mat-menu> |
| 70 | + </div> |
| 71 | + <div *ngIf="editedVehicle && editedVehicle.id === element.id"> |
| 72 | + <button mat-icon-button> |
| 73 | + <mat-icon>check</mat-icon> |
58 | 74 | </button>
|
59 |
| - </mat-menu> |
| 75 | + <button mat-icon-button (click)="cancelEditing()"> |
| 76 | + <mat-icon>close</mat-icon> |
| 77 | + </button> |
| 78 | + </div> |
60 | 79 | </td>
|
61 | 80 | </ng-container>
|
62 | 81 |
|
|
0 commit comments