#725 Mejoras Historico
This commit is contained in:
parent
de12bda66b
commit
a009a83603
|
@ -40,7 +40,8 @@
|
|||
</vn-td>
|
||||
<vn-td number>
|
||||
<span ng-class="::{'link pointer': sale.isTicket}"
|
||||
ng-click="$ctrl.showDescriptor($event, sale)">
|
||||
ng-click="$ctrl.showDescriptor($event, sale)"
|
||||
class="id">
|
||||
{{::sale.origin | dashIfEmpty}}
|
||||
</span>
|
||||
</vn-td>
|
||||
|
|
|
@ -34,14 +34,16 @@ class Controller {
|
|||
}
|
||||
|
||||
set warehouseFk(value) {
|
||||
this._warehouseFk = value;
|
||||
if (value && value != this._warehouseFk) {
|
||||
this._warehouseFk = value;
|
||||
|
||||
this.$state.go(this.$state.current.name, {
|
||||
warehouseFk: value
|
||||
});
|
||||
this.$state.go(this.$state.current.name, {
|
||||
warehouseFk: value
|
||||
});
|
||||
|
||||
this.filter.where.warehouseFk = value;
|
||||
this.$scope.model.refresh();
|
||||
this.filter.where.warehouseFk = value;
|
||||
this.$scope.model.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
get warehouseFk() {
|
||||
|
@ -64,7 +66,7 @@ class Controller {
|
|||
get onPreparationLineIndex() {
|
||||
let lines = this.$scope.model.data;
|
||||
|
||||
for (let i = this.freeLineIndex; i > 0; i--) {
|
||||
for (let i = this.freeLineIndex; i >= 0; i--) {
|
||||
let line = lines[i];
|
||||
let currentDate = new Date();
|
||||
currentDate.setHours(0, 0, 0);
|
||||
|
@ -73,7 +75,7 @@ class Controller {
|
|||
let isPicked = line.alertLevel == 1 && line.isPicked;
|
||||
|
||||
if ((isPicked) || line.alertLevel > 1 || isPastDate)
|
||||
return i;
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,32 +92,41 @@ class Controller {
|
|||
|
||||
scrollToLine() {
|
||||
let body = this.$window.document.body;
|
||||
|
||||
let lineIndex;
|
||||
if (this.ticketFk)
|
||||
lineIndex = this.givenTicketIndex;
|
||||
else
|
||||
lineIndex = this.onPreparationLineIndex;
|
||||
let selectedTicketLineIndex = this.givenTicketIndex;
|
||||
let lineIndex = this.onPreparationLineIndex;
|
||||
|
||||
let lines = body.querySelector('vn-tbody').children;
|
||||
|
||||
if (!lineIndex || !lines.length) return;
|
||||
if (lineIndex == undefined || !lines.length) return;
|
||||
|
||||
|
||||
let onPreparationLine = lines[lineIndex];
|
||||
|
||||
|
||||
let balance = onPreparationLine.querySelector('.balanceSpan');
|
||||
balance.classList.add('counter');
|
||||
balance.title = this.$translate.instant('Visible quantity');
|
||||
|
||||
let headerOffset = body.querySelector('header').getBoundingClientRect();
|
||||
let headerHeight = headerOffset.height;
|
||||
let offsetTop = onPreparationLine.offsetTop - headerHeight;
|
||||
|
||||
let offsetTop;
|
||||
if (this.ticketFk) {
|
||||
console.log(selectedTicketLineIndex);
|
||||
let selectedTicketLine = lines[selectedTicketLineIndex];
|
||||
let id = selectedTicketLine.querySelector('.id');
|
||||
id.classList.add('counter');
|
||||
offsetTop = selectedTicketLine.offsetTop - headerHeight;
|
||||
} else
|
||||
offsetTop = onPreparationLine.offsetTop - headerHeight;
|
||||
|
||||
body.querySelector('ui-view').scrollTop = offsetTop;
|
||||
|
||||
|
||||
this.ticketFk = null;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Compares a date with the current one
|
||||
* @param {Object} date - Date to compare
|
||||
* @return {Boolean} - Returns true if the two dates equals
|
||||
|
|
|
@ -58,14 +58,14 @@ describe('Item', () => {
|
|||
let currentDate = new Date();
|
||||
currentDate.setDate(currentDate.getDate() + 1);
|
||||
controller.$scope.model = {data: [
|
||||
{name: 'My item 1', alertLevel: 3, isPicked: true, date: '2018-05-02'},
|
||||
{name: 'My item 3', alertLevel: 1, isPicked: true, date: '2018-05-03'},
|
||||
{name: 'My item 4', alertLevel: 1, isPicked: false, date: '2018-05-03'},
|
||||
{name: 'My item 1', alertLevel: 3, isPicked: true, date: currentDate},
|
||||
{name: 'My item 3', alertLevel: 1, isPicked: true, date: currentDate},
|
||||
{name: 'My item 4', alertLevel: 1, isPicked: false, date: currentDate},
|
||||
{name: 'My item 5', alertLevel: 0, isPicked: false, date: currentDate}]
|
||||
};
|
||||
let result = controller.onPreparationLineIndex;
|
||||
|
||||
expect(result).toEqual(2);
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -33,5 +33,5 @@ vn-item-diary {
|
|||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue