2018-03-12 13:02:29 +00:00
|
|
|
import ngModule from '../module';
|
2018-03-14 10:41:19 +00:00
|
|
|
import './ticket-item';
|
|
|
|
import './style.scss';
|
2018-03-12 13:02:29 +00:00
|
|
|
|
|
|
|
export default class Controller {
|
2018-04-10 05:48:04 +00:00
|
|
|
constructor($scope) {
|
|
|
|
this.$scope = $scope;
|
|
|
|
this.ticketSelected = null;
|
|
|
|
}
|
|
|
|
|
2018-04-19 12:56:05 +00:00
|
|
|
compareDate(date) {
|
|
|
|
let today = new Date();
|
|
|
|
today.setHours(0, 0, 0, 0);
|
|
|
|
let timeTicket = new Date(date);
|
|
|
|
timeTicket.setHours(0, 0, 0, 0);
|
|
|
|
|
|
|
|
let comparation = today - timeTicket;
|
|
|
|
|
|
|
|
if (comparation == 0)
|
|
|
|
return 'warning';
|
|
|
|
|
|
|
|
if (comparation < 0)
|
|
|
|
return 'success';
|
2018-03-12 13:02:29 +00:00
|
|
|
}
|
2018-04-10 05:48:04 +00:00
|
|
|
|
2018-04-19 12:56:05 +00:00
|
|
|
preview(event, ticket) {
|
|
|
|
event.preventDefault();
|
|
|
|
event.stopImmediatePropagation();
|
2018-04-10 05:48:04 +00:00
|
|
|
this.$scope.dialogSummaryTicket.show();
|
2018-04-19 12:56:05 +00:00
|
|
|
this.ticketSelected = ticket;
|
|
|
|
}
|
|
|
|
|
|
|
|
search(index) {
|
2018-05-11 06:35:28 +00:00
|
|
|
index.accept();
|
|
|
|
/* this.tickets = [];
|
2018-05-07 06:33:45 +00:00
|
|
|
index.accept().then(res => {
|
|
|
|
this.tickets = res.instances;
|
2018-05-11 06:35:28 +00:00
|
|
|
}); */
|
2018-04-10 05:48:04 +00:00
|
|
|
}
|
2018-03-12 13:02:29 +00:00
|
|
|
}
|
2018-04-10 05:48:04 +00:00
|
|
|
|
|
|
|
Controller.$inject = ['$scope'];
|
2018-03-12 13:02:29 +00:00
|
|
|
|
2018-03-14 10:41:19 +00:00
|
|
|
ngModule.component('vnTicketList', {
|
|
|
|
template: require('./ticket-list.html'),
|
2018-03-12 13:02:29 +00:00
|
|
|
controller: Controller
|
|
|
|
});
|