#1017 ticket.index

This commit is contained in:
Gerard 2019-01-22 16:18:26 +01:00
parent dc46ede513
commit abea582014
2 changed files with 18 additions and 3 deletions

View File

@ -63,6 +63,10 @@ module.exports = Self => {
arg: 'myTeam',
type: 'Boolean',
description: `Whether to show only tickets for the current logged user team (For now it shows only the current user tickets)`
}, {
arg: 'mine',
type: 'Boolean',
description: `Whether to show only tickets for the current logged user`
}, {
arg: 'orderFk',
type: 'Number',
@ -107,6 +111,10 @@ module.exports = Self => {
teamIds = [worker && worker.id];
}
if (ctx.args && ctx.args.mine || ctx.args.myTeam)
ctx.args.teamIds = teamIds;
let orderTickets = [];
if (ctx.args && ctx.args.orderFk) {
let ticketsToSearch = await Self.app.models.OrderTickets.find({where: {orderFk: filter.orderFk}});
@ -134,6 +142,7 @@ module.exports = Self => {
return {'a.provinceFk': value};
case 'stateFk':
return {'ts.stateFk': value};
case 'mine':
case 'myTeam':
return {'c.salesPersonFk': {inq: teamIds}};
case 'alertLevel':

View File

@ -19,9 +19,15 @@ export default class Controller {
tomorrow.setHours(23, 59, 59, 999);
tomorrow.setTime(tomorrow.getTime() - offset);
// FIXME: History loop
// let filter = {myTeam: true, from: today, to: tomorrow};
// $state.go('.', {q: JSON.stringify(filter)});
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};
}
$postLink() {
this.onSearch(this.filter);
}
onSearch(params) {