1781-zoneHoliday #994

Merged
joan merged 49 commits from 1781-zoneHoliday into dev 2022-08-03 06:41:31 +00:00
3 changed files with 21 additions and 25 deletions
Showing only changes of commit 456f167513 - Show all commits

View File

@ -1,11 +1,11 @@
CREATE TABLE `zoneExclusionGeo` (
CREATE TABLE `vn`.`zoneExclusionGeo` (
vicent marked this conversation as resolved Outdated

remove this

remove this
`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`;

View File

@ -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"

View File

@ -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;
});
}