<form appFormSubmit (ngSubmit)="objectController.actionCallback(primaryAction)"
      [formGroup]="pricingPlanForm" *ngIf="createOptions" class="fl-content" layoutDirection="column">
  <app-form-errors #formErrors [formGroup]="pricingPlanForm"></app-form-errors>
  <mat-form-field>
    <mat-label i18n>Name</mat-label>
    <input matInput placeholder="Name" i18n-placeholder type="text" formControlName="name" required>
    <mat-error>{{fieldErrors['name']}}</mat-error>
  </mat-form-field>
  <mat-form-field>
    <mat-label i18n>Currency</mat-label>
    <mat-select formControlName="currency" placeholder="Currency" i18n-placeholder>
      <mat-option *ngFor="let currency of createOptions.currencies" [value]="currency.code">{{currency.code}}
      </mat-option>
    </mat-select>
    <mat-error>{{fieldErrors['currency']}}</mat-error>
  </mat-form-field>
  <div>
    <mat-checkbox [color]="'primary'" formControlName="is_default" i18n>Is default</mat-checkbox>
    <mat-error>{{fieldErrors['is_default']}}</mat-error>
  </div>
  <mat-form-field *ngIf="initialDefault && !isDefault.value">
    <mat-label i18n>New default plan</mat-label>
    <mat-select formControlName="other_default" placeholder="New default plan" i18n-placeholder>
      <mat-option *ngFor="let otherPlan of createOptions.non_default_plans" [value]="otherPlan.id">{{otherPlan.name}}
      </mat-option>
    </mat-select>
    <mat-error>{{fieldErrors['other_default']}}</mat-error>
  </mat-form-field>
</form>
