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

This commit is contained in:
Daniel Herrero 2018-02-07 09:54:43 +01:00
commit 4a9856dd5a
11 changed files with 100 additions and 25 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="amount" text="Amount"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="greugeTypeFk" text="Type"></vn-column-header> <vn-column-header vn-one pad-medium-h field="greugeTypeFk" text="Type"></vn-column-header>
</vn-grid-header> </vn-grid-header>
<vn-one class="list list-content"> <vn-one class="list list-content">
<vn-horizontal <vn-horizontal
class="list list-element text-center" class="list list-element text-center"
pad-small-bottom pad-small-bottom
ng-repeat="greuge in index.model.instances track by greuge.id" 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-one pad-medium-h>{{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}</vn-one>
<vn-two pad-medium-h>{{::greuge.description}}</vn-two> <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.amount | number:2}} €</vn-one>
<vn-one pad-medium-h>{{::greuge.greugeType.name}}</vn-one> <vn-one pad-medium-h>{{::greuge.greugeType.name}}</vn-one>
</vn-horizontal> </vn-horizontal>
</vn-one> </vn-one>
<vn-one class="text-center pad-small-v" ng-if="index.model.count === 0" translate>No results</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-horizontal vn-one class="list list-footer text-center">
<vn-one pad-medium-h></vn-one> <vn-one pad-medium-h></vn-one>
@ -36,3 +33,4 @@
<a ui-sref="clientCard.greuge.create" fixed-bottom-right> <a ui-sref="clientCard.greuge.create" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button> <vn-float-button icon="add"></vn-float-button>
</a> </a>

View File

@ -34,9 +34,7 @@
<tpl-item>{{$parent.$parent.item.description}}</tpl-item> <tpl-item>{{$parent.$parent.item.description}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield> <vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="/item/api/Origins" url="/item/api/Origins"
@ -45,9 +43,13 @@
value-field="id" value-field="id"
field="$ctrl.item.originFk" field="$ctrl.item.originFk"
></vn-autocomplete> ></vn-autocomplete>
<vn-one></vn-one> <vn-autocomplete vn-one
url="/item/api/Expences"
label="Expence"
field="$ctrl.item.expenceFk"
initial-data="$ctrl.item.expence"
></vn-autocomplete>
</vn-horizontal> </vn-horizontal>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>

View File

@ -27,12 +27,6 @@ describe('Item', () => {
controller = $componentController('vnItemCreate', {$scope: $scope}); controller = $componentController('vnItemCreate', {$scope: $scope});
})); }));
it('should define and set scope, state and item properties', () => {
expect(controller.$).toEqual($scope);
expect(controller.$state).toEqual($state);
expect(controller.item).toEqual({relevancy: 0});
});
describe('onSubmit()', () => { describe('onSubmit()', () => {
it(`should call submit() on the watcher then expect a callback`, () => { it(`should call submit() on the watcher then expect a callback`, () => {
spyOn($state, 'go'); spyOn($state, 'go');

View File

@ -1,5 +1,33 @@
<vn-card> <mg-ajax path="/item/api/items/1/getLog"></mg-ajax>
<vn-vertical pad-large> <!-- <mg-ajax path="/item/api/history/{{edit.params.id}}/sumAmount" options="mgEdit"></mg-ajax> -->
<vn-title>Item history</vn-title> <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-vertical>
</vn-card> </vn-card>

View File

@ -0,0 +1 @@
Artículo: Items

View File

@ -16,3 +16,6 @@ Picture: Foto
Item pictures: Fotos del artículo Item pictures: Fotos del artículo
Barcode: Código barras 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

@ -26,7 +26,7 @@ describe('Production', () => {
it('should request to update the ticket state', () => { it('should request to update the ticket state', () => {
let ids = [1, 2, 3, 4]; let ids = [1, 2, 3, 4];
let stateId = 1; let stateId = 1;
let stateName = 'the state!'; let stateName = 'state';
let index = []; let index = [];
controller.tickets = ['ticketVal']; controller.tickets = ['ticketVal'];
$httpBackend.whenPUT('/production/api/TicketStates/1/changeState', {tickets: ids}).respond({data: 'ticketVal'}); $httpBackend.whenPUT('/production/api/TicketStates/1/changeState', {tickets: ids}).respond({data: 'ticketVal'});

View File

@ -0,0 +1,17 @@
CREATE TABLE vn.itemLog
SELECT * FROM vn.entryLog LIMIT 0;
ALTER TABLE `vn`.`itemLog`
ADD INDEX `itemLogItemFk_idx` (`originFk` ASC),
ADD INDEX `itemLogUserFk_idx` (`userFk` ASC);
ALTER TABLE `vn`.`itemLog`
ADD CONSTRAINT `itemLogItemFk`
FOREIGN KEY (`originFk`)
REFERENCES `vn2008`.`Articles` (`Id_Article`)
ON DELETE NO ACTION
ON UPDATE CASCADE,
ADD CONSTRAINT `itemLogUserFk`
FOREIGN KEY (`userFk`)
REFERENCES `account`.`user` (`id`)
ON DELETE NO ACTION
ON UPDATE CASCADE;

View File

@ -619,3 +619,7 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
(3, 1, 3, 'round', 3), (3, 1, 3, 'round', 3),
(4, 1, 4, 'Gamoras hideout', 2), (4, 1, 4, 'Gamoras hideout', 2),
(5, 1, 5, 'Gamora', 1); (5, 1, 5, 'Gamora', 1);
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) { module.exports = function(Self) {
require('../methods/item/filter.js')(Self); require('../methods/item/filter.js')(Self);
require('../methods/item/getLog.js')(Self);
Self.validatesPresenceOf('name', {message: 'Cannot be blank'}); Self.validatesPresenceOf('name', {message: 'Cannot be blank'});
Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'}); Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'});