Tarea #333 Ultimas Entradas
This commit is contained in:
parent
eebb19cceb
commit
42eacd4905
|
@ -121,6 +121,18 @@
|
|||
"icon": "icon-transaction"
|
||||
},
|
||||
"acl": ["employee"]
|
||||
}, {
|
||||
"url" : "/last-entries",
|
||||
"state": "item.card.last-entries",
|
||||
"component": "vn-item-last-entries",
|
||||
"params": {
|
||||
"item": "$ctrl.item"
|
||||
},
|
||||
"menu": {
|
||||
"description": "Last entries",
|
||||
"icon": "icon-transaction"
|
||||
},
|
||||
"acl": ["employee"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -11,6 +11,7 @@ import './data';
|
|||
import './tags';
|
||||
import './tax';
|
||||
import './history';
|
||||
import './last-entries';
|
||||
import './niche';
|
||||
import './botanical';
|
||||
import './barcode';
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<vn-vertical>
|
||||
<vn-card pad-large>
|
||||
<vn-vertical>
|
||||
<vn-title>Last entries</vn-title>
|
||||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Since"
|
||||
model="$ctrl.entriesDate"
|
||||
ini-options="{dateFormat: 'd-m-Y'}">
|
||||
</vn-date-picker>
|
||||
<!--datepicker-->
|
||||
</vn-horizontal>
|
||||
<table class="vn-grid">
|
||||
<thead>
|
||||
<tr>
|
||||
<th number vn-tooltip="Ignored">Ig</th>
|
||||
<th number translate>Warehouse</th>
|
||||
<th number translate>Landed</th>
|
||||
<th number translate>Entry</th>
|
||||
<th number vn-tooltip="Price Per Unit">P.P.U</th>
|
||||
<th number vn-tooltip="Price Per Package">P.P.P</th>
|
||||
<th number class="expendable" translate>Label</th>
|
||||
<th number>Packing</th>
|
||||
<th number>Grouping</th>
|
||||
<th number class="expendable" translate>Stems</th>
|
||||
<th number translate>Quantity</th>
|
||||
<th number class="expendable" translate>Cost</th>
|
||||
<th number translate>Cube</th>
|
||||
<th number class="expendable" translate>Provider</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="entries in $ctrl.entries">
|
||||
<td number>
|
||||
<vn-check
|
||||
field="entries.isIgnored"
|
||||
disabled="true">
|
||||
</vn-check>
|
||||
</td>
|
||||
<td number>{{entries.warehouse| dashIfEmpty}}</td>
|
||||
<td number>{{entries.landed | date:'dd/MM/yyyy HH:mm'}}</td>
|
||||
<td number>{{entries.entryFk | dashIfEmpty}}</td>
|
||||
<td number>{{entries.price2 | dashIfEmpty}}</td>
|
||||
<td number>{{entries.price3 | dashIfEmpty}}</td>
|
||||
<td number class="expendable">{{entries.stickers | dashIfEmpty}}</td>
|
||||
<td number>
|
||||
<div ng-class="{'round': entries.groupingMode == 2}">{{entries.packing | dashIfEmpty}}</div>
|
||||
</td>
|
||||
<td number>
|
||||
<div ng-class="{'round': entries.groupingMode == 1}">{{entries.grouping | dashIfEmpty}}</div>
|
||||
</td>
|
||||
<td number class="expendable">{{entries.stems | dashIfEmpty}}</td>
|
||||
<td number>{{entries.quantity}}</td>
|
||||
<td number class="expendable">{{entries.buyingValue | dashIfEmpty}}</td>
|
||||
<td number>{{entries.packageFk | dashIfEmpty}}</td>
|
||||
<td number class="expendable">{{entries.supplier | dashIfEmpty}}</td>
|
||||
</tr>
|
||||
<tr ng-if="$ctrl.entries.length === 0" class="list list-element">
|
||||
<td colspan="14" style="text-align: center" translate>No results</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
<vn-paging margin-large-top vn-one index="$ctrl.entries" total="$ctrl.entries.count"></vn-paging>
|
||||
<!-- <vn-auto-paging margin-large-top vn-one index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
|
||||
</vn-vertical>
|
|
@ -0,0 +1,58 @@
|
|||
import ngModule from '../module';
|
||||
import './style.scss';
|
||||
|
||||
class Controller {
|
||||
constructor($scope, $http) {
|
||||
this.$ = $scope;
|
||||
this.$http = $http;
|
||||
this.entries = [];
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this._defaultEntriesDate();
|
||||
}
|
||||
|
||||
set item(value) {
|
||||
this._item = value;
|
||||
this._getLastEntries(this.entriesDate);
|
||||
}
|
||||
|
||||
get item() {
|
||||
return this._item;
|
||||
}
|
||||
|
||||
_defaultEntriesDate() {
|
||||
let defaultDate;
|
||||
defaultDate = new Date();
|
||||
defaultDate.setDate(defaultDate.getDate() - 75);
|
||||
this.entriesDate = defaultDate;
|
||||
}
|
||||
|
||||
set entriesDate(value) {
|
||||
this._entriesDate = value;
|
||||
this._getLastEntries(value);
|
||||
}
|
||||
|
||||
get entriesDate() {
|
||||
return this._entriesDate;
|
||||
}
|
||||
|
||||
_getLastEntries(entriesDate) {
|
||||
if (!entriesDate || !this.item)
|
||||
return;
|
||||
let filter = {itemFk: this.item.id, date: entriesDate};
|
||||
this.$http.get(`/item/api/Items/getLastEntries?filter=${JSON.stringify(filter)}`).then(res => {
|
||||
this.entries = res.data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$http'];
|
||||
|
||||
ngModule.component('vnItemLastEntries', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
item: '<'
|
||||
}
|
||||
});
|
|
@ -0,0 +1,13 @@
|
|||
Last entries: Últimas entradas
|
||||
Since: Desde
|
||||
Landed: Llegada
|
||||
Stems: Tallos
|
||||
Quantity: Cantidad
|
||||
Cost: Coste
|
||||
Label: Etiquetas
|
||||
Entry: Entrada
|
||||
Ignored: Ignorado
|
||||
Provider: Proveedor
|
||||
Cube: Cubo
|
||||
Price Per Unit: Precio Por Unidad
|
||||
Price Per Package: Precio Por Paquete
|
|
@ -0,0 +1,26 @@
|
|||
@import "colors";
|
||||
vn-item-last-entries {
|
||||
.round {
|
||||
background-color: $lines;
|
||||
border-radius: 25px;
|
||||
float: right;
|
||||
width: 25px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
& vn-horizontal {
|
||||
justify-content: center;
|
||||
}
|
||||
& vn-date-picker {
|
||||
flex: none!important;
|
||||
& .mdl-textfield{
|
||||
width: 400px!important;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 1440px) {
|
||||
.expendable{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getLastEntries', {
|
||||
description: 'Returns last entries',
|
||||
accessType: 'READ',
|
||||
accepts: [{
|
||||
arg: 'filter',
|
||||
type: 'object',
|
||||
required: true,
|
||||
description: 'itemFk, id'
|
||||
}],
|
||||
returns: {
|
||||
type: 'Array',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/getLastEntries`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.getLastEntries = async filter => {
|
||||
let query = `CALL vn.itemLastEntries(?, ?)`;
|
||||
let [lastEntries] = await Self.rawSql(query, [filter.itemFk, filter.date]);
|
||||
return lastEntries;
|
||||
};
|
||||
};
|
|
@ -4,6 +4,7 @@ module.exports = Self => {
|
|||
require('../methods/item/clone')(Self);
|
||||
require('../methods/item/updateTaxes')(Self);
|
||||
require('../methods/item/getDiary')(Self);
|
||||
require('../methods/item/getLastEntries')(Self);
|
||||
|
||||
Self.validatesPresenceOf('name', {message: 'Cannot be blank'});
|
||||
Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'});
|
||||
|
|
Loading…
Reference in New Issue