Files
smartguide/webapp/src/app/list-item/list-item.component.html
T
2026-03-30 13:36:20 +02:00

59 lines
2.2 KiB
HTML

<div class="page">
<div class="form-section">
<h3>{{ editing ? 'Element bearbeiten' : 'Neues Element' }}</h3>
<form [formGroup]="itemForm" class="item-form">
<mat-form-field>
<mat-label>Name</mat-label>
<input matInput formControlName="name">
</mat-form-field>
<mat-form-field>
<mat-label>Beschreibung</mat-label>
<input matInput formControlName="description">
</mat-form-field>
<div class="form-actions">
<button mat-flat-button class="primary-button" (click)="save()" [disabled]="!itemForm.valid">
{{ editing ? 'Speichern' : 'Erstellen' }}
</button>
@if (editing) {
<button mat-flat-button class="secondary-button" (click)="cancelEdit()">Abbrechen</button>
}
</div>
</form>
</div>
<table mat-table [dataSource]="items" class="mat-elevation-z2">
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef>ID</th>
<td mat-cell *matCellDef="let item">{{ item.id }}</td>
</ng-container>
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>Name</th>
<td mat-cell *matCellDef="let item">{{ item.name }}</td>
</ng-container>
<ng-container matColumnDef="description">
<th mat-header-cell *matHeaderCellDef>Beschreibung</th>
<td mat-cell *matCellDef="let item">{{ item.description }}</td>
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let item">
<button mat-icon-button (click)="startEdit(item)" matTooltip="Bearbeiten">
<mat-icon>edit</mat-icon>
</button>
<button mat-icon-button (click)="delete(item)" matTooltip="Löschen">
<mat-icon>delete</mat-icon>
</button>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<mat-paginator
[length]="total"
[pageSize]="paginationService.selection"
[pageSizeOptions]="paginationService.options"
(page)="onPage($event)">
</mat-paginator>
</div>