diff --git a/packages/admin-ui/src/lib/catalog/src/components/create-product-variant-dialog/create-product-variant-dialog.component.html b/packages/admin-ui/src/lib/catalog/src/components/create-product-variant-dialog/create-product-variant-dialog.component.html index 294045fca5..4e33af8894 100644 --- a/packages/admin-ui/src/lib/catalog/src/components/create-product-variant-dialog/create-product-variant-dialog.component.html +++ b/packages/admin-ui/src/lib/catalog/src/components/create-product-variant-dialog/create-product-variant-dialog.component.html @@ -4,21 +4,12 @@
- + - + {{ 'catalog.cannot-create-variants-without-options' | translate }} @@ -31,7 +22,7 @@ {{ 'catalog.product-variant-exists' | translate }}: {{ existingVariant.name }} ({{ - existingVariant.sku + existingVariant.sku }}) @@ -44,16 +35,15 @@ + + +
- - + \ No newline at end of file diff --git a/packages/admin-ui/src/lib/catalog/src/components/create-product-variant-dialog/create-product-variant-dialog.component.ts b/packages/admin-ui/src/lib/catalog/src/components/create-product-variant-dialog/create-product-variant-dialog.component.ts index 8e7c3b8613..24767e107a 100644 --- a/packages/admin-ui/src/lib/catalog/src/components/create-product-variant-dialog/create-product-variant-dialog.component.ts +++ b/packages/admin-ui/src/lib/catalog/src/components/create-product-variant-dialog/create-product-variant-dialog.component.ts @@ -1,7 +1,13 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; -import { FormBuilder, FormControl, FormRecord, Validators } from '@angular/forms'; -import { CreateProductVariantInput, Dialog, GetProductVariantOptionsQuery } from '@vendure/admin-ui/core'; +import { FormBuilder, FormControl, FormGroup, FormRecord, Validators } from '@angular/forms'; +import { + CreateProductVariantInput, + CurrencyCode, + Dialog, + GetProductVariantOptionsQuery, +} from '@vendure/admin-ui/core'; import { notNullOrUndefined } from '@vendure/common/lib/shared-utils'; +import { combineLatest } from 'rxjs'; @Component({ selector: 'vdr-create-product-variant-dialog', @@ -15,13 +21,16 @@ export class CreateProductVariantDialogComponent implements Dialog({}), }); existingVariant: NonNullable['variants'][number] | undefined; + currencyCode: CurrencyCode; constructor(private formBuilder: FormBuilder) {} ngOnInit() { + this.currencyCode = this.product.variants[0].currencyCode; for (const optionGroup of this.product.optionGroups) { (this.form.get('options') as FormRecord).addControl( optionGroup.code, @@ -57,14 +66,16 @@ export class CreateProductVariantDialogComponent implements Dialog