mark item diary line
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-10-21 11:08:41 +02:00
parent 6adeb689eb
commit 188f4ae3bf
1 changed files with 14 additions and 7 deletions

View File

@ -52,24 +52,31 @@ class Controller {
get freeLineIndex() {
let lines = this.$scope.model.data;
let currentDate = new Date();
currentDate.setHours(0, 0, 0);
let minDate = new Date();
minDate.setHours(0, 0, 0, 0);
let maxDate = new Date();
maxDate.setHours(23, 59, 59, 59);
for (let i = 0; i < lines.length; i++) {
let isFutureDate = new Date(lines[i].date) >= currentDate;
const dated = new Date(lines[i].date);
if (isFutureDate)
let isForFuture = dated > maxDate;
let isForToday = (dated >= minDate && dated <= maxDate);
if (isForFuture || isForToday)
return i;
}
}
get onPreparationLineIndex() {
let lines = this.$scope.model.data;
for (let i = this.freeLineIndex; i >= 0; i--) {
let line = lines[i];
let currentDate = new Date();
currentDate.setHours(0, 0, 0);
currentDate.setHours(0, 0, 0, 0);
let isPastDate = new Date(lines[i].date) < currentDate;
let isPicked = line.alertLevel == 1 && line.isPicked;
@ -95,6 +102,7 @@ class Controller {
let selectedTicketLineIndex = this.givenTicketIndex;
let lineIndex = this.onPreparationLineIndex;
let lines = body.querySelector('vn-tbody').children;
if (lineIndex == undefined || !lines.length) return;
@ -120,7 +128,6 @@ class Controller {
offsetTop = onPreparationLine.offsetTop - headerHeight;
this.$window.scrollTo(0, offsetTop);
this.ticketFk = null;
}