From 538c217b59d2ea235bc62933c56bc5da0e505ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 15 Sep 2020 10:48:34 +0200 Subject: [PATCH] Store tagGroups on catalog url --- modules/order/front/catalog/index.js | 29 ++++++++++++++++------------ modules/order/front/routes.json | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index d0df71ea0..761fda7a3 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -55,8 +55,8 @@ class Controller extends Section { if (this.$params.typeId) this.typeId = parseInt(this.$params.typeId); - /* if (this.$params.tags) - this.tags = JSON.parse(this.$params.tags); */ + if (this.$params.tagGroups) + this.tagGroups = JSON.parse(this.$params.tagGroups); }); } @@ -288,23 +288,28 @@ class Controller extends Section { if (this.typeId) params.typeId = this.typeId; - params.tagGrops = undefined; - if (this.tagGrops.length) { - const tagGrops = []; - for (let tag of this.tagGrops) { - const tagParam = {value: tag.value}; + params.tagGroups = undefined; + if (this.tagGroups && this.tagGroups.length) { + const tagGroups = []; + for (let tagGroup of this.tagGroups) { + const tagParam = {values: []}; - if (tag.tagSelection) { - tagParam.tagFk = tag.tagFk; + for (let tagValue of tagGroup.values) + tagParam.values.push({value: tagValue.value}); + + if (tagGroup.tagFk) + tagParam.tagFk = tagGroup.tagFk; + + if (tagGroup.tagSelection) { tagParam.tagSelection = { - name: tag.tagSelection.name + name: tagGroup.tagSelection.name }; } - tags.push(tagParam); + tagGroups.push(tagParam); } - params.tags = JSON.stringify(tags); + params.tagGroups = JSON.stringify(tagGroups); } this.$state.go(this.$state.current.name, params); diff --git a/modules/order/front/routes.json b/modules/order/front/routes.json index eec628b89..7ebba32c7 100644 --- a/modules/order/front/routes.json +++ b/modules/order/front/routes.json @@ -41,7 +41,7 @@ "order": "$ctrl.order" } }, { - "url": "/catalog?q&categoryId&typeId&tags", + "url": "/catalog?q&categoryId&typeId&tagGroups", "state": "order.card.catalog", "component": "vn-order-catalog", "description": "Catalog",