Edit CharacteristicValues
All checks were successful
E2E Testing / test (push) Successful in 1m36s

This commit is contained in:
Sebastian Böckelmann 2024-05-08 08:07:32 +02:00
parent eae55eb49c
commit 2b83650348
2 changed files with 18 additions and 2 deletions

View File

@ -6,13 +6,20 @@
<ng-container matColumnDef="value"> <ng-container matColumnDef="value">
<th mat-header-cell *matHeaderCellDef>Value</th> <th mat-header-cell *matHeaderCellDef>Value</th>
<td mat-cell *matCellDef="let characteristicValue">{{characteristicValue.value}}</td> <td mat-cell *matCellDef="let characteristicValue">
<span *ngIf="characteristicValue !== editedItemgroupCharacteristicValue">{{characteristicValue.value}}</span>
<mat-form-field appearance="outline" style="width: 100%;" *ngIf="characteristicValue === editedItemgroupCharacteristicValue">
<mat-label>Value</mat-label>
<input matInput [(ngModel)]="characteristicValue.value">
</mat-form-field>
</td>
</ng-container> </ng-container>
<ng-container matColumnDef="edit"> <ng-container matColumnDef="edit">
<th mat-header-cell *matHeaderCellDef></th> <th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let characteristicValue"> <td mat-cell *matCellDef="let characteristicValue">
<button mat-icon-button><mat-icon>edit</mat-icon></button> <button mat-icon-button *ngIf="editedItemgroupCharacteristicValue == undefined" (click)="editCharacteristicValue(characteristicValue)"><mat-icon>edit</mat-icon></button>
<button mat-icon-button *ngIf="editedItemgroupCharacteristicValue != undefined" (click)="finishEditing()" [disabled]="characteristicValue !== editedItemgroupCharacteristicValue"><mat-icon>done</mat-icon></button>
</td> </td>
</ng-container> </ng-container>

View File

@ -16,6 +16,7 @@ export class InheritedItemCharacteristicEditorComponent implements OnInit{
datasource: MatTableDataSource<ItemgroupCharacteristicValue> = new MatTableDataSource<ItemgroupCharacteristicValue>(); datasource: MatTableDataSource<ItemgroupCharacteristicValue> = new MatTableDataSource<ItemgroupCharacteristicValue>();
displayedColumns: string[] = ['characteristic', 'value', 'edit'] displayedColumns: string[] = ['characteristic', 'value', 'edit']
editedItemgroupCharacteristicValue: ItemgroupCharacteristicValue | undefined
ngOnInit() { ngOnInit() {
this.item!.initializeItemCharacteristics(); this.item!.initializeItemCharacteristics();
@ -30,4 +31,12 @@ export class InheritedItemCharacteristicEditorComponent implements OnInit{
} }
return [] return []
} }
editCharacteristicValue(itemCharacteristicValue: ItemgroupCharacteristicValue): void {
this.editedItemgroupCharacteristicValue = itemCharacteristicValue;
}
finishEditing() {
this.editedItemgroupCharacteristicValue = undefined;
}
} }