#1037 order.descriptor
This commit is contained in:
parent
e6213fb83f
commit
aeb0f65fec
|
@ -4,5 +4,8 @@
|
|||
},
|
||||
"OrderRow": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"OrderTicket": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue