diff --git a/client/client/src/greuge-list/greuge-list.html b/client/client/src/greuge-list/greuge-list.html index a361dfbcf..22566ec66 100644 --- a/client/client/src/greuge-list/greuge-list.html +++ b/client/client/src/greuge-list/greuge-list.html @@ -9,20 +9,17 @@ - - {{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }} - {{::greuge.description}} - {{::greuge.amount | number:2}} € - {{::greuge.greugeType.name}} + ng-repeat="greuge in index.model.instances track by greuge.id"> + {{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }} + {{::greuge.description}} + {{::greuge.amount | number:2}} € + {{::greuge.greugeType.name}} - No results @@ -36,3 +33,4 @@ + \ No newline at end of file diff --git a/client/item/src/create/item-create.html b/client/item/src/create/item-create.html index 1a489057d..d57806715 100644 --- a/client/item/src/create/item-create.html +++ b/client/item/src/create/item-create.html @@ -31,12 +31,10 @@ order="description ASC" filter-search="{where: {description: {regexp: 'search'}} }" > - {{$parent.$parent.item.description}} + {{$parent.$parent.item.description}} - - - + - diff --git a/client/item/src/create/item-create.spec.js b/client/item/src/create/item-create.spec.js index bff09cad5..e63265ee7 100644 --- a/client/item/src/create/item-create.spec.js +++ b/client/item/src/create/item-create.spec.js @@ -27,12 +27,6 @@ describe('Item', () => { 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()', () => { it(`should call submit() on the watcher then expect a callback`, () => { spyOn($state, 'go'); diff --git a/client/item/src/history/item-history.html b/client/item/src/history/item-history.html index 032f17033..1a5a65483 100644 --- a/client/item/src/history/item-history.html +++ b/client/item/src/history/item-history.html @@ -1,5 +1,33 @@ - - - Item history + + + + + Item history + + + + + + + + + + {{::itemLog.originFk}} + {{::itemLog.userFk}} + {{::itemLog.action}} + {{::itemLog.creationDate | date:'dd/MM/yyyy HH:mm'}} + {{::itemLog.description}} + + + No results + + + + + + - \ No newline at end of file + diff --git a/client/item/src/locale/en.yml b/client/item/src/locale/en.yml new file mode 100644 index 000000000..03f1b1f7f --- /dev/null +++ b/client/item/src/locale/en.yml @@ -0,0 +1 @@ +Artículo: Items \ No newline at end of file diff --git a/client/item/src/locale/es.yml b/client/item/src/locale/es.yml index d2a302af7..a80590f67 100644 --- a/client/item/src/locale/es.yml +++ b/client/item/src/locale/es.yml @@ -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 \ No newline at end of file +Item barcode: Código de barras del artículo +Changed by: Cambiado por +Action: Acción +Date: Fecha \ No newline at end of file diff --git a/client/production/src/index/index.spec.js b/client/production/src/index/index.spec.js index deb9eedaf..dc9f0d89b 100644 --- a/client/production/src/index/index.spec.js +++ b/client/production/src/index/index.spec.js @@ -26,7 +26,7 @@ describe('Production', () => { it('should request to update the ticket state', () => { let ids = [1, 2, 3, 4]; let stateId = 1; - let stateName = 'the state!'; + let stateName = 'state'; let index = []; controller.tickets = ['ticketVal']; $httpBackend.whenPUT('/production/api/TicketStates/1/changeState', {tickets: ids}).respond({data: 'ticketVal'}); diff --git a/services/db/01-titemLog.sql b/services/db/01-titemLog.sql new file mode 100644 index 000000000..cab6c3d19 --- /dev/null +++ b/services/db/01-titemLog.sql @@ -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; diff --git a/services/db/02-fixtures.sql b/services/db/02-fixtures.sql index 7721c6313..9cf4deeec 100644 --- a/services/db/02-fixtures.sql +++ b/services/db/02-fixtures.sql @@ -619,3 +619,7 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`) (3, 1, 3, 'round', 3), (4, 1, 4, 'Gamoras hideout', 2), (5, 1, 5, 'Gamora', 1); + +INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`) + VALUES + ('1', '1', '1', 'insert', 'We made an change!'); \ No newline at end of file diff --git a/services/item/common/methods/item/getLog.js b/services/item/common/methods/item/getLog.js new file mode 100644 index 000000000..50d563c08 --- /dev/null +++ b/services/item/common/methods/item/getLog.js @@ -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]); + }; +}; diff --git a/services/item/common/models/item.js b/services/item/common/models/item.js index 2c193b587..3cbc622bd 100644 --- a/services/item/common/models/item.js +++ b/services/item/common/models/item.js @@ -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'});