2022-11-07 14:55:17 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
import Section from 'salix/components/section';
|
|
|
|
|
|
|
|
export default class Controller extends Section {
|
|
|
|
constructor($element, $) {
|
|
|
|
super($element, $);
|
|
|
|
this.$checkAll = false;
|
|
|
|
|
|
|
|
const originDated = new Date();
|
|
|
|
const futureDated = new Date();
|
|
|
|
const warehouseFk = 1;
|
|
|
|
const litersMax = 9999;
|
|
|
|
const linesMax = 9999;
|
|
|
|
|
|
|
|
this.defaultFilter = {
|
|
|
|
originDated,
|
|
|
|
futureDated,
|
|
|
|
warehouseFk,
|
|
|
|
litersMax,
|
|
|
|
linesMax
|
|
|
|
};
|
|
|
|
|
|
|
|
this.smartTableOptions = {
|
|
|
|
activeButtons: {
|
|
|
|
search: true
|
|
|
|
},
|
|
|
|
columns: [{
|
2022-11-08 14:56:58 +00:00
|
|
|
field: 'problems',
|
2022-11-07 14:55:17 +00:00
|
|
|
searchable: false
|
|
|
|
},
|
|
|
|
{
|
2022-11-08 14:56:58 +00:00
|
|
|
field: 'originETD',
|
2022-11-07 14:55:17 +00:00
|
|
|
searchable: false
|
|
|
|
},
|
|
|
|
{
|
2022-11-08 14:56:58 +00:00
|
|
|
field: 'destETD',
|
2022-11-07 14:55:17 +00:00
|
|
|
searchable: false
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
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';
|
|
|
|
}
|
|
|
|
|
2022-11-08 14:56:58 +00:00
|
|
|
get checked() {
|
|
|
|
const tickets = this.$.model.data || [];
|
|
|
|
const checkedLines = [];
|
|
|
|
for (let ticket of tickets) {
|
|
|
|
if (ticket.checked)
|
|
|
|
checkedLines.push(ticket);
|
|
|
|
}
|
|
|
|
|
|
|
|
return checkedLines;
|
|
|
|
}
|
|
|
|
|
2022-11-07 14:55:17 +00:00
|
|
|
stateColor(state) {
|
|
|
|
if (state === 'OK')
|
|
|
|
return 'success';
|
|
|
|
else if (state === 'FREE')
|
|
|
|
return 'notice';
|
|
|
|
}
|
2022-11-08 14:56:58 +00:00
|
|
|
|
2022-11-07 14:55:17 +00:00
|
|
|
dateRange(value) {
|
|
|
|
const minHour = new Date(value);
|
|
|
|
minHour.setHours(0, 0, 0, 0);
|
|
|
|
const maxHour = new Date(value);
|
|
|
|
maxHour.setHours(23, 59, 59, 59);
|
|
|
|
|
|
|
|
return [minHour, maxHour];
|
|
|
|
}
|
|
|
|
|
2022-11-08 14:56:58 +00:00
|
|
|
get confirmationMessage() {
|
|
|
|
if (!this.$.model) return 0;
|
|
|
|
|
|
|
|
return this.$t(`Move confirmation`, {
|
|
|
|
checked: this.checked.length
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
moveTicketsFuture() {
|
|
|
|
let params = { tickets: this.checked };
|
|
|
|
return this.$http.post('Tickets/merge', params)
|
|
|
|
.then(() => {
|
|
|
|
this.$.model.refresh();
|
|
|
|
this.vnApp.showSuccess(this.$t('Success'));
|
|
|
|
});
|
2022-11-07 14:55:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-08 14:56:58 +00:00
|
|
|
Controller.$inject = ['$element', '$scope'];
|
|
|
|
|
2022-11-07 14:55:17 +00:00
|
|
|
ngModule.vnComponent('vnTicketFuture', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|