|
|
@@ -41,6 +41,17 @@ export class GeneratedVariant {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+interface OptionGroupUiModel {
|
|
|
+ id?: string;
|
|
|
+ isNew: boolean;
|
|
|
+ name: string;
|
|
|
+ values: Array<{
|
|
|
+ id?: string;
|
|
|
+ name: string;
|
|
|
+ locked: boolean;
|
|
|
+ }>;
|
|
|
+}
|
|
|
+
|
|
|
@Component({
|
|
|
selector: 'vdr-product-variants-editor',
|
|
|
templateUrl: './product-variants-editor.component.html',
|
|
|
@@ -50,16 +61,7 @@ export class GeneratedVariant {
|
|
|
export class ProductVariantsEditorComponent implements OnInit, DeactivateAware {
|
|
|
formValueChanged = false;
|
|
|
generatedVariants: GeneratedVariant[] = [];
|
|
|
- optionGroups: Array<{
|
|
|
- id?: string;
|
|
|
- isNew: boolean;
|
|
|
- name: string;
|
|
|
- values: Array<{
|
|
|
- id?: string;
|
|
|
- name: string;
|
|
|
- locked: boolean;
|
|
|
- }>;
|
|
|
- }>;
|
|
|
+ optionGroups: OptionGroupUiModel[];
|
|
|
product: GetProductVariantOptions.Product;
|
|
|
currencyCode: CurrencyCode;
|
|
|
private languageCode: LanguageCode;
|
|
|
@@ -108,6 +110,11 @@ export class ProductVariantsEditorComponent implements OnInit, DeactivateAware {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ removeOption(optionGroup: OptionGroupUiModel) {
|
|
|
+ this.optionGroups = this.optionGroups.filter(og => og !== optionGroup);
|
|
|
+ this.generateVariants();
|
|
|
+ }
|
|
|
+
|
|
|
generateVariants() {
|
|
|
const groups = this.optionGroups.map(g => g.values);
|
|
|
const previousVariants = this.generatedVariants;
|