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"
|
||||
question="Are you sure you want to continue?">
|
||||
</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) {
|
||||
super($element, $);
|
||||
this.vnWeekDays = vnWeekDays;
|
||||
this.editMode = 'include';
|
||||
this.editMode = 'exclude';
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
|
@ -52,14 +52,23 @@ class Controller extends Section {
|
|||
if (this.editMode == 'include') {
|
||||
if (events.length)
|
||||
this.edit(events[0]);
|
||||
else
|
||||
else {
|
||||
this.create(type, days, weekday);
|
||||
console.log(type);
|
||||
}
|
||||
} else {
|
||||
if (exclusions.length)
|
||||
this.exclusionDelete(exclusions);
|
||||
else
|
||||
this.exclusionCreate(days);
|
||||
console.log(type);
|
||||
this.selected = {
|
||||
type: 'all',
|
||||
dated: days[0]
|
||||
};
|
||||
this.$.excludeDialog.show();
|
||||
}
|
||||
|
||||
// if (exclusions.length)
|
||||
// this.exclusionDelete(exclusions);
|
||||
// else
|
||||
// this.exclusionCreate(days);
|
||||
}
|
||||
|
||||
onEditClick(row, event) {
|
||||
|
@ -170,6 +179,46 @@ class Controller extends Section {
|
|||
this.$q.all(reqs)
|
||||
.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'];
|
||||
|
||||
|
|
|
@ -4,3 +4,6 @@ Exclude: Excluir
|
|||
Events: Eventos
|
||||
Add event: Añadir 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