From 05b0a5342fb80ebc9c23050b6de258867505e73c Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 11 May 2022 14:53:52 +0200 Subject: [PATCH] feat(zone.events): new dialog when choose 'exclude' --- modules/zone/front/events/index.html | 69 +++++++++++++++++++++++++ modules/zone/front/events/index.js | 61 +++++++++++++++++++--- modules/zone/front/events/locale/es.yml | 3 ++ 3 files changed, 127 insertions(+), 6 deletions(-) diff --git a/modules/zone/front/events/index.html b/modules/zone/front/events/index.html index e71a1ae26..7bcbba256 100644 --- a/modules/zone/front/events/index.html +++ b/modules/zone/front/events/index.html @@ -198,3 +198,72 @@ message="This item will be deleted" question="Are you sure you want to continue?"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/zone/front/events/index.js b/modules/zone/front/events/index.js index 0df16a42a..c5843e362 100644 --- a/modules/zone/front/events/index.js +++ b/modules/zone/front/events/index.js @@ -5,7 +5,7 @@ class Controller extends Section { constructor($element, $, vnWeekDays) { super($element, $); this.vnWeekDays = vnWeekDays; - this.editMode = 'include'; + this.editMode = 'exclude'; } $onInit() { @@ -52,14 +52,23 @@ class Controller extends Section { if (this.editMode == 'include') { if (events.length) this.edit(events[0]); - else + else { this.create(type, days, weekday); + console.log(type); + } } else { - if (exclusions.length) - this.exclusionDelete(exclusions); - else - this.exclusionCreate(days); + console.log(type); + this.selected = { + type: 'all', + dated: days[0] + }; + this.$.excludeDialog.show(); } + + // if (exclusions.length) + // this.exclusionDelete(exclusions); + // else + // this.exclusionCreate(days); } onEditClick(row, event) { @@ -170,6 +179,46 @@ class Controller extends Section { this.$q.all(reqs) .then(() => this.refresh()); } + + onSearch(params) { + this.$.model.applyFilter({}, params).then(() => { + const data = this.$.model.data; + this.$.treeview.data = data; + }); + } + + onFetch(item) { + const params = item ? {parentId: item.id} : null; + return this.$.model.applyFilter({}, params) + .then(() => this.$.model.data); + } + + onSort(a, b) { + if (b.selected !== a.selected) { + if (a.selected == null) + return 1; + if (b.selected == null) + return -1; + return b.selected - a.selected; + } + + return a.name.localeCompare(b.name); + } + + exprBuilder(param, value) { + switch (param) { + case 'search': + return {name: {like: `%${value}%`}}; + } + } + + onSelection2(value, item) { + 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']; diff --git a/modules/zone/front/events/locale/es.yml b/modules/zone/front/events/locale/es.yml index eb581a719..59b05e696 100644 --- a/modules/zone/front/events/locale/es.yml +++ b/modules/zone/front/events/locale/es.yml @@ -4,3 +4,6 @@ Exclude: Excluir Events: Eventos Add event: AƱadir evento Edit event: Editar evento +All: Todo +Specific locations: Localizaciones concretas +Locations where it is not distributed: Localizaciones en las que no se reparte \ No newline at end of file