77 lines
3.2 KiB
HTML
77 lines
3.2 KiB
HTML
<form [formGroup]="termForm" (ngSubmit)="onSubmit()">
|
|
<h1 mat-dialog-title *ngIf="data.code">Edit term</h1>
|
|
<h1 mat-dialog-title *ngIf="!data.code">New term</h1>
|
|
|
|
<div mat-dialog-content>
|
|
<mat-form-field appearance="fill" style="width: 100%;">
|
|
<mat-label>Code</mat-label>
|
|
<input matInput formControlName="code" required />
|
|
<mat-error *ngIf="termForm.get('id')?.invalid">This field is <strong>required</strong></mat-error>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field appearance="fill" style="width: 100%;">
|
|
<mat-label>Name</mat-label>
|
|
<input matInput formControlName="name" required />
|
|
<mat-error *ngIf="termForm.get('name')?.invalid">This field is <strong>required</strong></mat-error>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field appearance="fill" style="width: 100%;">
|
|
<mat-label>Encoding</mat-label>
|
|
<input matInput formControlName="encoding" />
|
|
</mat-form-field>
|
|
|
|
*** TO COMPLETE ***
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Synonym</th>
|
|
<th style="width: 20%">Encoding</th>
|
|
<th style="width: 8em"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr *ngIf="synonyms.length == 0">
|
|
<td colspan="3">0 synonym(s)</td>
|
|
</tr>
|
|
<tr *ngFor="let s of synonyms; index as i">
|
|
<td>{{s.term}}</td>
|
|
<td>{{s.encoding}}</td>
|
|
<td class="table-buttons">
|
|
<button mat-stroked-button color="warn" (ng-click)="removeSynonym(i)" [mat-dialog-close]="false">delete</button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td>
|
|
<mat-form-field appearance="outline" style="width: 100%;">
|
|
<mat-label>New term</mat-label>
|
|
<input matInput [(ngModel)]="tmpSynonym.term" />
|
|
</mat-form-field>
|
|
</td>
|
|
<td>
|
|
<mat-form-field appearance="outline" style="width: 100%;">
|
|
<mat-label>New encoding</mat-label>
|
|
<input matInput [(ngModel)]="tmpSynonym.encoding" />
|
|
</mat-form-field>
|
|
</td>
|
|
<td class="table-buttons">
|
|
<button mat-stroked-button color="primary" (ng-click)="addSynonym()" [mat-dialog-close]="false"
|
|
[disabled]="tmpSynonym.term.length == 0 || tmpSynonym.encoding.length == 0">add</button>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
|
|
|
|
</div>
|
|
|
|
<div mat-dialog-actions>
|
|
<button mat-stroked-button color="primary" type="submit" [disabled]="!termForm.valid">Submit</button>
|
|
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
|
|
<mat-error *ngIf="termForm.errors?.['serverError']">
|
|
{{ termForm.errors?.['serverError'] }}
|
|
</mat-error>
|
|
</div>
|
|
|
|
</form> |