<app-common-dialog [dialogContent]="dialogContent" [dialogRef]="dialogRef">
  <ng-template #dialogContent>
    <form appFormSubmit (ngSubmit)="copyImage()"
          [formGroup]="copyForm">
      <app-form-errors #formErrors [formGroup]="copyForm"></app-form-errors>
      <div *ngIf="regions && regions.objects.length" layoutDirection="column" >
        <mat-form-field>
          <mat-label i18n>Destination region</mat-label>
          <mat-select formControlName="destination_region_id" placeholder="Destination region" i18n-placeholder>
            <mat-option *ngFor="let region of regions.objects" [value]="region.id">
              {{region.id}}
            </mat-option>
          </mat-select>
          <mat-error i18n>{{copyForm.controls.destination_region_id.errors | errorFormatter}}</mat-error>
        </mat-form-field>
        <mat-form-field>
          <mat-label i18n>Destination image name</mat-label>
          <input matInput placeholder="Destination image name" i18n-placeholder
                 type="text" formControlName="destination_name">
          <mat-error i18n>{{copyForm.controls.destination_name.errors | errorFormatter}}</mat-error>
        </mat-form-field>
        <mat-checkbox formControlName="delete_source_image" i18n>Delete source image (move image)</mat-checkbox>
      </div>
    </form>
  </ng-template>
</app-common-dialog>
