item history
This commit is contained in:
parent
93ef3c7fea
commit
de9f7a5545
|
@ -1,5 +1,4 @@
|
|||
<mg-ajax path="/item/api/items/1/getLog"></mg-ajax>
|
||||
<!-- <mg-ajax path="/item/api/history/{{edit.params.id}}/sumAmount" options="mgEdit"></mg-ajax> -->
|
||||
<mg-ajax path="/item/api/Items/getLog" options="vnIndex"></mg-ajax>
|
||||
<vn-card pad-medium>
|
||||
<vn-vertical pad-medium>
|
||||
<vn-title vn-one margin-large-bottom>Item history</vn-title>
|
||||
|
@ -22,12 +21,10 @@
|
|||
<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>
|
||||
|
|
|
@ -1,27 +1,13 @@
|
|||
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.installMethod('getLog', filterParams);
|
||||
|
||||
Self.itemLog = itemFk => {
|
||||
let query = `SELECT * FROM vn.itemLog WHERE itemFk = ?`;
|
||||
return Self.rawSql(query, [itemFk]);
|
||||
function filterParams(params) {
|
||||
return {
|
||||
where: {
|
||||
itemFk: params.itemFk
|
||||
},
|
||||
skip: (params.page - 1) * params.size,
|
||||
limit: params.size
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/item/getLog.js')(Self);
|
||||
};
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "ItemLog",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "itemLog",
|
||||
"database": "vn"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"creationDate": {
|
||||
"type": "Date"
|
||||
},
|
||||
"description": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"originFk": {
|
||||
"type": "belongsTo",
|
||||
"model": "Origin",
|
||||
"foreignKey": "originFk"
|
||||
},
|
||||
"userFk": {
|
||||
"type": "belongsTo",
|
||||
"model": "User",
|
||||
"foreignKey": "userFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,5 +34,8 @@
|
|||
},
|
||||
"Tag": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ItemLog": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,4 +36,3 @@ jasmine.addReporter(new SpecReporter({
|
|||
}));
|
||||
|
||||
jasmine.execute();
|
||||
|
||||
|
|
Loading…
Reference in New Issue