Tarea #646 Mejoras Historico

This commit is contained in:
Gerard 2018-10-05 15:53:31 +02:00
parent 427d702a8e
commit aeb774571e
3 changed files with 61 additions and 14 deletions

View File

@ -16,15 +16,14 @@
value-field="id"
initial-data="$ctrl.warehouseFk"
field="$ctrl.warehouseFk"
label="Select warehouse"
on-change="$ctrl.onChange(value)">
label="Select warehouse">
</vn-autocomplete>
</vn-horizontal>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th>Date</vn-th>
<vn-th number>Id</vn-th>
<vn-th number order="DESC">Id</vn-th>
<vn-th>State</vn-th>
<vn-th>Reference</vn-th>
<vn-th>Client</vn-th>
@ -34,9 +33,9 @@
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-class="::{'warning': $ctrl.isToday(sale.date)}"
ng-repeat="sale in sales" vn-repeat-last on-last="$ctrl.scrollToActive()">
<vn-td>{{::sale.date | date:'dd/MM/yyyy HH:mm' }}</vn-td>
<vn-tr ng-class="::{'warning': $ctrl.isToday(sale.date), 'isIn': sale.in, 'balanceNegative': sale.balance < 0}"
ng-repeat="sale in sales" vn-repeat-last on-last="$ctrl.scrollToLine()">
<vn-td>{{::sale.date | date:'dd/MM/yyyy' }}</vn-td>
<vn-td number>
<span ng-class="::{'link pointer': sale.isTicket}"
ng-click="$ctrl.showDescriptor($event, sale)">
@ -45,16 +44,17 @@
</vn-td>
<vn-td>{{::sale.stateName | dashIfEmpty}}</vn-td>
<vn-td>{{::sale.reference | dashIfEmpty}}</vn-td>
<vn-td>
<span ng-class="::{'link pointer': sale.isTicket}"
<vn-td class="truncate">
<span
ng-class="::{'link pointer': sale.isTicket}"
ng-click="$ctrl.showClientDescriptor($event, sale)">
{{::sale.name | dashIfEmpty}}
</span>
</vn-td>
<vn-td number>{{::sale.in | dashIfEmpty}}</vn-td>
<vn-td number class="in">{{::sale.in | dashIfEmpty}}</vn-td>
<vn-td number>{{::sale.out | dashIfEmpty}}</vn-td>
<vn-td number>
<span class="balance">
<vn-td number class="balance">
<span class="balanceSpan">
{{::sale.balance | dashIfEmpty}}
</span>
</vn-td>

View File

@ -27,6 +27,9 @@ class Controller {
this.warehouseFk = this.$stateParams.warehouseFk;
else if (value)
this.warehouseFk = value.itemType.warehouseFk;
if (this.$stateParams.ticketFk)
this.ticketFk = this.$stateParams.ticketFk;
});
}
@ -74,16 +77,33 @@ class Controller {
}
}
scrollToActive() {
get givenTicketIndex() {
let lines = this.$scope.model.data;
for (let i = lines.length - 1; i > 0; i--) {
let line = lines[i];
if (line.origin == this.ticketFk)
return i;
}
}
scrollToLine() {
let body = this.$window.document.body;
let lineIndex = this.onPreparationLineIndex;
let lineIndex;
if (this.ticketFk)
lineIndex = this.givenTicketIndex;
else
lineIndex = this.onPreparationLineIndex;
let lines = body.querySelector('vn-tbody').children;
if (!lineIndex || !lines.length) return;
let onPreparationLine = lines[lineIndex];
let balance = onPreparationLine.querySelector('.balance');
let balance = onPreparationLine.querySelector('.balanceSpan');
balance.classList.add('counter');
balance.title = this.$translate.instant('Visible quantity');
@ -92,6 +112,7 @@ class Controller {
let offsetTop = onPreparationLine.offsetTop - headerHeight;
body.querySelector('ui-view').scrollTop = offsetTop;
this.ticketFk = null;
}
/**

View File

@ -1,8 +1,34 @@
@import 'colors';
vn-item-diary {
& > vn-vertical {
display: block;
}
vn-card {
margin: auto;
max-width: 880px;
}
& vn-horizontal {
justify-content: center;
}
& vn-autocomplete > div{
width: 400px;
}
.balanceNegative .balance {
background-color: $main-01;
color: white;
}
.isIn .in {
background-color: $main-02;
color: white;
}
.truncate {
max-width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}