item history js files implementation
This commit is contained in:
parent
8de88aa046
commit
93ef3c7fea
|
@ -1,5 +1,33 @@
|
|||
<vn-card>
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Item history</vn-title>
|
||||
<mg-ajax path="/item/api/items/1/getLog"></mg-ajax>
|
||||
<!-- <mg-ajax path="/item/api/history/{{edit.params.id}}/sumAmount" options="mgEdit"></mg-ajax> -->
|
||||
<vn-card pad-medium>
|
||||
<vn-vertical pad-medium>
|
||||
<vn-title vn-one margin-large-bottom>Item history</vn-title>
|
||||
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
||||
<vn-column-header vn-one pad-medium-h field="originFk" text="Origin"></vn-column-header>
|
||||
<vn-column-header vn-two pad-medium-h field="userFk" text="Changed by"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="action" text="Action"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="creationDate" text="Date"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="description" text="Description"></vn-column-header>
|
||||
</vn-grid-header>
|
||||
<vn-one class="list list-content">
|
||||
<vn-horizontal
|
||||
class="list list-element text-center"
|
||||
pad-small-bottom
|
||||
ng-repeat="itemLog in index.model.instances track by itemLog.id">
|
||||
<vn-one pad-medium-h>{{::itemLog.originFk}}</vn-one>
|
||||
<vn-two pad-medium-h>{{::itemLog.userFk}}</vn-two>
|
||||
<vn-one pad-medium-h>{{::itemLog.action}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::itemLog.creationDate | date:'dd/MM/yyyy HH:mm'}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::itemLog.description}}</vn-one>
|
||||
</vn-horizontal>
|
||||
</vn-one>
|
||||
<vn-one class="text-center pad-small-v" ng-if="index.model.count === 0" translate>No results</vn-one>
|
||||
<vn-horizontal vn-one class="list list-footer text-center">
|
||||
<vn-one pad-medium-h></vn-one>
|
||||
<vn-two pad-medium-h></vn-two>
|
||||
<vn-one pad-medium-h></vn-one>
|
||||
</vn-horizontal>
|
||||
<vn-paging margin-large-top vn-one index="index" total="index.model.count"></vn-paging>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
|
@ -16,3 +16,6 @@ Picture: Foto
|
|||
Item pictures: Fotos del artículo
|
||||
Barcode: Código barras
|
||||
Item barcode: Código de barras del artículo
|
||||
Changed by: Cambiado por
|
||||
Action: Acción
|
||||
Date: Fecha
|
|
@ -0,0 +1,27 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('itemLog', {
|
||||
description: 'Returns the item changes log',
|
||||
accessType: 'READ',
|
||||
accepts: [{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The item id',
|
||||
http: {source: 'path'}
|
||||
}],
|
||||
returns: {
|
||||
arg: 'data',
|
||||
type: ['Object'],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/:id/itemLog`,
|
||||
verb: 'get'
|
||||
}
|
||||
});
|
||||
|
||||
Self.itemLog = itemFk => {
|
||||
let query = `SELECT * FROM vn.itemLog WHERE itemFk = ?`;
|
||||
return Self.rawSql(query, [itemFk]);
|
||||
};
|
||||
};
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/item/filter.js')(Self);
|
||||
require('../methods/item/getLog.js')(Self);
|
||||
|
||||
Self.validatesPresenceOf('name', {message: 'Cannot be blank'});
|
||||
Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'});
|
||||
|
|
Loading…
Reference in New Issue