From 52c64e9c1d76ccc026a836b1995e0bd17ca53433 Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 5 Mar 2019 14:43:59 +0100 Subject: [PATCH] tricks with hours deleted and changed order --- modules/ticket/back/methods/ticket/filter.js | 6 ++++-- modules/ticket/front/index/index.html | 2 +- modules/ticket/front/index/index.js | 9 +++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 557c75d9e..f05101d75 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -99,11 +99,13 @@ module.exports = Self => { let teamIds = []; - if (worker.collegues().length) { + if (worker.collegues().length && ctx.args.myTeam) { worker.collegues().forEach(collegue => { teamIds.push(collegue.collegueFk); }); - } else { + } + + if (ctx.args.mine || (worker.collegues().length === 0 && ctx.args.myTeam)) { worker = await Self.app.models.Worker.findOne({ fields: ['id'], where: {userFk: ctx.req.accessToken.userId} diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index 42d5ad3fe..700fd9e87 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -3,7 +3,7 @@ url="/ticket/api/Tickets/filter" limit="20" data="tickets" - order="shipped DESC, clientFk" + order="shipped ASC, clientFk" auto-load="false">
diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js index 809c77d71..5d760b834 100644 --- a/modules/ticket/front/index/index.js +++ b/modules/ticket/front/index/index.js @@ -12,28 +12,25 @@ export default class Controller { this.goToTurns('ticket.weekly'); }, name: 'Turns', always: true}, ]; + this.filter = {}; if (!$stateParams.q) { let today = new Date(); - let offset = today.getTimezoneOffset() * 60000; today.setHours(0, 0, 0, 0); - today.setTime(today.getTime() - offset); let tomorrow = new Date(today); tomorrow.setHours(23, 59, 59, 999); - tomorrow.setTime(tomorrow.getTime() - offset); let sixDays = new Date(today); sixDays.setDate(today.getDate() + 6); sixDays.setHours(23, 59, 59, 999); - sixDays.setTime(sixDays.getTime() - offset); - this.filter = {mine: true, from: today, to: sixDays}; + this.filter = Object.assign(this.filter, {myTeam: true, from: today, to: sixDays}); } } $postLink() { - if (this.filter) + if (this.filter && this.filter != {}) this.onSearch(this.filter); }