<app-common-dialog [dialogContent]="dialogContent" [dialogRef]="dialogRef">
  <ng-template #dialogContent>
    <p *ngIf="!databases.length" i18n>No available databases.</p>
    <form appFormSubmit (ngSubmit)="createUser()" [formGroup]="createUserForm" layoutDirection="column">
      <app-form-errors #formErrors [formGroup]="createUserForm"></app-form-errors>
      <mat-form-field [class.hide]="!databases.length">
        <mat-label i18n>Databases</mat-label>
        <mat-select formControlName="databases" i18n-placeholder placeholder="Databases selection" required multiple>
          <mat-option *ngFor="let database of databases" [value]="database">{{database}}</mat-option>
        </mat-select>
        <mat-error>{{createUserForm.controls.databases.errors | errorFormatter}}</mat-error>
      </mat-form-field>
    </form>
  </ng-template>
</app-common-dialog>
