-
-
+
diff --git a/modules/zone/front/events/index.js b/modules/zone/front/events/index.js
index 5626a175a..8aafa9e90 100644
--- a/modules/zone/front/events/index.js
+++ b/modules/zone/front/events/index.js
@@ -61,24 +61,56 @@ class Controller extends Section {
: this.$t('Everyday');
}
- onSelection(days, type, weekday, events, exclusions) {
+ onSelection(days, type, weekday, events, exclusions, geoExclusions) {
if (this.editMode == 'include') {
if (events.length)
this.edit(events[0]);
else
this.create(type, days, weekday);
} else {
- this.excludeSelected = {
- type: 'all',
- dated: days[0]
- };
- this.exclusions = exclusions;
- this.days = days;
-
- this.$.excludeDialog.show();
+ if (geoExclusions.length)
+ this.editExclusion(geoExclusions);
+ else if (exclusions.length)
+ this.editExclusion(exclusions);
+ else
+ this.createExclusion(exclusions, days);
}
}
+ editExclusion(rows) {
+ this.isNew = false;
+ this.exclusions = rows;
+ this.excludeSelected = angular.copy(rows[0]);
+ if (this.excludeSelected.geoFk)
+ this.excludeSelected.type = 'specificLocations';
+ else
+ this.excludeSelected.type = 'all';
+ console.log(this.excludeSelected);
+ // const geos = this.$.model.data || [];
+
+ // for (let geo of geos) {
+ // for (let row of rows) {
+ // if (geo.id == row.geoFk) {
+ // geo.checked = true;
+ // console.log(geo);
+ // }
+ // }
+ // }
+ this.$.excludeDialog.show();
+ }
+
+ createExclusion(exclusions, days) {
+ this.isNew = true;
+ this.excludeSelected = {
+ type: 'all',
+ dated: days[0]
+ };
+ this.exclusions = exclusions;
+ this.days = days;
+
+ this.$.excludeDialog.show();
+ }
+
onEditClick(row, event) {
if (event.defaultPrevented) return;
this.edit(row);
@@ -150,6 +182,8 @@ class Controller extends Section {
}
onExcludeResponse(response) {
+ console.log(this.$.model.data);
+
switch (response) {
case 'accept': {
let excludeSelected = this.excludeSelected;
@@ -267,14 +301,6 @@ class Controller extends Section {
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'];