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,
|
||||
`geoFk` int(11) NOT NULL,
|
||||
PRIMARY KEY (`zoneExclusionFk`,`geoFk`),
|
||||
KEY `zoneExclusionGeo2_FK_1` (`geoFk`),
|
||||
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
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
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
|
||||
id="calendar"
|
||||
vn-id="calendar"
|
||||
|
@ -207,7 +201,8 @@
|
|||
<vn-dialog
|
||||
vn-id="excludeDialog"
|
||||
on-response="$ctrl.onExcludeResponse($response)"
|
||||
message="{{$ctrl.isNew ? 'Exclusion' : 'Edit exclusion'}}">
|
||||
message="{{$ctrl.isNew ? 'Exclusion' : 'Edit exclusion'}}"
|
||||
on-open="$ctrl.onSearch($params)">
|
||||
<tpl-body>
|
||||
<vn-date-picker
|
||||
label="Day"
|
||||
|
@ -228,7 +223,11 @@
|
|||
val="specificLocations">
|
||||
</vn-radio>
|
||||
</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'">
|
||||
<vn-textfield
|
||||
label="Search"
|
||||
|
|
|
@ -77,25 +77,16 @@ class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
editExclusion(rows) {
|
||||
editExclusion(exclusions) {
|
||||
this.isNew = false;
|
||||
this.exclusions = rows;
|
||||
this.excludeSelected = angular.copy(rows[0]);
|
||||
this.excludeSelected = angular.copy(exclusions[0]);
|
||||
this.exclusions = exclusions;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -182,8 +173,6 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
onExcludeResponse(response) {
|
||||
console.log(this.$.model.data);
|
||||
|
||||
switch (response) {
|
||||
case 'accept': {
|
||||
let excludeSelected = this.excludeSelected;
|
||||
|
@ -272,6 +261,14 @@ class Controller extends Section {
|
|||
if (this.excludeSelected.type == 'specificLocations') {
|
||||
this.$.model.applyFilter({}, params).then(() => {
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue