32 lines
1.5 KiB
HTML
32 lines
1.5 KiB
HTML
<form [formGroup]="vocForm" (ngSubmit)="onSubmit()">
|
|
<h1 mat-dialog-title *ngIf="data.id">Edit vocabulary</h1>
|
|
<h1 mat-dialog-title *ngIf="!data.id">New vocabulary</h1>
|
|
|
|
<div mat-dialog-content>
|
|
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
|
<mat-label>ID</mat-label>
|
|
<input matInput required formControlName="id" [readonly]="data.id.length > 0" />
|
|
<mat-error *ngIf="vocForm.get('id')?.invalid">This field is <strong>required</strong></mat-error>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
|
<mat-label>Name</mat-label>
|
|
<input matInput formControlName="name" required />
|
|
<mat-error *ngIf="vocForm.get('name')?.invalid">This field is <strong>required</strong></mat-error>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
|
<mat-label>Description</mat-label>
|
|
<textarea matInput formControlName="description" rows="4"></textarea>
|
|
</mat-form-field>
|
|
</div>
|
|
|
|
<div mat-dialog-actions>
|
|
<button mat-stroked-button color="primary" type="submit" [disabled]="!vocForm.valid">Submit</button>
|
|
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
|
|
<mat-error *ngIf="vocForm.errors?.['serverError']">
|
|
{{ vocForm.errors?.['serverError'] }}
|
|
</mat-error>
|
|
</div>
|
|
|
|
</form> |