Item diary select correct position #619

This commit is contained in:
Joan Sanchez 2018-09-03 08:09:56 +02:00
parent fdb7a9630b
commit c39db598ac
3 changed files with 14 additions and 9 deletions

View File

@ -2,11 +2,12 @@ import ngModule from '../module';
import './style.scss';
class Controller {
constructor($scope, $http, $state, $window) {
constructor($scope, $http, $state, $window, $translate) {
this.$scope = $scope;
this.$http = $http;
this.$state = $state;
this.$window = $window;
this.$translate = $translate;
}
$postLink() {
@ -56,9 +57,8 @@ class Controller {
let lines = this.$scope.model.data;
for (let i = 0; i < lines.length; i++) {
let isFutureDate = new Date(lines[i].date) > new Date();
let isGenreOut = lines[i].alertLevel != 0;
if (!isFutureDate && !isGenreOut)
if (isFutureDate)
return i;
}
}
@ -68,10 +68,14 @@ class Controller {
for (let i = this.freeLineIndex; i > 0; i--) {
let line = lines[i];
let currentDate = new Date();
currentDate.setHours(0, 0, 0);
if (line.alertLevel == 1 && line.isPicked || line.alertLevel > 1) {
let isPastDate = new Date(lines[i].date) < currentDate;
let isPicked = line.alertLevel == 1 && line.isPicked;
if ((isPicked) || line.alertLevel > 1 || isPastDate)
return i;
}
}
}
@ -86,7 +90,7 @@ class Controller {
let balance = onPreparationLine.querySelector('.balance');
balance.classList.add('counter');
balance.title = 'Visible quantity';
balance.title = this.$translate.instant('Visible quantity');
let headerOffset = body.querySelector('header').getBoundingClientRect();
let headerHeight = headerOffset.height;
@ -126,7 +130,7 @@ class Controller {
}
}
Controller.$inject = ['$scope', '$http', '$state', '$window'];
Controller.$inject = ['$scope', '$http', '$state', '$window', '$translate'];
ngModule.component('vnItemDiary', {
template: require('./index.html'),

View File

@ -0,0 +1,3 @@
In: Entrada
Out: Salida
Visible quantity: Cantidad visible

View File

@ -25,8 +25,6 @@ Intrastat code: Código intrastat
Warehouse: Almacén
Code: Código
State: Estado
In: Entrada
Out: Salida
Species: Especie
Add tag: Añadir etiqueta
Remove tag: Quitar etiqueta