diff --git a/packages/modules/product/src/lib/components/forms/product-creation-form.component.ts b/packages/modules/product/src/lib/components/forms/product-creation-form.component.ts index 72f6efaa..254e1add 100644 --- a/packages/modules/product/src/lib/components/forms/product-creation-form.component.ts +++ b/packages/modules/product/src/lib/components/forms/product-creation-form.component.ts @@ -1,145 +1,147 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { FormControl, FormGroup } from '@angular/forms'; +import { ModeType } from '@console-core/graphql'; +import { ProductFacade } from '@console-core/state'; @Component({ template: ` -
-
- - Name - - - - +
+ + Name + + + + - - Description - - - - + + Description + + + + - - Manufacturer - - - - - Manufacturer A - - - Manufacturer B - - - Manufacturer C - - - - + + Manufacturer + + + + + Manufacturer A + + + Manufacturer B + + + Manufacturer C + + + + - - Origin country - - - - German - France - - The United Kingdom of Great Britain and Northern Ireland - - - - + + Origin country + + + + + German + + France + + + - - Taric code - - - - + + Taric code + + + + - - Prototype - - - - - Prototype A - - - Prototype B - - - - + + Prototype + + + + + Prototype A + + + Prototype B + + + + - - Category - - - - - Category A - - - Category B - - - - + + Category + + + + + Category A + + + Category B + + + + - - - Tax Id - - - - + + + Tax Id + + + + - - Global trade item number - - - - + + Global trade item number + + + + - - Offerings - - - - Physical - - - Virtual - - - Service - - - - -
+ + Offerings + + + + Physical + + + Virtual + + + Service + + + + - -
-
-
-
Product variant
-
-
- - - -
+
-
+ `, selector: 'app-module-product-creation-form', changeDetection: ChangeDetectionStrategy.OnPush, }) -export class ProductCreationFormComponent {} +export class ProductCreationFormComponent { + productForm = new FormGroup({ + name: new FormControl('Juju toys bello'), + description: new FormControl( + 'A simple toy that you can say to what you want' + ), + manufacturerId: new FormControl('manu-b'), + originCountryId: new FormControl('germany'), + taricCode: new FormControl('12345678901'), + prototypeId: new FormControl('proto-b'), + categoryId: new FormControl('cat-b'), + gtin: new FormControl('01234567890123'), + // taxIds: new FormControl('germany-standard-rate'), // TODO This would eventually be an array. + }); + + constructor(private readonly productFacade: ProductFacade) {} + + onSubmit() { + if (this.productForm.valid) { + this.productFacade.create({ + mode: ModeType.Create, + items: [ + { + product: this.productForm.value, + meta: { + owners: [ + { + id: 'urn:restorecommerce:acs:names:ownerIndicatoryEntity', + value: + 'urn:restorecommerce:acs:model:organization.Organization', + attributes: [ + { + id: 'urn:restorecommerce:acs:names:ownerInstance', + value: 'nfuse-shop-000-organization', + }, + ], + }, + ], + }, + }, + ], + }); + } + } +} diff --git a/packages/modules/product/src/lib/components/forms/product-package-form.component.ts b/packages/modules/product/src/lib/components/forms/product-package-form.component.ts index 76fc4d9e..315e55ad 100644 --- a/packages/modules/product/src/lib/components/forms/product-package-form.component.ts +++ b/packages/modules/product/src/lib/components/forms/product-package-form.component.ts @@ -31,7 +31,7 @@ import { ChangeDetectionStrategy, Component, HostBinding } from '@angular/core'; - Rotatable + Rotatable `, selector: 'app-module-product-package-form',