Skip to content

Commit

Permalink
feat(admin-ui): Set the global trackInventory setting
Browse files Browse the repository at this point in the history
Relates to #81
  • Loading branch information
michaelbromley committed May 2, 2019
1 parent aace38f commit bf4185b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions admin-ui/src/app/data/definitions/settings-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export const UPDATE_PAYMENT_METHOD = gql`
export const GLOBAL_SETTINGS_FRAGMENT = gql`
fragment GlobalSettings on GlobalSettings {
availableLanguages
trackInventory
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
</ng-template>
</ng-select>
</vdr-form-field>
<clr-toggle-wrapper>
<input type="checkbox" clrToggle name="enabled" formControlName="trackInventory" />
<label>{{ 'settings.track-inventory-default' | translate }}</label>
</clr-toggle-wrapper>
</section>
<section formGroupName="customFields" *ngIf="customFields.length">
<label>{{ 'common.custom-fields' | translate }}</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class GlobalSettingsComponent extends BaseDetailComponent<GlobalSettings>
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]: '' }), {}),
),
Expand Down Expand Up @@ -76,6 +77,7 @@ export class GlobalSettingsComponent extends BaseDetailComponent<GlobalSettings>
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;
Expand Down
2 changes: 1 addition & 1 deletion admin-ui/src/i18n-messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
Expand Down

0 comments on commit bf4185b

Please sign in to comment.