Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Juan Ferrer Toribio 2018-02-07 10:29:27 +01:00
commit fda8750304
7 changed files with 77 additions and 16 deletions

View File

@ -9,20 +9,17 @@
<vn-column-header vn-one pad-medium-h field="amount" text="Amount"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="greugeTypeFk" text="Type"></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="greuge in index.model.instances track by greuge.id"
>
<vn-one pad-medium-h>{{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}</vn-one>
<vn-two pad-medium-h>{{::greuge.description}}</vn-two>
<vn-one pad-medium-h>{{::greuge.amount | number:2}} €</vn-one>
<vn-one pad-medium-h>{{::greuge.greugeType.name}}</vn-one>
ng-repeat="greuge in index.model.instances track by greuge.id">
<vn-one pad-medium-h>{{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}</vn-one>
<vn-two pad-medium-h>{{::greuge.description}}</vn-two>
<vn-one pad-medium-h>{{::greuge.amount | number:2}} €</vn-one>
<vn-one pad-medium-h>{{::greuge.greugeType.name}}</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>
@ -36,3 +33,4 @@
<a ui-sref="clientCard.greuge.create" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>

View File

@ -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>
</vn-card>

View File

@ -15,4 +15,7 @@ Niche: Nicho
Picture: Foto
Item pictures: Fotos del artículo
Barcode: Código barras
Item barcode: Código de barras del artículo
Item barcode: Código de barras del artículo
Changed by: Cambiado por
Action: Acción
Date: Fecha

View File

@ -186,6 +186,10 @@ gulp.task('nginx-stop', ['nginx-conf'], async () => {
gulp.task('nginx-conf', async () => {
const mustache = require('mustache');
if (!fs.existsSync(nginxTemp)) {
fs.mkdirSync(nginxTemp);
}
let params = {
services: await getServices(),
defaultService: defaultService,
@ -203,12 +207,12 @@ gulp.task('nginx-conf', async () => {
let template = await fs.readFile(confFile, 'utf8');
let nginxConf = mustache.render(template, params);
await fs.writeFile(`${nginxDir}/temp/nginx.conf`, nginxConf);
await fs.writeFile(`${nginxTemp}/nginx.conf`, nginxConf);
});
gulp.task('nginx-clean', () => {
const del = require('del');
return del([`${nginxDir}/temp/*`], {force: true});
return del([`${nginxTemp}/*`], {force: true});
});
let services;

View File

@ -620,6 +620,6 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
(4, 1, 4, 'Gamoras hideout', 2),
(5, 1, 5, 'Gamora', 1);
INSERT INTO `vn`.`clientLog` (`id`, `originFk`, `userFk`, `action`, `description`)
INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`)
VALUES
('1', '1', '1', 'insert', 'We made an change!');

View File

@ -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]);
};
};

View File

@ -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'});