diff --git a/db/routines/vn/triggers/ticketPackaging_beforeInsert.sql b/db/routines/vn/triggers/ticketPackaging_beforeInsert.sql index a58955e0d..f47a7ae35 100644 --- a/db/routines/vn/triggers/ticketPackaging_beforeInsert.sql +++ b/db/routines/vn/triggers/ticketPackaging_beforeInsert.sql @@ -4,7 +4,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketPackaging_befor FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); - SET NEW.workerFk = account.myUser_getId(); - END$$ DELIMITER ; diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d7e41233e..f1c57455e 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -277,7 +277,7 @@ "Collection does not exist": "La colección no existe", "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo", "Insert a date range": "Inserte un rango de fechas", - "Added observation": "{{user}} añadió esta observacion: {{text}}", + "Added observation": "{{user}} añadió esta observacion: {{text}} {{defaulterId}} ({{{defaulterUrl}}})", "Comment added to client": "Observación añadida al cliente {{clientFk}}", "Invalid auth code": "Código de verificación incorrecto", "Invalid or expired verification code": "Código de verificación incorrecto o expirado", diff --git a/modules/client/back/methods/defaulter/observationEmail.js b/modules/client/back/methods/defaulter/observationEmail.js index 5ac00b4ee..c06d1d3d0 100644 --- a/modules/client/back/methods/defaulter/observationEmail.js +++ b/modules/client/back/methods/defaulter/observationEmail.js @@ -29,6 +29,7 @@ module.exports = Self => { const $t = ctx.req.__; // $translate const myOptions = {}; const userId = ctx.req.accessToken.userId; + const url = await Self.app.models.Url.getUrl(); if (typeof options == 'object') Object.assign(myOptions, options); @@ -38,7 +39,9 @@ module.exports = Self => { const body = $t('Added observation', { user: user.name, - text: observation + text: observation, + defaulterId: defaulter.clientFk, + defaulterUrl: `${url}client/${defaulter.clientFk}/summary` }); await models.Mail.create({ diff --git a/modules/shelving/front/basic-data/index.html b/modules/shelving/front/basic-data/index.html deleted file mode 100644 index 68d61e169..000000000 --- a/modules/shelving/front/basic-data/index.html +++ /dev/null @@ -1,52 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/modules/shelving/front/basic-data/index.js b/modules/shelving/front/basic-data/index.js deleted file mode 100644 index e17c9feee..000000000 --- a/modules/shelving/front/basic-data/index.js +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100644 index c83afc288..000000000 --- a/modules/shelving/front/card/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/modules/shelving/front/card/index.js b/modules/shelving/front/card/index.js deleted file mode 100644 index 4f571d876..000000000 --- a/modules/shelving/front/card/index.js +++ /dev/null @@ -1,29 +0,0 @@ -import ngModule from '../module'; -import ModuleCard from 'salix/components/module-card'; - -class Controller extends ModuleCard { - reload() { - const filter = { - include: [ - {relation: 'worker', - scope: { - fields: ['id'], - 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 deleted file mode 100644 index 85b1bd269..000000000 --- a/modules/shelving/front/card/index.spec.js +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100644 index edb3a7d3b..000000000 --- a/modules/shelving/front/create/index.html +++ /dev/null @@ -1,51 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/modules/shelving/front/create/index.js b/modules/shelving/front/create/index.js deleted file mode 100644 index bb0e441eb..000000000 --- a/modules/shelving/front/create/index.js +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 0bdde9145..000000000 --- a/modules/shelving/front/create/index.spec.js +++ /dev/null @@ -1,38 +0,0 @@ -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 deleted file mode 100644 index 53dd37258..000000000 --- a/modules/shelving/front/descriptor/index.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - Delete shelving - - - -
- - - - - - - {{::$ctrl.shelving.worker.user.nickname}} - - -
-
-
- - - - - - - diff --git a/modules/shelving/front/descriptor/index.js b/modules/shelving/front/descriptor/index.js deleted file mode 100644 index 931dbb6dc..000000000 --- a/modules/shelving/front/descriptor/index.js +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100644 index 3ee33580b..000000000 --- a/modules/shelving/front/descriptor/index.spec.js +++ /dev/null @@ -1,29 +0,0 @@ -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/descriptor/locale/es.yml b/modules/shelving/front/descriptor/locale/es.yml deleted file mode 100644 index e7fafc320..000000000 --- a/modules/shelving/front/descriptor/locale/es.yml +++ /dev/null @@ -1,3 +0,0 @@ -Delete shelving: Eliminar carro -Shelving will be removed: El carro será eliminado -Shelving removed: Carro eliminado diff --git a/modules/shelving/front/index.js b/modules/shelving/front/index.js index 2ad9bc1b9..a7209a0bd 100644 --- a/modules/shelving/front/index.js +++ b/modules/shelving/front/index.js @@ -1,11 +1,3 @@ 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 deleted file mode 100644 index 1532abd42..000000000 --- a/modules/shelving/front/index/index.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/shelving/front/index/index.js b/modules/shelving/front/index/index.js deleted file mode 100644 index 04d8ea9cd..000000000 --- a/modules/shelving/front/index/index.js +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index aad79fb0e..000000000 --- a/modules/shelving/front/index/index.spec.js +++ /dev/null @@ -1,39 +0,0 @@ -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 deleted file mode 100644 index 4d30f4cee..000000000 --- a/modules/shelving/front/index/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 8f0e6851c..000000000 --- a/modules/shelving/front/log/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/modules/shelving/front/log/index.js b/modules/shelving/front/log/index.js deleted file mode 100644 index 588e0995a..000000000 --- a/modules/shelving/front/log/index.js +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index c572b78d1..000000000 --- a/modules/shelving/front/log/locale/es.yml +++ /dev/null @@ -1 +0,0 @@ -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 index 3f3cc718b..e69de29bb 100644 --- a/modules/shelving/front/main/index.html +++ b/modules/shelving/front/main/index.html @@ -1,19 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/modules/shelving/front/main/index.js b/modules/shelving/front/main/index.js index 96689fbd9..4e45a7dd3 100644 --- a/modules/shelving/front/main/index.js +++ b/modules/shelving/front/main/index.js @@ -4,22 +4,10 @@ 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}; - } + async $onInit() { + this.$state.go('home'); + window.location.href = await this.vnApp.getUrl(`shelving/`); } } diff --git a/modules/shelving/front/main/index.spec.js b/modules/shelving/front/main/index.spec.js deleted file mode 100644 index dcfa912bc..000000000 --- a/modules/shelving/front/main/index.spec.js +++ /dev/null @@ -1,19 +0,0 @@ -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/routes.json b/modules/shelving/front/routes.json index 4059e5095..7f6408cad 100644 --- a/modules/shelving/front/routes.json +++ b/modules/shelving/front/routes.json @@ -26,42 +26,6 @@ "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" } ] } diff --git a/modules/shelving/front/search-panel/index.html b/modules/shelving/front/search-panel/index.html deleted file mode 100644 index b7ca068a5..000000000 --- a/modules/shelving/front/search-panel/index.html +++ /dev/null @@ -1,43 +0,0 @@ -
-
- - - - - - - - - - - - - - - - - -
-
\ No newline at end of file diff --git a/modules/shelving/front/search-panel/index.js b/modules/shelving/front/search-panel/index.js deleted file mode 100644 index 51b81538b..000000000 --- a/modules/shelving/front/search-panel/index.js +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index bd19b1b33..000000000 --- a/modules/shelving/front/search-panel/locale/es.yml +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 61e44d278..000000000 --- a/modules/shelving/front/summary/index.html +++ /dev/null @@ -1,51 +0,0 @@ - -
- - - - {{::$ctrl.summary.code}} -
- - -

- - Basic data - -

- - - - - - - - - - {{$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 deleted file mode 100644 index 91f8e2aa7..000000000 --- a/modules/shelving/front/summary/index.js +++ /dev/null @@ -1,41 +0,0 @@ -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: ['id'], - 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 deleted file mode 100644 index d5d14d52a..000000000 --- a/modules/shelving/front/summary/locale/es.yml +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 1eb6b2323..000000000 --- a/modules/shelving/front/summary/style.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import "variables"; - -vn-client-summary { - .alert span { - color: $color-alert - } -} \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/addSaleByCode.js b/modules/ticket/back/methods/ticket/addSaleByCode.js index a73628c86..ca3d2cb07 100644 --- a/modules/ticket/back/methods/ticket/addSaleByCode.js +++ b/modules/ticket/back/methods/ticket/addSaleByCode.js @@ -30,7 +30,7 @@ module.exports = Self => { }); Self.addSaleByCode = async(ctx, barcode, quantity, ticketFk, warehouseFk, options) => { - const myOptions = {}; + const myOptions = {userId: ctx.req.accessToken.userId}; let tx; if (typeof options == 'object')