feat(zone): filter calendar
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
f7e2182722
commit
b2dd9e6076
|
@ -0,0 +1,21 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('getEventsFiltered', {
|
||||
description: 'Get events filtered for zone and date',
|
||||
accessType: 'READ',
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/getEventsFiltered`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.getEventsFiltered = async(zoneFk, started, ended) => {
|
||||
query = `CALL vn.zone_getEventsFiltered(?,?,?)`;
|
||||
const [events, exclusions] = await Self.rawSql(query, [zoneFk, started, ended]);
|
||||
console.log(events);
|
||||
return {events, exclusions};
|
||||
};
|
||||
};
|
|
@ -2,6 +2,7 @@ module.exports = Self => {
|
|||
require('../methods/zone/clone')(Self);
|
||||
require('../methods/zone/getLeaves')(Self);
|
||||
require('../methods/zone/getEvents')(Self);
|
||||
require('../methods/zone/getEventsFiltered')(Self);
|
||||
require('../methods/zone/toggleIsIncluded')(Self);
|
||||
require('../methods/zone/getUpcomingDeliveries')(Self);
|
||||
require('../methods/zone/deleteZone')(Self);
|
||||
|
|
|
@ -12,22 +12,22 @@ class Controller extends Section {
|
|||
this.refresh();
|
||||
}
|
||||
|
||||
get path() {
|
||||
return `Zones/${this.$params.id}/events`;
|
||||
}
|
||||
|
||||
get exclusionsPath() {
|
||||
return `Zones/${this.$params.id}/exclusions`;
|
||||
}
|
||||
|
||||
refresh() {
|
||||
let data = {};
|
||||
this.$q.all([
|
||||
this.$http.get(this.path)
|
||||
.then(res => data.events = res.data),
|
||||
this.$http.get(this.exclusionsPath)
|
||||
.then(res => data.exclusions = res.data)
|
||||
]).finally(() => {
|
||||
this.$.data = null;
|
||||
let params = {
|
||||
ended: '2022-01-31',
|
||||
started: '2021-10-01',
|
||||
zoneFk: 10
|
||||
};
|
||||
let ended = '2022-01-31';
|
||||
let started = '2021-10-01';
|
||||
let zoneFk = 10;
|
||||
// let filter = encodeURIComponent(JSON.stringify(params));
|
||||
let path = `Zones/getEventsFiltered?zoneFk=${zoneFk}&started=${started}&ended=${ended}`;
|
||||
console.log(path);
|
||||
this.$http.get(path).then(res => {
|
||||
console.log(res.data);
|
||||
let data = res.data;
|
||||
this.$.data = data;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue