feat: fix editExclusion mode
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
47ef3d0b46
commit
456f167513
|
@ -1,11 +1,11 @@
|
||||||
CREATE TABLE `zoneExclusionGeo` (
|
CREATE TABLE `vn`.`zoneExclusionGeo` (
|
||||||
`zoneExclusionFk` int(11) NOT NULL,
|
`zoneExclusionFk` int(11) NOT NULL,
|
||||||
`geoFk` int(11) NOT NULL,
|
`geoFk` int(11) NOT NULL,
|
||||||
PRIMARY KEY (`zoneExclusionFk`,`geoFk`),
|
PRIMARY KEY (`zoneExclusionFk`,`geoFk`),
|
||||||
KEY `zoneExclusionGeo2_FK_1` (`geoFk`),
|
KEY `zoneExclusionGeo2_FK_1` (`geoFk`),
|
||||||
CONSTRAINT `zoneExclusionGeo2_FK_1` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE,
|
CONSTRAINT `zoneExclusionGeo2_FK_1` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE,
|
||||||
CONSTRAINT `zoneExclusionGeo_FK` FOREIGN KEY (`zoneExclusionFk`) REFERENCES `zoneExclusion` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
CONSTRAINT `zoneExclusionGeo_FK` FOREIGN KEY (`zoneExclusionFk`) REFERENCES `zoneExclusion` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
DROP PROCEDURE IF EXISTS `vn`.`zone_excludeFromGeo`;
|
DROP PROCEDURE IF EXISTS `vn`.`zone_excludeFromGeo`;
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
<vn-crud-model
|
|
||||||
vn-id="model"
|
|
||||||
url="Zones/{{$ctrl.$params.id}}/getLeaves"
|
|
||||||
filter="$ctrl.filter"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-zone-calendar
|
<vn-zone-calendar
|
||||||
id="calendar"
|
id="calendar"
|
||||||
vn-id="calendar"
|
vn-id="calendar"
|
||||||
|
@ -207,7 +201,8 @@
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="excludeDialog"
|
vn-id="excludeDialog"
|
||||||
on-response="$ctrl.onExcludeResponse($response)"
|
on-response="$ctrl.onExcludeResponse($response)"
|
||||||
message="{{$ctrl.isNew ? 'Exclusion' : 'Edit exclusion'}}">
|
message="{{$ctrl.isNew ? 'Exclusion' : 'Edit exclusion'}}"
|
||||||
|
on-open="$ctrl.onSearch($params)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<vn-date-picker
|
<vn-date-picker
|
||||||
label="Day"
|
label="Day"
|
||||||
|
@ -228,7 +223,11 @@
|
||||||
val="specificLocations">
|
val="specificLocations">
|
||||||
</vn-radio>
|
</vn-radio>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
<vn-crud-model
|
||||||
|
vn-id="model"
|
||||||
|
url="Zones/{{$ctrl.$params.id}}/getLeaves"
|
||||||
|
filter="$ctrl.filter">
|
||||||
|
</vn-crud-model>
|
||||||
<div ng-if="$ctrl.excludeSelected.type == 'specificLocations'">
|
<div ng-if="$ctrl.excludeSelected.type == 'specificLocations'">
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
label="Search"
|
label="Search"
|
||||||
|
|
|
@ -77,25 +77,16 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
editExclusion(rows) {
|
editExclusion(exclusions) {
|
||||||
this.isNew = false;
|
this.isNew = false;
|
||||||
this.exclusions = rows;
|
this.excludeSelected = angular.copy(exclusions[0]);
|
||||||
this.excludeSelected = angular.copy(rows[0]);
|
this.exclusions = exclusions;
|
||||||
|
|
||||||
if (this.excludeSelected.geoFk)
|
if (this.excludeSelected.geoFk)
|
||||||
this.excludeSelected.type = 'specificLocations';
|
this.excludeSelected.type = 'specificLocations';
|
||||||
else
|
else
|
||||||
this.excludeSelected.type = 'all';
|
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();
|
this.$.excludeDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,8 +173,6 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
onExcludeResponse(response) {
|
onExcludeResponse(response) {
|
||||||
console.log(this.$.model.data);
|
|
||||||
|
|
||||||
switch (response) {
|
switch (response) {
|
||||||
case 'accept': {
|
case 'accept': {
|
||||||
let excludeSelected = this.excludeSelected;
|
let excludeSelected = this.excludeSelected;
|
||||||
|
@ -272,6 +261,14 @@ 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;
|
||||||
|
|
||||||
|
for (let geo of data) {
|
||||||
|
for (let exclusion of this.exclusions) {
|
||||||
|
if (geo.id == exclusion.geoFk)
|
||||||
|
geo.checked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.$.treeview.data = data;
|
this.$.treeview.data = data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue