1781-zoneHoliday #994
|
@ -55,8 +55,8 @@ module.exports = Self => {
|
||||||
SELECT e.*
|
SELECT e.*
|
||||||
FROM vn.zoneExclusion e
|
FROM vn.zoneExclusion e
|
||||||
LEFT JOIN vn.zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id
|
LEFT JOIN vn.zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id
|
||||||
WHERE zoneFk = ?
|
WHERE e.zoneFk = ?
|
||||||
AND dated BETWEEN ? AND ?
|
AND e.dated BETWEEN ? AND ?
|
||||||
AND eg.zoneExclusionFk IS NULL;`;
|
AND eg.zoneExclusionFk IS NULL;`;
|
||||||
const exclusions = await Self.rawSql(query, [zoneFk, started, ended], myOptions);
|
const exclusions = await Self.rawSql(query, [zoneFk, started, ended], myOptions);
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ module.exports = Self => {
|
||||||
SELECT eg.*, e.zoneFk, e.dated, e.created, e.userFk
|
SELECT eg.*, e.zoneFk, e.dated, e.created, e.userFk
|
||||||
FROM vn.zoneExclusion e
|
FROM vn.zoneExclusion e
|
||||||
LEFT JOIN vn.zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id
|
LEFT JOIN vn.zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id
|
||||||
WHERE zoneFk = ?
|
WHERE e.zoneFk = ?
|
||||||
AND dated BETWEEN ? AND ?
|
AND e.dated BETWEEN ? AND ?
|
||||||
AND eg.zoneExclusionFk IS NOT NULL;`;
|
AND eg.zoneExclusionFk IS NOT NULL;`;
|
||||||
const geoExclusions = await Self.rawSql(query, [zoneFk, started, ended], myOptions);
|
const geoExclusions = await Self.rawSql(query, [zoneFk, started, ended], myOptions);
|
||||||
|
|
||||||
|
|
|
@ -175,9 +175,7 @@ class Controller extends Section {
|
||||||
return this.exclusionGeoCreate();
|
return this.exclusionGeoCreate();
|
||||||
}
|
}
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (type == 'all')
|
return this.exclusionDelete(this.excludeSelected);
|
||||||
return this.exclusionDelete(this.exclusions);
|
|
||||||
return this.exclusionGeoDelete(this.exclusionGeos);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,41 +234,10 @@ class Controller extends Section {
|
||||||
return req.then(() => this.refresh());
|
return req.then(() => this.refresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
exclusionDelete(exclusions) {
|
exclusionDelete(exclusion) {
|
||||||
const reqs = [];
|
|
||||||
|
|
||||||
for (let exclusion of exclusions) {
|
|
||||||
if (!exclusion.id) continue;
|
|
||||||
const path = `${this.exclusionsPath}/${exclusion.id}`;
|
const path = `${this.exclusionsPath}/${exclusion.id}`;
|
||||||
reqs.push(this.$http.delete(path));
|
return this.$http.delete(path)
|
||||||
}
|
.then(() => this.refresh());
|
||||||
|
|
||||||
this.$q.all(reqs)
|
|
||||||
.then(() => {
|
|
||||||
this.refresh();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
exclusionGeoDelete(exclusionsGeo) {
|
|
||||||
const reqs = [];
|
|
||||||
|
|
||||||
for (let exclusionGeo of exclusionsGeo) {
|
|
||||||
if (!exclusionGeo.id) continue;
|
|
||||||
const path = `${this.exclusionsPath}/${exclusionGeo.zoneExclusionFk}`;
|
|
||||||
reqs.push(this.$http.delete(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$q.all(reqs)
|
|
||||||
.then(() => {
|
|
||||||
this.refresh();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
resetExclusions() {
|
|
||||||
this.excludeSelected = null;
|
|
||||||
this.isNew = null;
|
|
||||||
this.exclusions = [];
|
|
||||||
this.exclusionGeos = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set excludeSearch(value) {
|
set excludeSearch(value) {
|
||||||
|
|
Loading…
Reference in New Issue