added search
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
b96d9ea4c2
commit
06e9a22f40
|
@ -198,7 +198,6 @@
|
||||||
message="This item will be deleted"
|
message="This item will be deleted"
|
||||||
question="Are you sure you want to continue?">
|
question="Are you sure you want to continue?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="excludeDialog"
|
vn-id="excludeDialog"
|
||||||
on-response="$ctrl.onExcludeResponse($response)"
|
on-response="$ctrl.onExcludeResponse($response)"
|
||||||
|
@ -208,16 +207,16 @@
|
||||||
label="Day"
|
label="Day"
|
||||||
ng-model="$ctrl.selected.dated">
|
ng-model="$ctrl.selected.dated">
|
||||||
</vn-date-picker>
|
</vn-date-picker>
|
||||||
<vn-vertical>
|
<vn-vertical style="width: 600px;">
|
||||||
<vn-vertical class="vn-pb-md">
|
<vn-vertical class="vn-pb-md">
|
||||||
<vn-radio
|
<vn-radio
|
||||||
ng-model="$ctrl.selected.type"
|
ng-model="$ctrl.excludeType"
|
||||||
label="All"
|
label="All"
|
||||||
on-change="$ctrl.test()"
|
on-change="$ctrl.test()"
|
||||||
val="all">
|
val="all">
|
||||||
</vn-radio>
|
</vn-radio>
|
||||||
<vn-radio
|
<vn-radio
|
||||||
ng-model="$ctrl.selected.type"
|
ng-model="$ctrl.excludeType"
|
||||||
label="Specific locations"
|
label="Specific locations"
|
||||||
on-change="$ctrl.onSearch($params)"
|
on-change="$ctrl.onSearch($params)"
|
||||||
val="specificLocations">
|
val="specificLocations">
|
||||||
|
@ -228,27 +227,27 @@
|
||||||
url="Zones/{{$ctrl.$params.id}}/getLeaves"
|
url="Zones/{{$ctrl.$params.id}}/getLeaves"
|
||||||
filter="$ctrl.filter">
|
filter="$ctrl.filter">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-portal slot="topbar">
|
<div ng-if="$ctrl.excludeType == 'specificLocations'">
|
||||||
<vn-searchbar
|
<vn-textfield
|
||||||
on-search="$ctrl.onSearch($params)"
|
label="Search"
|
||||||
auto-state="false">
|
ng-keydown="$ctrl.onKeyDown($event)"
|
||||||
</vn-searchbar>
|
ng-model="$ctrl.excludeSearch">
|
||||||
</vn-portal>
|
</vn-textfield>
|
||||||
<vn-treeview
|
<div style="max-height: 300px; overflow: auto;">
|
||||||
ng-if="$ctrl.selected.type == 'specificLocations'"
|
<vn-treeview
|
||||||
vn-id="treeview"
|
vn-id="treeview"
|
||||||
root-label="Locations where it is not distributed"
|
root-label="Locations where it is not distributed"
|
||||||
fetch-func="$ctrl.onFetch($item)"
|
fetch-func="$ctrl.onFetch($item)"
|
||||||
sort-func="$ctrl.onSort($a, $b)">
|
sort-func="$ctrl.onSort($a, $b)">
|
||||||
<vn-check acl-role="deliveryBoss"
|
<vn-check
|
||||||
ng-model="$ctrl.item.selected"
|
ng-model="geo.checked"
|
||||||
triple-state="true"
|
on-change="$ctrl.onSelection2(value, item)"
|
||||||
ng-click="$event.preventDefault()"
|
ng-click="$event.preventDefault()"
|
||||||
label="{{::item.name}}">
|
label="{{::item.name}}">
|
||||||
<!-- on-change="$ctrl.onSelection2(value, item)" -->
|
</vn-check>
|
||||||
</vn-check>
|
</vn-treeview>
|
||||||
</vn-treeview>
|
</div>
|
||||||
|
</div>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
|
|
|
@ -22,6 +22,17 @@ class Controller extends Section {
|
||||||
return `Zones/${this.$params.id}/exclusions`;
|
return `Zones/${this.$params.id}/exclusions`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get checked() {
|
||||||
|
const geos = this.$.model.data || [];
|
||||||
|
const checkedLines = [];
|
||||||
|
for (let geo of geos) {
|
||||||
|
if (geo.checked)
|
||||||
|
checkedLines.push(geo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return checkedLines;
|
||||||
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.$.data = null;
|
this.$.data = null;
|
||||||
this.$.$applyAsync(() => {
|
this.$.$applyAsync(() => {
|
||||||
|
@ -200,8 +211,25 @@ class Controller extends Section {
|
||||||
.then(() => this.refresh());
|
.then(() => this.refresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearch(params) {
|
set excludeSearch(value) {
|
||||||
if (this.selected.type == 'specificLocations') {
|
this._excludeSearch = value;
|
||||||
|
if (!value) this.onSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
get excludeSearch() {
|
||||||
|
return this._excludeSearch;
|
||||||
|
}
|
||||||
|
|
||||||
|
onKeyDown(event) {
|
||||||
|
if (event.key == 'Enter') {
|
||||||
|
event.preventDefault();
|
||||||
|
this.onSearch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onSearch() {
|
||||||
|
const params = {search: this._excludeSearch};
|
||||||
|
if (this.excludeType == 'specificLocations') {
|
||||||
this.$.model.applyFilter({}, params).then(() => {
|
this.$.model.applyFilter({}, params).then(() => {
|
||||||
const data = this.$.model.data;
|
const data = this.$.model.data;
|
||||||
this.$.treeview.data = data;
|
this.$.treeview.data = data;
|
||||||
|
@ -233,10 +261,25 @@ class Controller extends Section {
|
||||||
return {name: {like: `%${value}%`}};
|
return {name: {like: `%${value}%`}};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSelection2(value, item) {
|
||||||
|
console.log(item, this.zone.id);
|
||||||
|
if (value == null)
|
||||||
|
value = undefined;
|
||||||
|
const params = {geoId: item.id, isIncluded: value};
|
||||||
|
const path = `zones/${this.zone.id}/toggleIsIncluded`;
|
||||||
|
this.$http.post(path, params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Controller.$inject = ['$element', '$scope', 'vnWeekDays'];
|
Controller.$inject = ['$element', '$scope', 'vnWeekDays'];
|
||||||
|
|
||||||
ngModule.vnComponent('vnZoneEvents', {
|
ngModule.vnComponent('vnZoneEvents', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
zone: '<'
|
||||||
|
},
|
||||||
|
require: {
|
||||||
|
card: '^vnZoneCard'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -36,6 +36,8 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelection(value, item) {
|
onSelection(value, item) {
|
||||||
|
console.log(item, this.zone.id);
|
||||||
|
|
||||||
if (value == null)
|
if (value == null)
|
||||||
value = undefined;
|
value = undefined;
|
||||||
const params = {geoId: item.id, isIncluded: value};
|
const params = {geoId: item.id, isIncluded: value};
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
@import "variables";
|
@import "variables";
|
||||||
|
|
||||||
vn-treeview-child {
|
vn-zone-location {
|
||||||
.content > .vn-check:not(.indeterminate):not(.checked) {
|
vn-treeview-child {
|
||||||
color: $color-alert;
|
.content > .vn-check:not(.indeterminate):not(.checked) {
|
||||||
|
color: $color-alert;
|
||||||
|
|
||||||
& > .btn {
|
& > .btn {
|
||||||
border-color: $color-alert;
|
border-color: $color-alert;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.content > .vn-check.checked {
|
||||||
|
color: $color-notice;
|
||||||
|
|
||||||
|
& > .btn {
|
||||||
|
background-color: $color-notice;
|
||||||
|
border-color: $color-notice
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.content > .vn-check.checked {
|
}
|
||||||
color: $color-notice;
|
|
||||||
|
|
||||||
& > .btn {
|
|
||||||
background-color: $color-notice;
|
|
||||||
border-color: $color-notice
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -85,10 +85,13 @@
|
||||||
"description": "Warehouses"
|
"description": "Warehouses"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "/events",
|
"url": "/events?q",
|
||||||
"state": "zone.card.events",
|
"state": "zone.card.events",
|
||||||
"component": "vn-zone-events",
|
"component": "vn-zone-events",
|
||||||
"description": "Calendar"
|
"description": "Calendar",
|
||||||
|
"params": {
|
||||||
|
"zone": "$ctrl.zone"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "/location?q",
|
"url": "/location?q",
|
||||||
|
|
Loading…
Reference in New Issue