diff --git a/modules/zone/front/events/index.html b/modules/zone/front/events/index.html index 3a3eaf1b3..67657e665 100644 --- a/modules/zone/front/events/index.html +++ b/modules/zone/front/events/index.html @@ -198,7 +198,6 @@ message="This item will be deleted" question="Are you sure you want to continue?"> - - + @@ -228,27 +227,27 @@ url="Zones/{{$ctrl.$params.id}}/getLeaves" filter="$ctrl.filter"> - - - - - - - - - - +
+ + +
+ + + + +
+
diff --git a/modules/zone/front/events/index.js b/modules/zone/front/events/index.js index ef0fad9e9..d7d54498c 100644 --- a/modules/zone/front/events/index.js +++ b/modules/zone/front/events/index.js @@ -22,6 +22,17 @@ class Controller extends Section { return `Zones/${this.$params.id}/exclusions`; } + get checked() { + const geos = this.$.model.data || []; + const checkedLines = []; + for (let geo of geos) { + if (geo.checked) + checkedLines.push(geo); + } + + return checkedLines; + } + refresh() { this.$.data = null; this.$.$applyAsync(() => { @@ -200,8 +211,25 @@ class Controller extends Section { .then(() => this.refresh()); } - onSearch(params) { - if (this.selected.type == 'specificLocations') { + set excludeSearch(value) { + this._excludeSearch = value; + if (!value) this.onSearch(); + } + + get excludeSearch() { + return this._excludeSearch; + } + + onKeyDown(event) { + if (event.key == 'Enter') { + event.preventDefault(); + this.onSearch(); + } + } + + onSearch() { + const params = {search: this._excludeSearch}; + if (this.excludeType == 'specificLocations') { this.$.model.applyFilter({}, params).then(() => { const data = this.$.model.data; this.$.treeview.data = data; @@ -233,10 +261,25 @@ class Controller extends Section { return {name: {like: `%${value}%`}}; } } + + onSelection2(value, item) { + console.log(item, this.zone.id); + if (value == null) + value = undefined; + const params = {geoId: item.id, isIncluded: value}; + const path = `zones/${this.zone.id}/toggleIsIncluded`; + this.$http.post(path, params); + } } Controller.$inject = ['$element', '$scope', 'vnWeekDays']; ngModule.vnComponent('vnZoneEvents', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + zone: '<' + }, + require: { + card: '^vnZoneCard' + } }); diff --git a/modules/zone/front/location/index.js b/modules/zone/front/location/index.js index 0f92f37de..8f3a24b65 100644 --- a/modules/zone/front/location/index.js +++ b/modules/zone/front/location/index.js @@ -36,6 +36,8 @@ class Controller extends Section { } onSelection(value, item) { + console.log(item, this.zone.id); + if (value == null) value = undefined; const params = {geoId: item.id, isIncluded: value}; diff --git a/modules/zone/front/location/style.scss b/modules/zone/front/location/style.scss index 2316a2622..24d685a51 100644 --- a/modules/zone/front/location/style.scss +++ b/modules/zone/front/location/style.scss @@ -1,19 +1,21 @@ @import "variables"; -vn-treeview-child { - .content > .vn-check:not(.indeterminate):not(.checked) { - color: $color-alert; +vn-zone-location { + vn-treeview-child { + .content > .vn-check:not(.indeterminate):not(.checked) { + color: $color-alert; - & > .btn { - border-color: $color-alert; + & > .btn { + border-color: $color-alert; + } + } + .content > .vn-check.checked { + color: $color-notice; + + & > .btn { + background-color: $color-notice; + border-color: $color-notice + } } } - .content > .vn-check.checked { - color: $color-notice; - - & > .btn { - background-color: $color-notice; - border-color: $color-notice - } - } -} \ No newline at end of file +} diff --git a/modules/zone/front/routes.json b/modules/zone/front/routes.json index e08f97314..7f67260da 100644 --- a/modules/zone/front/routes.json +++ b/modules/zone/front/routes.json @@ -85,10 +85,13 @@ "description": "Warehouses" }, { - "url": "/events", + "url": "/events?q", "state": "zone.card.events", "component": "vn-zone-events", - "description": "Calendar" + "description": "Calendar", + "params": { + "zone": "$ctrl.zone" + } }, { "url": "/location?q",