feat(zone.events): new dialog when choose 'exclude'
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
d994daa619
commit
05b0a5342f
|
@ -198,3 +198,72 @@
|
||||||
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-id="excludeDialog"
|
||||||
|
on-response="$ctrl.onIncludeResponse($response)"
|
||||||
|
message="Exclusion">
|
||||||
|
<tpl-body>
|
||||||
|
<vn-date-picker
|
||||||
|
label="Day"
|
||||||
|
ng-model="$ctrl.selected.dated">
|
||||||
|
</vn-date-picker>
|
||||||
|
<vn-vertical>
|
||||||
|
<vn-vertical class="vn-pb-md">
|
||||||
|
<vn-radio
|
||||||
|
ng-model="$ctrl.selected.type"
|
||||||
|
label="All"
|
||||||
|
val="all">
|
||||||
|
</vn-radio>
|
||||||
|
<vn-radio
|
||||||
|
ng-model="$ctrl.selected.type"
|
||||||
|
label="Specific locations"
|
||||||
|
val="specificLocations">
|
||||||
|
</vn-radio>
|
||||||
|
</vn-vertical>
|
||||||
|
<vn-crud-model
|
||||||
|
vn-id="model"
|
||||||
|
url="Zones/{{$ctrl.$params.id}}/getLeaves"
|
||||||
|
filter="$ctrl.filter">
|
||||||
|
</vn-crud-model>
|
||||||
|
<vn-portal slot="topbar">
|
||||||
|
<vn-searchbar
|
||||||
|
on-search="$ctrl.onSearch($params)"
|
||||||
|
auto-state="false">
|
||||||
|
</vn-searchbar>
|
||||||
|
</vn-portal>
|
||||||
|
<vn-treeview
|
||||||
|
vn-id="treeview"
|
||||||
|
root-label="Locations where it is not distributed"
|
||||||
|
fetch-func="$ctrl.onFetch($item)"
|
||||||
|
sort-func="$ctrl.onSort($a, $b)">
|
||||||
|
<!-- ng-if="$ctrl.selected.type == specificLocations" -->
|
||||||
|
<vn-check acl-role="deliveryBoss"
|
||||||
|
ng-model="$ctrl.item.selected"
|
||||||
|
on-change="$ctrl.onSelection2(value, item)"
|
||||||
|
triple-state="true"
|
||||||
|
ng-click="$event.preventDefault()"
|
||||||
|
label="{{::item.name}}">
|
||||||
|
</vn-check>
|
||||||
|
</vn-treeview>
|
||||||
|
|
||||||
|
</vn-vertical>
|
||||||
|
</tpl-body>
|
||||||
|
<tpl-buttons>
|
||||||
|
<input
|
||||||
|
type="button"
|
||||||
|
response="cancel"
|
||||||
|
translate-attr="{value: 'Cancel'}">
|
||||||
|
</input>
|
||||||
|
<input
|
||||||
|
type="button"
|
||||||
|
ng-if="!$ctrl.isNew"
|
||||||
|
response="delete"
|
||||||
|
translate-attr="{value: 'Delete'}">
|
||||||
|
</input>
|
||||||
|
<button response="accept">
|
||||||
|
<span ng-if="$ctrl.isNew" translate>Add</span>
|
||||||
|
<span ng-if="!$ctrl.isNew" translate>Save</span>
|
||||||
|
</button>
|
||||||
|
</tpl-buttons>
|
||||||
|
</vn-dialog>
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Controller extends Section {
|
||||||
constructor($element, $, vnWeekDays) {
|
constructor($element, $, vnWeekDays) {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
this.vnWeekDays = vnWeekDays;
|
this.vnWeekDays = vnWeekDays;
|
||||||
this.editMode = 'include';
|
this.editMode = 'exclude';
|
||||||
}
|
}
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
|
@ -52,14 +52,23 @@ class Controller extends Section {
|
||||||
if (this.editMode == 'include') {
|
if (this.editMode == 'include') {
|
||||||
if (events.length)
|
if (events.length)
|
||||||
this.edit(events[0]);
|
this.edit(events[0]);
|
||||||
else
|
else {
|
||||||
this.create(type, days, weekday);
|
this.create(type, days, weekday);
|
||||||
|
console.log(type);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (exclusions.length)
|
console.log(type);
|
||||||
this.exclusionDelete(exclusions);
|
this.selected = {
|
||||||
else
|
type: 'all',
|
||||||
this.exclusionCreate(days);
|
dated: days[0]
|
||||||
|
};
|
||||||
|
this.$.excludeDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (exclusions.length)
|
||||||
|
// this.exclusionDelete(exclusions);
|
||||||
|
// else
|
||||||
|
// this.exclusionCreate(days);
|
||||||
}
|
}
|
||||||
|
|
||||||
onEditClick(row, event) {
|
onEditClick(row, event) {
|
||||||
|
@ -170,6 +179,46 @@ class Controller extends Section {
|
||||||
this.$q.all(reqs)
|
this.$q.all(reqs)
|
||||||
.then(() => this.refresh());
|
.then(() => this.refresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSearch(params) {
|
||||||
|
this.$.model.applyFilter({}, params).then(() => {
|
||||||
|
const data = this.$.model.data;
|
||||||
|
this.$.treeview.data = data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onFetch(item) {
|
||||||
|
const params = item ? {parentId: item.id} : null;
|
||||||
|
return this.$.model.applyFilter({}, params)
|
||||||
|
.then(() => this.$.model.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSort(a, b) {
|
||||||
|
if (b.selected !== a.selected) {
|
||||||
|
if (a.selected == null)
|
||||||
|
return 1;
|
||||||
|
if (b.selected == null)
|
||||||
|
return -1;
|
||||||
|
return b.selected - a.selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
return a.name.localeCompare(b.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
exprBuilder(param, value) {
|
||||||
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return {name: {like: `%${value}%`}};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onSelection2(value, item) {
|
||||||
|
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'];
|
||||||
|
|
||||||
|
|
|
@ -4,3 +4,6 @@ Exclude: Excluir
|
||||||
Events: Eventos
|
Events: Eventos
|
||||||
Add event: Añadir evento
|
Add event: Añadir evento
|
||||||
Edit event: Editar evento
|
Edit event: Editar evento
|
||||||
|
All: Todo
|
||||||
|
Specific locations: Localizaciones concretas
|
||||||
|
Locations where it is not distributed: Localizaciones en las que no se reparte
|
Loading…
Reference in New Issue