tricks with hours deleted and changed order
gitea/salix/test This commit looks good Details

This commit is contained in:
Gerard 2019-03-05 14:43:59 +01:00
parent e7ca55fea3
commit 52c64e9c1d
3 changed files with 8 additions and 9 deletions

View File

@ -99,11 +99,13 @@ module.exports = Self => {
let teamIds = []; let teamIds = [];
if (worker.collegues().length) { if (worker.collegues().length && ctx.args.myTeam) {
worker.collegues().forEach(collegue => { worker.collegues().forEach(collegue => {
teamIds.push(collegue.collegueFk); teamIds.push(collegue.collegueFk);
}); });
} else { }
if (ctx.args.mine || (worker.collegues().length === 0 && ctx.args.myTeam)) {
worker = await Self.app.models.Worker.findOne({ worker = await Self.app.models.Worker.findOne({
fields: ['id'], fields: ['id'],
where: {userFk: ctx.req.accessToken.userId} where: {userFk: ctx.req.accessToken.userId}

View File

@ -3,7 +3,7 @@
url="/ticket/api/Tickets/filter" url="/ticket/api/Tickets/filter"
limit="20" limit="20"
data="tickets" data="tickets"
order="shipped DESC, clientFk" order="shipped ASC, clientFk"
auto-load="false"> auto-load="false">
</vn-crud-model> </vn-crud-model>
<div class="content-block"> <div class="content-block">

View File

@ -12,28 +12,25 @@ export default class Controller {
this.goToTurns('ticket.weekly'); this.goToTurns('ticket.weekly');
}, name: 'Turns', always: true}, }, name: 'Turns', always: true},
]; ];
this.filter = {};
if (!$stateParams.q) { if (!$stateParams.q) {
let today = new Date(); let today = new Date();
let offset = today.getTimezoneOffset() * 60000;
today.setHours(0, 0, 0, 0); today.setHours(0, 0, 0, 0);
today.setTime(today.getTime() - offset);
let tomorrow = new Date(today); let tomorrow = new Date(today);
tomorrow.setHours(23, 59, 59, 999); tomorrow.setHours(23, 59, 59, 999);
tomorrow.setTime(tomorrow.getTime() - offset);
let sixDays = new Date(today); let sixDays = new Date(today);
sixDays.setDate(today.getDate() + 6); sixDays.setDate(today.getDate() + 6);
sixDays.setHours(23, 59, 59, 999); 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() { $postLink() {
if (this.filter) if (this.filter && this.filter != {})
this.onSearch(this.filter); this.onSearch(this.filter);
} }