diff --git a/back/nodemonConfig.json b/back/nodemonConfig.json
index a1c9ca84f..5138bc30e 100644
--- a/back/nodemonConfig.json
+++ b/back/nodemonConfig.json
@@ -18,6 +18,7 @@
"modules/supplier/front/**/*",
"modules/ticket/front/**/*",
"modules/travel/front/**/*",
+ "modules/shelving/front/**/*",
"modules/worker/front/**/*",
"modules/zone/front/**/*"
]
diff --git a/db/changes/10480-june/00-aclShelvingLog.sql b/db/changes/10480-june/00-aclShelvingLog.sql
new file mode 100644
index 000000000..dc75142d1
--- /dev/null
+++ b/db/changes/10480-june/00-aclShelvingLog.sql
@@ -0,0 +1,3 @@
+INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
+ VALUES
+ ('ShelvingLog','*','READ','ALLOW','ROLE','employee');
\ No newline at end of file
diff --git a/db/changes/10480-june/00-shelving.sql b/db/changes/10480-june/00-shelving.sql
new file mode 100644
index 000000000..c66d164c4
--- /dev/null
+++ b/db/changes/10480-june/00-shelving.sql
@@ -0,0 +1,18 @@
+ALTER TABLE `vn`.`itemShelving` DROP FOREIGN KEY itemShelving_fk2;
+ALTER TABLE `vn`.`shelvingLog` DROP FOREIGN KEY shelvingLog_FK_ibfk_1;
+ALTER TABLE `vn`.`smartTag` DROP FOREIGN KEY smartTag_shelving_fk;
+ALTER TABLE `vn`.`workerShelving` DROP FOREIGN KEY workerShelving_shelving_fk;
+
+ALTER TABLE `vn`.`shelving` DROP PRIMARY KEY;
+ALTER TABLE `vn`.`shelving` ADD id INT auto_increment PRIMARY KEY NULL;
+ALTER TABLE `vn`.`shelving` CHANGE id id int(11) auto_increment NOT NULL FIRST;
+ALTER TABLE `vn`.`shelving` ADD CONSTRAINT shelving_UN UNIQUE KEY (code);
+
+ALTER TABLE `vn`.`itemShelving` ADD CONSTRAINT itemShelving_fk2 FOREIGN KEY (shelvingFk) REFERENCES `vn`.`shelving`(code) ON DELETE CASCADE ON UPDATE CASCADE;
+ALTER TABLE `vn`.`shelvingLog` ADD CONSTRAINT shelvingLog_FK_ibfk_1 FOREIGN KEY (originFk) REFERENCES `vn`.`shelving`(code) ON DELETE CASCADE ON UPDATE CASCADE;
+ALTER TABLE `vn`.`smartTag` ADD CONSTRAINT smartTag_FK FOREIGN KEY (shelvingFk) REFERENCES `vn`.`shelving`(code) ON DELETE RESTRICT ON UPDATE CASCADE;
+ALTER TABLE `vn`.`workerShelving` ADD CONSTRAINT workerShelving_FK_1 FOREIGN KEY (shelvingFk) REFERENCES `vn`.`shelving`(code) ON DELETE RESTRICT ON UPDATE CASCADE;
+
+ALTER TABLE vn.shelvingLog DROP FOREIGN KEY shelvingLog_FK_ibfk_1;
+ALTER TABLE vn.shelvingLog MODIFY COLUMN originFk INT NOT NULL;
+ALTER TABLE vn.shelvingLog ADD CONSTRAINT shelvingLog_FK FOREIGN KEY (originFk) REFERENCES vn.shelving(id) ON DELETE CASCADE ON UPDATE CASCADE;
\ No newline at end of file
diff --git a/db/changes/10480-june/04-aclParking.sql b/db/changes/10480-june/04-aclParking.sql
new file mode 100644
index 000000000..05acd68b1
--- /dev/null
+++ b/db/changes/10480-june/04-aclParking.sql
@@ -0,0 +1,2 @@
+INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
+ VALUES ('Parking','*','*','ALLOW','ROLE','employee')
\ No newline at end of file
diff --git a/db/changes/10480-june/04-aclShelving.sql b/db/changes/10480-june/04-aclShelving.sql
new file mode 100644
index 000000000..b237dfe0d
--- /dev/null
+++ b/db/changes/10480-june/04-aclShelving.sql
@@ -0,0 +1,2 @@
+INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
+ VALUES ('Shelving','*','*','ALLOW','ROLE','employee')
\ No newline at end of file
diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index 21a3b8faa..e7232edd3 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -155,14 +155,29 @@ INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPrepare
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
VALUES
- ('1', '700', '01', '1', '700-01', '70001'),
- ('2', '700', '02', '2', '700-02', '70002');
+ ('1', 700, '01', 1, '700-01', 70001),
+ ('2', 700, '02', 2, '700-02', 70002),
+ ('3', 100, '01', 1, '100-01', 1),
+ (32397, 100, '02', 1, 'A-47-1', 1165),
+ (34831, 200, '01', 1, 'K-26-2', 20220),
+ (34965, 200, '02', 2, 'L-08-4', 21800),
+ (39096, 200, '03', 2, 'LR-02-3', 99999);
-INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `parked`, `userFk`)
+INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `userFk`, `isRecyclable`)
VALUES
- ('GVC', 1, 0, 1, 0, 1106),
- ('HEJ', 2, 0, 1, 0, 1106),
- ('UXN', 1, 0, 1, 0, 1106);
+ ('AA6', 34965, 1, 0, NULL, 0),
+ ('AA7', 34965, 1, 0, NULL, 0),
+ ('AA8', 34965, 1, 0, NULL, 0),
+ ('AA9', NULL, 1, 0, NULL, 0),
+ ('AAA', NULL, 0, 0, 1109, 1),
+ ('AAB', NULL, 0, 0, 1109, 1),
+ ('AAC', NULL, 1, 99, 1109, 1),
+ ('AAD', NULL, 0, 0, 1109, 1),
+ ('AAE', 39096, 1, 0, 1109, 1),
+ ('AAF', 34831, 1, 0, 1109, 1),
+ ('GVC', 1, 0, 1, 1106, 1),
+ ('HEJ', 2, 0, 1, 1106, 1),
+ ('UXN', 1, 0, 1, 1106, 1);
INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`, `daysInFuture`)
VALUES
@@ -1137,6 +1152,9 @@ INSERT INTO `vn`.`ticketCollection`(`ticketFk`, `collectionFk`, `level`)
(3, 2, NULL),
(23, 1, NULL);
+INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `level`)
+ VALUES
+ (1, 1, 1);
INSERT INTO `vn`.`parking` (`column`, `row`, `sectorFk`, `code`, `pickingOrder`)
VALUES
('100', '01', 1, '100-01', 1);
diff --git a/front/module-import.js b/front/module-import.js
index ab1eb73d6..bc547deeb 100755
--- a/front/module-import.js
+++ b/front/module-import.js
@@ -21,6 +21,7 @@ export default function moduleImport(moduleName) {
case 'entry' : return import('entry/front');
case 'account' : return import('account/front');
case 'supplier' : return import('supplier/front');
+ case 'shelving' : return import('shelving/front');
case 'monitor' : return import('monitor/front');
}
}
diff --git a/jest-front.js b/jest-front.js
index 7a692f57c..6d7532260 100644
--- a/jest-front.js
+++ b/jest-front.js
@@ -13,6 +13,7 @@ import './modules/route/front/module.js';
import './modules/ticket/front/module.js';
import './modules/travel/front/module.js';
import './modules/worker/front/module.js';
+import './modules/shelving/front/module.js';
core.run(vnInterceptor => {
vnInterceptor.setApiPath(null);
diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json
index b395b102a..c7462e46c 100644
--- a/modules/client/front/routes.json
+++ b/modules/client/front/routes.json
@@ -37,7 +37,7 @@
{"state": "client.card.unpaid", "icon": "icon-defaulter"}
]
}
- ]
+ ]
},
"keybindings": [
{"key": "c", "state": "client.index"}
diff --git a/modules/shelving/back/methods/shelving/getSummary.js b/modules/shelving/back/methods/shelving/getSummary.js
new file mode 100644
index 000000000..da357c7bf
--- /dev/null
+++ b/modules/shelving/back/methods/shelving/getSummary.js
@@ -0,0 +1,52 @@
+module.exports = Self => {
+ Self.remoteMethod('getSummary', {
+ description: 'Returns the shelving summary',
+ accessType: 'READ',
+ accepts: {
+ arg: 'code',
+ type: 'string',
+ required: true,
+ description: 'The shelving code',
+ http: {source: 'path'}
+ },
+ returns: {
+ type: 'object',
+ root: true
+ },
+ http: {
+ path: `/:code/getSummary`,
+ verb: 'GET'
+ }
+ });
+ Self.getSummary = async code => {
+ let filter = {
+ where: {code: code},
+ fields: [
+ 'code',
+ 'parkingFk',
+ 'priority',
+ 'userFk',
+ 'isRecyclable'
+ ],
+ include: [
+ {
+ relation: 'parking'
+ },
+ {
+ relation: 'worker',
+ scope: {
+ fields: ['id', 'userFk'],
+ include: {
+ relation: 'user',
+ scope: {
+ fields: ['id', 'nickname']
+ }
+ }
+ }
+ }
+ ]
+ };
+
+ return Self.app.models.Shelving.findOne(filter);
+ };
+};
diff --git a/modules/shelving/back/model-config.json b/modules/shelving/back/model-config.json
new file mode 100644
index 000000000..b5619d8c5
--- /dev/null
+++ b/modules/shelving/back/model-config.json
@@ -0,0 +1,11 @@
+{
+ "Parking": {
+ "dataSource": "vn"
+ },
+ "Shelving": {
+ "dataSource": "vn"
+ },
+ "ShelvingLog": {
+ "dataSource": "vn"
+ }
+}
diff --git a/modules/shelving/back/models/parking.json b/modules/shelving/back/models/parking.json
new file mode 100644
index 000000000..7efcf72d3
--- /dev/null
+++ b/modules/shelving/back/models/parking.json
@@ -0,0 +1,33 @@
+{
+ "name": "Parking",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "parking"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "column": {
+ "type": "string",
+ "required": true
+ },
+ "row": {
+ "type": "string",
+ "required": true
+ },
+ "sectorFk": {
+ "type": "number"
+ },
+ "code": {
+ "type": "string"
+ },
+ "pickingOrder": {
+ "type": "number"
+ }
+ }
+}
diff --git a/modules/shelving/back/models/shelving-log.json b/modules/shelving/back/models/shelving-log.json
new file mode 100644
index 000000000..a2267394e
--- /dev/null
+++ b/modules/shelving/back/models/shelving-log.json
@@ -0,0 +1,58 @@
+{
+ "name": "ShelvingLog",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "shelvingLog"
+ }
+ },
+ "properties": {
+ "id": {
+ "id": true,
+ "type": "number",
+ "forceId": false
+ },
+ "originFk": {
+ "type": "number",
+ "required": true
+ },
+ "userFk": {
+ "type": "number"
+ },
+ "action": {
+ "type": "string",
+ "required": true
+ },
+ "changedModel": {
+ "type": "string"
+ },
+ "oldInstance": {
+ "type": "object"
+ },
+ "newInstance": {
+ "type": "object"
+ },
+ "creationDate": {
+ "type": "date"
+ },
+ "changedModelId": {
+ "type": "number"
+ },
+ "changedModelValue": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "relations": {
+ "user": {
+ "type": "belongsTo",
+ "model": "Account",
+ "foreignKey": "userFk"
+ }
+ },
+ "scope": {
+ "order": ["creationDate DESC", "id DESC"]
+ }
+}
diff --git a/modules/shelving/back/models/shelving.js b/modules/shelving/back/models/shelving.js
new file mode 100644
index 000000000..3e27f5863
--- /dev/null
+++ b/modules/shelving/back/models/shelving.js
@@ -0,0 +1,3 @@
+module.exports = Self => {
+ require('../methods/shelving/getSummary')(Self);
+};
diff --git a/modules/shelving/back/models/shelving.json b/modules/shelving/back/models/shelving.json
new file mode 100644
index 000000000..508ac428f
--- /dev/null
+++ b/modules/shelving/back/models/shelving.json
@@ -0,0 +1,51 @@
+{
+ "name": "Shelving",
+ "base": "Loggable",
+ "log": {
+ "model": "ShelvingLog",
+ "showField": "id"
+ },
+ "options": {
+ "mysql": {
+ "table": "shelving"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "code": {
+ "type": "string",
+ "required": true
+ },
+ "parkingFk": {
+ "type": "number"
+ },
+ "isPrinted": {
+ "type": "boolean"
+ },
+ "priority": {
+ "type": "number"
+ },
+ "userFk": {
+ "type": "number"
+ },
+ "isRecyclable": {
+ "type": "boolean"
+ }
+ },
+ "relations": {
+ "parking": {
+ "type": "belongsTo",
+ "model": "Parking",
+ "foreignKey": "parkingFk"
+ },
+ "worker": {
+ "type": "belongsTo",
+ "model": "Worker",
+ "foreignKey": "userFk"
+ }
+ }
+}
diff --git a/modules/shelving/front/basic-data/index.html b/modules/shelving/front/basic-data/index.html
new file mode 100644
index 000000000..68d61e169
--- /dev/null
+++ b/modules/shelving/front/basic-data/index.html
@@ -0,0 +1,52 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/shelving/front/basic-data/index.js b/modules/shelving/front/basic-data/index.js
new file mode 100644
index 000000000..e17c9feee
--- /dev/null
+++ b/modules/shelving/front/basic-data/index.js
@@ -0,0 +1,10 @@
+import ngModule from '../module';
+import Section from 'salix/components/section';
+
+ngModule.vnComponent('vnShelvingBasicData', {
+ template: require('./index.html'),
+ controller: Section,
+ bindings: {
+ shelving: '<'
+ }
+});
diff --git a/modules/shelving/front/card/index.html b/modules/shelving/front/card/index.html
new file mode 100644
index 000000000..c83afc288
--- /dev/null
+++ b/modules/shelving/front/card/index.html
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/modules/shelving/front/card/index.js b/modules/shelving/front/card/index.js
new file mode 100644
index 000000000..5e2ea9b12
--- /dev/null
+++ b/modules/shelving/front/card/index.js
@@ -0,0 +1,29 @@
+import ngModule from '../module';
+import ModuleCard from 'salix/components/module-card';
+
+class Controller extends ModuleCard {
+ reload() {
+ const filter = {
+ include: [
+ {relation: 'worker',
+ scope: {
+ fields: ['userFk'],
+ include: {
+ relation: 'user',
+ scope: {
+ fields: ['nickname']
+ }
+ }
+ }},
+ {relation: 'parking'}
+ ]
+ };
+ this.$http.get(`Shelvings/${this.$params.id}`, {filter})
+ .then(res => this.shelving = res.data);
+ }
+}
+
+ngModule.vnComponent('vnShelvingCard', {
+ template: require('./index.html'),
+ controller: Controller
+});
diff --git a/modules/shelving/front/card/index.spec.js b/modules/shelving/front/card/index.spec.js
new file mode 100644
index 000000000..85b1bd269
--- /dev/null
+++ b/modules/shelving/front/card/index.spec.js
@@ -0,0 +1,26 @@
+import './index';
+
+describe('component vnShelvingCard', () => {
+ let controller;
+ let $httpBackend;
+ const data = {id: 1, code: 'AAA'};
+
+ beforeEach(ngModule('shelving'));
+
+ beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
+ $httpBackend = _$httpBackend_;
+
+ let $element = angular.element('');
+ controller = $componentController('vnShelvingCard', {$element});
+
+ $stateParams.id = data.id;
+ $httpBackend.whenRoute('GET', 'Shelvings/:id').respond(data);
+ }));
+
+ it('should reload the controller data', () => {
+ controller.reload();
+ $httpBackend.flush();
+
+ expect(controller.shelving).toEqual(data);
+ });
+});
diff --git a/modules/shelving/front/create/index.html b/modules/shelving/front/create/index.html
new file mode 100644
index 000000000..edb3a7d3b
--- /dev/null
+++ b/modules/shelving/front/create/index.html
@@ -0,0 +1,51 @@
+
+
+
\ No newline at end of file
diff --git a/modules/shelving/front/create/index.js b/modules/shelving/front/create/index.js
new file mode 100644
index 000000000..bb0e441eb
--- /dev/null
+++ b/modules/shelving/front/create/index.js
@@ -0,0 +1,15 @@
+import ngModule from '../module';
+import Section from 'salix/components/section';
+
+export default class Controller extends Section {
+ onSubmit() {
+ return this.$.watcher.submit().then(res =>
+ this.$state.go('shelving.card.basicData', {id: res.data.id})
+ );
+ }
+}
+
+ngModule.vnComponent('vnShelvingCreate', {
+ template: require('./index.html'),
+ controller: Controller
+});
diff --git a/modules/shelving/front/create/index.spec.js b/modules/shelving/front/create/index.spec.js
new file mode 100644
index 000000000..0bdde9145
--- /dev/null
+++ b/modules/shelving/front/create/index.spec.js
@@ -0,0 +1,38 @@
+import './index';
+
+describe('Shelving', () => {
+ describe('Component vnShelvingCreate', () => {
+ let $scope;
+ let $state;
+ let controller;
+
+ beforeEach(ngModule('shelving'));
+
+ beforeEach(inject(($componentController, $rootScope, _$state_) => {
+ $scope = $rootScope.$new();
+ $state = _$state_;
+ $scope.watcher = {
+ submit: () => {
+ return {
+ then: callback => {
+ callback({data: {id: 1}});
+ }
+ };
+ }
+ };
+ const $element = angular.element('');
+ controller = $componentController('vnShelvingCreate', {$element, $scope});
+ controller.$params = {};
+ }));
+
+ describe('onSubmit()', () => {
+ it(`should redirect to basic data by calling the $state.go function`, () => {
+ jest.spyOn(controller.$state, 'go');
+
+ controller.onSubmit();
+
+ expect(controller.$state.go).toHaveBeenCalledWith('shelving.card.basicData', {id: 1});
+ });
+ });
+ });
+});
diff --git a/modules/shelving/front/descriptor/index.html b/modules/shelving/front/descriptor/index.html
new file mode 100644
index 000000000..1344bb52a
--- /dev/null
+++ b/modules/shelving/front/descriptor/index.html
@@ -0,0 +1,45 @@
+
+
+
+ Delete
+
+
+
+
+
+
+
+
+
+
+ {{::$ctrl.shelving.worker.user.nickname}}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/shelving/front/descriptor/index.js b/modules/shelving/front/descriptor/index.js
new file mode 100644
index 000000000..931dbb6dc
--- /dev/null
+++ b/modules/shelving/front/descriptor/index.js
@@ -0,0 +1,26 @@
+import ngModule from '../module';
+import Descriptor from 'salix/components/descriptor';
+
+class Controller extends Descriptor {
+ get shelving() {
+ return this.entity;
+ }
+
+ set shelving(value) {
+ this.entity = value;
+ }
+
+ onDelete() {
+ return this.$http.delete(`Shelvings/${this.shelving.id}`)
+ .then(() => this.$state.go('shelving.index'))
+ .then(() => this.vnApp.showSuccess(this.$t('Shelving removed')));
+ }
+}
+
+ngModule.vnComponent('vnShelvingDescriptor', {
+ template: require('./index.html'),
+ controller: Controller,
+ bindings: {
+ shelving: '<'
+ }
+});
diff --git a/modules/shelving/front/descriptor/index.spec.js b/modules/shelving/front/descriptor/index.spec.js
new file mode 100644
index 000000000..3ee33580b
--- /dev/null
+++ b/modules/shelving/front/descriptor/index.spec.js
@@ -0,0 +1,29 @@
+import './index.js';
+
+describe('component vnShelvingDescriptor', () => {
+ let $httpBackend;
+ let controller;
+
+ const shelving = {id: 1, code: 'AA6'};
+
+ beforeEach(ngModule('shelving'));
+
+ beforeEach(inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => {
+ $httpBackend = _$httpBackend_;
+ controller = $componentController('vnShelvingDescriptor', {$element: null}, {shelving});
+ jest.spyOn(controller.vnApp, 'showSuccess');
+ }));
+
+ describe('onDelete()', () => {
+ it('should delete entity and go to index', () => {
+ controller.$state.go = jest.fn();
+
+ $httpBackend.expectDELETE('Shelvings/1').respond();
+ controller.onDelete();
+ $httpBackend.flush();
+
+ expect(controller.$state.go).toHaveBeenCalledWith('shelving.index');
+ expect(controller.vnApp.showSuccess).toHaveBeenCalled();
+ });
+ });
+});
diff --git a/modules/shelving/front/index.js b/modules/shelving/front/index.js
new file mode 100644
index 000000000..2ad9bc1b9
--- /dev/null
+++ b/modules/shelving/front/index.js
@@ -0,0 +1,11 @@
+export * from './module';
+
+import './basic-data';
+import './card';
+import './create';
+import './descriptor';
+import './index/';
+import './main';
+import './search-panel';
+import './summary';
+import './log';
diff --git a/modules/shelving/front/index/index.html b/modules/shelving/front/index/index.html
new file mode 100644
index 000000000..1532abd42
--- /dev/null
+++ b/modules/shelving/front/index/index.html
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/shelving/front/index/index.js b/modules/shelving/front/index/index.js
new file mode 100644
index 000000000..04d8ea9cd
--- /dev/null
+++ b/modules/shelving/front/index/index.js
@@ -0,0 +1,14 @@
+import ngModule from '../module';
+import Section from 'salix/components/section';
+
+export default class Controller extends Section {
+ preview(shelving) {
+ this.selectedShelving = shelving;
+ this.$.summary.show();
+ }
+}
+
+ngModule.vnComponent('vnShelvingIndex', {
+ template: require('./index.html'),
+ controller: Controller
+});
diff --git a/modules/shelving/front/index/index.spec.js b/modules/shelving/front/index/index.spec.js
new file mode 100644
index 000000000..aad79fb0e
--- /dev/null
+++ b/modules/shelving/front/index/index.spec.js
@@ -0,0 +1,39 @@
+import './index.js';
+describe('Component vnShelvingIndex', () => {
+ let controller;
+ let $window;
+ let shelvings = [{
+ id: 1,
+ code: 'AAA'
+ }, {
+ id: 2,
+ code: 'AA1'
+ }, {
+ id: 3,
+ code: 'AA2'
+ }];
+
+ beforeEach(ngModule('shelving'));
+
+ beforeEach(inject(($componentController, _$window_) => {
+ $window = _$window_;
+ const $element = angular.element('');
+ controller = $componentController('vnShelvingIndex', {$element});
+ }));
+
+ describe('preview()', () => {
+ it('should show the dialog summary', () => {
+ controller.$.summary = {show: () => {}};
+ jest.spyOn(controller.$.summary, 'show');
+
+ let event = new MouseEvent('click', {
+ view: $window,
+ bubbles: true,
+ cancelable: true
+ });
+ controller.preview(event, shelvings[0]);
+
+ expect(controller.$.summary.show).toHaveBeenCalledWith();
+ });
+ });
+});
diff --git a/modules/shelving/front/index/locale/es.yml b/modules/shelving/front/index/locale/es.yml
new file mode 100644
index 000000000..4d30f4cee
--- /dev/null
+++ b/modules/shelving/front/index/locale/es.yml
@@ -0,0 +1,2 @@
+Parking: Parking
+Priority: Prioridad
\ No newline at end of file
diff --git a/modules/shelving/front/log/index.html b/modules/shelving/front/log/index.html
new file mode 100644
index 000000000..8f0e6851c
--- /dev/null
+++ b/modules/shelving/front/log/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/modules/shelving/front/log/index.js b/modules/shelving/front/log/index.js
new file mode 100644
index 000000000..588e0995a
--- /dev/null
+++ b/modules/shelving/front/log/index.js
@@ -0,0 +1,7 @@
+import ngModule from '../module';
+import Section from 'salix/components/section';
+
+ngModule.vnComponent('vnShelvingLog', {
+ template: require('./index.html'),
+ controller: Section,
+});
diff --git a/modules/shelving/front/log/locale/es.yml b/modules/shelving/front/log/locale/es.yml
new file mode 100644
index 000000000..c572b78d1
--- /dev/null
+++ b/modules/shelving/front/log/locale/es.yml
@@ -0,0 +1 @@
+Changed by: Cambiado por
\ No newline at end of file
diff --git a/modules/shelving/front/main/index.html b/modules/shelving/front/main/index.html
new file mode 100644
index 000000000..3f3cc718b
--- /dev/null
+++ b/modules/shelving/front/main/index.html
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/shelving/front/main/index.js b/modules/shelving/front/main/index.js
new file mode 100644
index 000000000..96689fbd9
--- /dev/null
+++ b/modules/shelving/front/main/index.js
@@ -0,0 +1,29 @@
+import ngModule from '../module';
+import ModuleMain from 'salix/components/module-main';
+
+export default class Shelving extends ModuleMain {
+ constructor($element, $) {
+ super($element, $);
+ this.filter = {
+ include: [
+ {relation: 'parking'}
+ ],
+ };
+ }
+
+ exprBuilder(param, value) {
+ switch (param) {
+ case 'search':
+ return {code: {like: `%${value}%`}};
+ case 'parkingFk':
+ case 'userFk':
+ case 'isRecyclable':
+ return {[param]: value};
+ }
+ }
+}
+
+ngModule.vnComponent('vnShelving', {
+ controller: Shelving,
+ template: require('./index.html')
+});
diff --git a/modules/shelving/front/main/index.spec.js b/modules/shelving/front/main/index.spec.js
new file mode 100644
index 000000000..dcfa912bc
--- /dev/null
+++ b/modules/shelving/front/main/index.spec.js
@@ -0,0 +1,19 @@
+import './index';
+
+describe('component vnShelving', () => {
+ let controller;
+
+ beforeEach(ngModule('shelving'));
+
+ beforeEach(inject($componentController => {
+ controller = $componentController('vnShelving', {$element: null});
+ }));
+
+ describe('exprBuilder()', () => {
+ it('should search by code', () => {
+ let expr = controller.exprBuilder('search', 'UXN');
+
+ expect(expr).toEqual({code: {like: '%UXN%'}},);
+ });
+ });
+});
diff --git a/modules/shelving/front/main/locale/es.yml b/modules/shelving/front/main/locale/es.yml
new file mode 100644
index 000000000..4c39469ce
--- /dev/null
+++ b/modules/shelving/front/main/locale/es.yml
@@ -0,0 +1 @@
+Search shelving by code, parking or worker: Busca carros por código, parking o trabajador
\ No newline at end of file
diff --git a/modules/shelving/front/module.js b/modules/shelving/front/module.js
new file mode 100644
index 000000000..8ba261ead
--- /dev/null
+++ b/modules/shelving/front/module.js
@@ -0,0 +1,3 @@
+import {ng} from 'core/vendor';
+
+export default ng.module('shelving', ['salix']);
diff --git a/modules/shelving/front/routes.json b/modules/shelving/front/routes.json
new file mode 100644
index 000000000..b99ca4cac
--- /dev/null
+++ b/modules/shelving/front/routes.json
@@ -0,0 +1,70 @@
+{
+ "module": "shelving",
+ "name": "Shelvings",
+ "icon" : "contact_support",
+ "dependencies": ["worker"],
+ "validations" : true,
+ "menus": {
+ "main": [
+ {"state": "shelving.index", "icon": "contact_support"}
+ ],
+ "card": [
+ {"state": "shelving.card.basicData", "icon": "settings"},
+ {"state": "shelving.card.log", "icon": "history"}
+ ]
+ },
+ "keybindings": [
+ {"key": "s", "state": "shelving.index"}
+ ],
+ "routes": [
+ {
+ "url": "/shelving",
+ "state": "shelving",
+ "abstract": true,
+ "component": "vn-shelving",
+ "description": "Shelvings"
+ },
+ {
+ "url": "/index?q",
+ "state": "shelving.index",
+ "component": "vn-shelving-index",
+ "description": "Shelvings"
+ },
+ {
+ "url": "/create",
+ "state": "shelving.create",
+ "component": "vn-shelving-create",
+ "description": "New shelving"
+ },
+ {
+ "url": "/:id",
+ "state": "shelving.card",
+ "abstract": true,
+ "component": "vn-shelving-card"
+ },
+ {
+ "url": "/summary",
+ "state": "shelving.card.summary",
+ "component": "vn-shelving-summary",
+ "description": "Summary",
+ "params": {
+ "shelving": "$ctrl.shelving"
+ }
+ },
+ {
+ "url": "/basic-data",
+ "state": "shelving.card.basicData",
+ "component": "vn-shelving-basic-data",
+ "description": "Basic data",
+ "params": {
+ "shelving": "$ctrl.shelving"
+ }
+ },
+ {
+ "url" : "/log",
+ "state": "shelving.card.log",
+ "component": "vn-shelving-log",
+ "description": "Log"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/modules/shelving/front/search-panel/index.html b/modules/shelving/front/search-panel/index.html
new file mode 100644
index 000000000..b7ca068a5
--- /dev/null
+++ b/modules/shelving/front/search-panel/index.html
@@ -0,0 +1,43 @@
+
+
+
\ No newline at end of file
diff --git a/modules/shelving/front/search-panel/index.js b/modules/shelving/front/search-panel/index.js
new file mode 100644
index 000000000..51b81538b
--- /dev/null
+++ b/modules/shelving/front/search-panel/index.js
@@ -0,0 +1,7 @@
+import ngModule from '../module';
+import SearchPanel from 'core/components/searchbar/search-panel';
+
+ngModule.vnComponent('vnShelvingSearchPanel', {
+ template: require('./index.html'),
+ controller: SearchPanel
+});
diff --git a/modules/shelving/front/search-panel/locale/es.yml b/modules/shelving/front/search-panel/locale/es.yml
new file mode 100644
index 000000000..bd19b1b33
--- /dev/null
+++ b/modules/shelving/front/search-panel/locale/es.yml
@@ -0,0 +1 @@
+Search shelvings by code: Busca carros por código
\ No newline at end of file
diff --git a/modules/shelving/front/summary/index.html b/modules/shelving/front/summary/index.html
new file mode 100644
index 000000000..61e44d278
--- /dev/null
+++ b/modules/shelving/front/summary/index.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+ {{::$ctrl.summary.code}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{$ctrl.summary.worker.user.nickname}}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/shelving/front/summary/index.js b/modules/shelving/front/summary/index.js
new file mode 100644
index 000000000..10a905f1d
--- /dev/null
+++ b/modules/shelving/front/summary/index.js
@@ -0,0 +1,41 @@
+import ngModule from '../module';
+import Summary from 'salix/components/summary';
+import './style.scss';
+
+class Controller extends Summary {
+ set shelving(value) {
+ this._shelving = value;
+ this.summary = null;
+ if (!value) return;
+
+ const filter = {
+ include: [
+ {relation: 'worker',
+ scope: {
+ fields: ['userFk'],
+ include: {
+ relation: 'user',
+ scope: {
+ fields: ['nickname']
+ }
+ }
+ }},
+ {relation: 'parking'}
+ ]
+ };
+ this.$http.get(`Shelvings/${value.id}`, {filter})
+ .then(res => this.summary = res.data);
+ }
+
+ get shelving() {
+ return this._shelving;
+ }
+}
+
+ngModule.vnComponent('vnShelvingSummary', {
+ template: require('./index.html'),
+ controller: Controller,
+ bindings: {
+ shelving: '<'
+ }
+});
diff --git a/modules/shelving/front/summary/locale/es.yml b/modules/shelving/front/summary/locale/es.yml
new file mode 100644
index 000000000..d5d14d52a
--- /dev/null
+++ b/modules/shelving/front/summary/locale/es.yml
@@ -0,0 +1,5 @@
+Code: Código
+Parking: Parking
+Priority: Prioridad
+Worker: Trabajador
+Recyclable: Reciclable
\ No newline at end of file
diff --git a/modules/shelving/front/summary/style.scss b/modules/shelving/front/summary/style.scss
new file mode 100644
index 000000000..1eb6b2323
--- /dev/null
+++ b/modules/shelving/front/summary/style.scss
@@ -0,0 +1,7 @@
+@import "variables";
+
+vn-client-summary {
+ .alert span {
+ color: $color-alert
+ }
+}
\ No newline at end of file