From bf4185bef7b524100b273c72a02451e8491bc437 Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Thu, 2 May 2019 11:50:27 +0200 Subject: [PATCH] feat(admin-ui): Set the global trackInventory setting Relates to #81 --- admin-ui/src/app/data/definitions/settings-definitions.ts | 1 + .../components/global-settings/global-settings.component.html | 4 ++++ .../components/global-settings/global-settings.component.ts | 2 ++ admin-ui/src/i18n-messages/en.json | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/admin-ui/src/app/data/definitions/settings-definitions.ts b/admin-ui/src/app/data/definitions/settings-definitions.ts index fd92e2880f..875efdf815 100644 --- a/admin-ui/src/app/data/definitions/settings-definitions.ts +++ b/admin-ui/src/app/data/definitions/settings-definitions.ts @@ -360,6 +360,7 @@ export const UPDATE_PAYMENT_METHOD = gql` export const GLOBAL_SETTINGS_FRAGMENT = gql` fragment GlobalSettings on GlobalSettings { availableLanguages + trackInventory } `; diff --git a/admin-ui/src/app/settings/components/global-settings/global-settings.component.html b/admin-ui/src/app/settings/components/global-settings/global-settings.component.html index 013e9323ec..1cc8096ff2 100644 --- a/admin-ui/src/app/settings/components/global-settings/global-settings.component.html +++ b/admin-ui/src/app/settings/components/global-settings/global-settings.component.html @@ -34,6 +34,10 @@ + + + +
diff --git a/admin-ui/src/app/settings/components/global-settings/global-settings.component.ts b/admin-ui/src/app/settings/components/global-settings/global-settings.component.ts index d96a641c8d..5d3c5b5d6e 100644 --- a/admin-ui/src/app/settings/components/global-settings/global-settings.component.ts +++ b/admin-ui/src/app/settings/components/global-settings/global-settings.component.ts @@ -35,6 +35,7 @@ export class GlobalSettingsComponent extends BaseDetailComponent this.customFields = this.getCustomFieldConfig('GlobalSettings'); this.detailForm = this.formBuilder.group({ availableLanguages: [''], + trackInventory: false, customFields: this.formBuilder.group( this.customFields.reduce((hash, field) => ({ ...hash, [field.name]: '' }), {}), ), @@ -76,6 +77,7 @@ export class GlobalSettingsComponent extends BaseDetailComponent protected setFormValues(entity: GlobalSettings, languageCode: LanguageCode): void { this.detailForm.patchValue({ availableLanguages: entity.availableLanguages, + trackInventory: entity.trackInventory, }); if (this.customFields.length) { const customFieldsGroup = this.detailForm.get('customFields') as FormGroup; diff --git a/admin-ui/src/i18n-messages/en.json b/admin-ui/src/i18n-messages/en.json index b8f51d82d9..e436f3e551 100644 --- a/admin-ui/src/i18n-messages/en.json +++ b/admin-ui/src/i18n-messages/en.json @@ -39,7 +39,6 @@ "create-new-option-group": "Create new option group", "create-new-product": "Create new product", "drop-files-to-upload": "Drop files to upload", - "facet": "Facet", "facet-values": "Facet values", "filter-by-group-name": "Filter by group name", "filter-by-name": "Filter by name", @@ -445,6 +444,7 @@ "shipping-eligibility-checker": "Shipping eligibility checker", "tax-category": "Tax category", "tax-rate": "Tax rate", + "track-inventory-default": "Track inventory by default", "update": "Update", "zone": "Zone" }