35 lines
1.5 KiB
HTML
35 lines
1.5 KiB
HTML
<form [formGroup]="contextForm" (ngSubmit)="onSubmit()">
|
|
|
|
<h1 mat-dialog-title *ngIf="mode == 'new'">New context</h1>
|
|
<h1 mat-dialog-title *ngIf="mode != 'new'">Edit context</h1>
|
|
|
|
<div mat-dialog-content>
|
|
|
|
<mat-form-field appearance="fill" style="width: 100%;">
|
|
<mat-label>ID</mat-label>
|
|
<input matInput formControlName="id" required [readonly]="mode != 'new'" />
|
|
<mat-error *ngIf="contextForm.get('id')?.invalid">This field is <strong>required</strong></mat-error>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field appearance="fill" style="width: 100%;">
|
|
<mat-label>Label</mat-label>
|
|
<input matInput formControlName="label" required />
|
|
<mat-error *ngIf="contextForm.get('label')?.invalid">This field is <strong>required</strong></mat-error>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field appearance="fill" style="width: 100%;">
|
|
<mat-label>Type</mat-label>
|
|
<input matInput formControlName="type" required />
|
|
<mat-error *ngIf="contextForm.get('type')?.invalid">This field is <strong>required</strong></mat-error>
|
|
</mat-form-field>
|
|
</div>
|
|
|
|
<div mat-dialog-actions>
|
|
<button mat-stroked-button color="primary" type="submit" [disabled]="!contextForm.valid">Submit</button>
|
|
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
|
|
<mat-error *ngIf="contextForm.errors?.['serverError']">
|
|
{{ contextForm.errors?.['serverError'] }}
|
|
</mat-error>
|
|
</div>
|
|
|
|
</form> |