Delete SlotCharacteristics from InventorySlot
All checks were successful
E2E Testing / test (push) Successful in 1m37s

This commit is contained in:
Sebastian Böckelmann 2024-05-11 11:05:00 +02:00
parent bd243fc080
commit 1469f2e509
2 changed files with 6 additions and 1 deletions

View File

@ -36,7 +36,7 @@
<button mat-icon-button (click)="addInventorySlotCharacteristic()"><mat-icon>add</mat-icon></button> <button mat-icon-button (click)="addInventorySlotCharacteristic()"><mat-icon>add</mat-icon></button>
</th> </th>
<td mat-cell *matCellDef="let slotCharacteristic"> <td mat-cell *matCellDef="let slotCharacteristic">
<button mat-icon-button color="warn"><mat-icon>delete</mat-icon></button> <button mat-icon-button color="warn" (click)="deleteSlotCharacteristic(slotCharacteristic)"><mat-icon>delete</mat-icon></button>
</td> </td>
</ng-container> </ng-container>

View File

@ -60,4 +60,9 @@ export class InventorySlotCharacteristicEditorComponent implements OnInit{
editSlotCharacteristic(slotCharacteristic: InventoryCharacteristic) { editSlotCharacteristic(slotCharacteristic: InventoryCharacteristic) {
this.editedCharacteristic = slotCharacteristic; this.editedCharacteristic = slotCharacteristic;
} }
deleteSlotCharacteristic(slotCharacteristic: InventoryCharacteristic) {
this.inventorySlot!.slotCharacteristics = this.inventorySlot!.slotCharacteristics.filter(characteristic => characteristic !== slotCharacteristic);
this.datasource.data = this.inventorySlot!.slotCharacteristics;
}
} }