inventory-items #42
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<ng-container matColumnDef="property">
|
<ng-container matColumnDef="property">
|
||||||
<th mat-header-cell *matHeaderCellDef>Characteristic</th>
|
<th mat-header-cell *matHeaderCellDef>Value</th>
|
||||||
<td mat-cell *matCellDef="let itemProperty">
|
<td mat-cell *matCellDef="let itemProperty">
|
||||||
<p>{{itemProperty.property}}</p>
|
<p>{{itemProperty.property}}</p>
|
||||||
</td>
|
</td>
|
||||||
@ -30,14 +30,14 @@
|
|||||||
<button mat-icon-button class="icon-btn-primary" *ngIf="editedElement !== state" (click)="editState(state)" [disabled]="editedElement !== null"><mat-icon>edit</mat-icon></button>
|
<button mat-icon-button class="icon-btn-primary" *ngIf="editedElement !== state" (click)="editState(state)" [disabled]="editedElement !== null"><mat-icon>edit</mat-icon></button>
|
||||||
<button mat-icon-button class="icon-btn-primary" (click)="finishEditing()" *ngIf="editedElement === state"><mat-icon>done</mat-icon></button>
|
<button mat-icon-button class="icon-btn-primary" (click)="finishEditing()" *ngIf="editedElement === state"><mat-icon>done</mat-icon></button>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>-->
|
||||||
|
|
||||||
<ng-container matColumnDef="delete">
|
<ng-container matColumnDef="delete">
|
||||||
<th mat-header-cell *matHeaderCellDef></th>
|
<th mat-header-cell *matHeaderCellDef></th>
|
||||||
<td mat-cell *matCellDef="let state">
|
<td mat-cell *matCellDef="let itemProperty">
|
||||||
<button mat-icon-button color="warn" (click)="deleteState(state)"><mat-icon>delete</mat-icon></button>
|
<button mat-icon-button color="warn" (click)="deleteItemProperty(itemProperty)"><mat-icon>delete</mat-icon></button>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>-->
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="expand">
|
<ng-container matColumnDef="expand">
|
||||||
<th mat-header-cell *matHeaderCellDef aria-label="row actions">
|
<th mat-header-cell *matHeaderCellDef aria-label="row actions">
|
||||||
|
@ -22,7 +22,7 @@ export class ItemPropertyEditorComponent implements OnInit{
|
|||||||
editedItemProperty: ItemProperty | undefined
|
editedItemProperty: ItemProperty | undefined
|
||||||
expandedElement: ItemProperty | undefined
|
expandedElement: ItemProperty | undefined
|
||||||
|
|
||||||
displayedColumns: string[] = ['name', 'property']
|
displayedColumns: string[] = ['name', 'property', 'delete']
|
||||||
columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
|
columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
|
||||||
|
|
||||||
datasource: MatTableDataSource<ItemProperty> = new MatTableDataSource<ItemProperty>();
|
datasource: MatTableDataSource<ItemProperty> = new MatTableDataSource<ItemProperty>();
|
||||||
@ -30,4 +30,9 @@ export class ItemPropertyEditorComponent implements OnInit{
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.datasource.data = this.item!.itemProperties
|
this.datasource.data = this.item!.itemProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteItemProperty(itemProperty: ItemProperty) {
|
||||||
|
this.item!.itemProperties = this.item!.itemProperties.filter(property => property.propertyName !== itemProperty.propertyName)
|
||||||
|
this.datasource.data = this.item!.itemProperties
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user