1781-zoneHoliday #994

Merged
joan merged 49 commits from 1781-zoneHoliday into dev 2022-08-03 06:41:31 +00:00
1 changed files with 18 additions and 17 deletions
Showing only changes of commit 8d4c735744 - Show all commits

View File

@ -7,8 +7,8 @@ class Controller extends Section {
super($element, $); super($element, $);
this.vnWeekDays = vnWeekDays; this.vnWeekDays = vnWeekDays;
this.editMode = 'exclude'; this.editMode = 'exclude';
this.exclusions; this.exclusions = null;
this.exclusionsGeo; this.exclusionsGeo = null;
} }
$onInit() { $onInit() {
@ -23,10 +23,6 @@ class Controller extends Section {
return `Zones/${this.$params.id}/exclusions`; return `Zones/${this.$params.id}/exclusions`;
} }
get exclusionsGeoPath() {
return `Zones/exclusionGeo`;
}
get checked() { get checked() {
const geos = this.$.model.data || []; const geos = this.$.model.data || [];
const checkedLines = []; const checkedLines = [];
@ -244,7 +240,7 @@ class Controller extends Section {
}; };
if (this.isNew) if (this.isNew)
req = this.$http.post(this.exclusionsGeoPath, params); req = this.$http.post(`Zones/exclusionGeo`, params);
else { else {
let actualPosition = 0; let actualPosition = 0;
let geoId; let geoId;
@ -333,14 +329,7 @@ class Controller extends Section {
if (this.excludeSelected.type == 'specificLocations') { if (this.excludeSelected.type == 'specificLocations') {
this.$.model.applyFilter({}, params).then(() => { this.$.model.applyFilter({}, params).then(() => {
const data = this.$.model.data; const data = this.$.model.data;
this.getChecked(data);
for (let geo of data) {
for (let exclusionGeo of this.exclusionsGeo) {
if (geo.id == exclusionGeo.geoFk)
geo.checked = true;
}
}
this.$.treeview.data = data; this.$.treeview.data = data;
}); });
} }
@ -348,8 +337,20 @@ class Controller extends Section {
onFetch(item) { onFetch(item) {
const params = item ? {parentId: item.id} : null; const params = item ? {parentId: item.id} : null;
return this.$.model.applyFilter({}, params) return this.$.model.applyFilter({}, params).then(() => {
.then(() => this.$.model.data); const data = this.$.model.data;
this.getChecked(data);
return data;
});
}
getChecked(data) {
for (let geo of data) {
for (let exclusionGeo of this.exclusionsGeo) {
if (geo.id == exclusionGeo.geoFk)
geo.checked = true;
}
}
} }
onSort(a, b) { onSort(a, b) {