main #48
@ -1,15 +1,30 @@
|
||||
<table mat-table [dataSource]="itemQualityDatasource" class="mat-elevation-z8">
|
||||
<ng-container matColumnDef="Characteristic">
|
||||
<th mat-header-cell *matHeaderCellDef> Characteristic </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.characteristicName}} </td>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span *ngIf="editedCharacteristic !== element">{{element.characteristicName}}</span>
|
||||
<mat-form-field appearance="outline" *ngIf="editedCharacteristic === element" style="width: 100%">
|
||||
<mat-label>Name</mat-label>
|
||||
<input matInput [(ngModel)]="element.characteristicName">
|
||||
</mat-form-field>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Description">
|
||||
<th mat-header-cell *matHeaderCellDef> Description </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.characteristicDescription}} </td>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span *ngIf="editedCharacteristic !== element">{{element.characteristicDescription}}</span>
|
||||
<mat-form-field appearance="outline" *ngIf="editedCharacteristic === element" style="width: 100%">
|
||||
<mat-label>Name</mat-label>
|
||||
<textarea matInput [(ngModel)]="element.characteristicDescription" rows="3"></textarea>
|
||||
</mat-form-field>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="edit">
|
||||
<th mat-header-cell *matHeaderCellDef> </th>
|
||||
<td mat-cell *matCellDef="let element"><button mat-icon-button><mat-icon>edit</mat-icon></button></td>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button mat-icon-button *ngIf="editedCharacteristic !== element" [disabled]="editedCharacteristic" (click)="editItemgroupCharacteristic(element)"><mat-icon>edit</mat-icon></button>
|
||||
<button mat-icon-button *ngIf="editedCharacteristic === element" (click)="finishEditing()"><mat-icon>done</mat-icon></button>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="delete">
|
||||
<th mat-header-cell *matHeaderCellDef> <button mat-icon-button><mat-icon>add</mat-icon></button> </th>
|
||||
|
@ -1,3 +1,7 @@
|
||||
.mat-column-edit, .mat-column-delete {
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
.mat-column-Characteristic, {
|
||||
width: 25%;
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ export class ItemGroupEditorComponent implements OnInit{
|
||||
itemQualityDatasource: MatTableDataSource<ItemGroupCharacteristic> = new MatTableDataSource<ItemGroupCharacteristic>();
|
||||
displayedColumns: string[] = ["Characteristic", "Description", 'edit', 'delete']
|
||||
|
||||
editedCharacteristic: ItemGroupCharacteristic | undefined;
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
this.itemgroup!.itemGroupCharacteristics.push(new ItemGroupCharacteristic("Inventory", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."))
|
||||
@ -26,4 +28,12 @@ export class ItemGroupEditorComponent implements OnInit{
|
||||
this.itemgroup!.itemGroupCharacteristics = this.itemgroup!.itemGroupCharacteristics.filter(igc => igc.characteristicName !== characteristic.characteristicName);
|
||||
this.itemQualityDatasource.data = this.itemgroup!.itemGroupCharacteristics;
|
||||
}
|
||||
|
||||
editItemgroupCharacteristic(characteristic: ItemGroupCharacteristic) {
|
||||
this.editedCharacteristic = characteristic;
|
||||
}
|
||||
|
||||
finishEditing() {
|
||||
this.editedCharacteristic = undefined;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user