#1037 order.descriptor

This commit is contained in:
Gerard 2019-01-23 12:30:32 +01:00
parent e6213fb83f
commit aeb0f65fec
4 changed files with 54 additions and 15 deletions

View File

@ -4,5 +4,8 @@
},
"OrderRow": {
"dataSource": "vn"
},
"OrderTicket": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,31 @@
{
"name": "OrderTicket",
"base": "VnModel",
"options": {
"mysql": {
"table": "orderTicket"
}
},
"properties": {
"orderFk": {
"id": true,
"type": "Number"
},
"ticketFk": {
"id": true,
"type": "Number"
}
},
"relations": {
"ticket": {
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "ticketFk"
},
"order": {
"type": "belongsTo",
"model": "Order",
"foreignKey": "orderFk"
}
}
}

View File

@ -117,7 +117,7 @@ module.exports = Self => {
let orderTickets = [];
if (ctx.args && ctx.args.orderFk) {
let ticketsToSearch = await Self.app.models.OrderTickets.find({where: {orderFk: filter.orderFk}});
let ticketsToSearch = await Self.app.models.OrderTicket.find({where: {orderFk: ctx.args.orderFk}});
ticketsToSearch.forEach(ticket => {
orderTickets.push(ticket.ticketFk);
});

View File

@ -2,32 +2,37 @@ import ngModule from '../module';
import './style.scss';
export default class Controller {
constructor($scope, $state) {
constructor($scope, $state, $stateparams) {
this.$ = $scope;
this.$stateparams = $stateparams;
this.$state = $state;
this.selectedTicket = null;
this.moreOptions = [
{callback: this.goToTurns, name: 'Turns', always: true},
];
let today = new Date();
let offset = today.getTimezoneOffset() * 60000;
today.setHours(0, 0, 0, 0);
today.setTime(today.getTime() - offset);
if (!$state && !$stateparams) {
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 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};
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);
if (this.filter)
this.onSearch(this.filter);
}
onSearch(params) {