diff --git a/front/core/components/array-model/array-model.js b/front/core/components/array-model/array-model.js index 5b0b94cdc..7ebb95755 100644 --- a/front/core/components/array-model/array-model.js +++ b/front/core/components/array-model/array-model.js @@ -214,7 +214,7 @@ export default class ArrayModel extends ModelProxy { } ArrayModel.$inject = ['$q', '$filter', '$element', '$scope']; -ngModule.component('vnArrayModel', { +ngModule.vnComponent('vnArrayModel', { controller: ArrayModel, bindings: { orgData: ' -1) - this.input.value = this.$translate.instant(display); + this.input.value = this.$t(display); } } diff --git a/front/core/components/chip/index.spec.js b/front/core/components/chip/index.spec.js index 60129fd69..fc93527d6 100644 --- a/front/core/components/chip/index.spec.js +++ b/front/core/components/chip/index.spec.js @@ -8,7 +8,7 @@ describe('Component vnChip', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($componentController, $rootScope) => { + beforeEach(inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); $element = angular.element(`
${template}
`); controller = $componentController('vnChip', {$element, $scope, $transclude: () => {}}); diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index 52052cc7f..9cfa3b410 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -272,7 +272,7 @@ export default class CrudModel extends ModelProxy { } CrudModel.$inject = ['$q', '$http', '$element', '$scope']; -ngModule.component('vnCrudModel', { +ngModule.vnComponent('vnCrudModel', { controller: CrudModel, bindings: { orgData: ' { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => { + beforeEach(inject(($compile, $rootScope, _$filter_) => { $filter = _$filter_; $element = $compile(``)($rootScope); diff --git a/front/core/components/dialog/index.spec.js b/front/core/components/dialog/index.spec.js index e8c8f6320..03720bf31 100644 --- a/front/core/components/dialog/index.spec.js +++ b/front/core/components/dialog/index.spec.js @@ -5,7 +5,7 @@ describe('Component vnDialog', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($rootScope, $compile) => { + beforeEach(inject(($rootScope, $compile) => { $scope = $rootScope.$new(); $element = $compile('Body')($scope); controller = $element.controller('vnDialog'); diff --git a/front/core/components/drop-down/index.js b/front/core/components/drop-down/index.js index dfdfbe18d..fd5792da6 100644 --- a/front/core/components/drop-down/index.js +++ b/front/core/components/drop-down/index.js @@ -276,7 +276,7 @@ export default class DropDown extends Popover { if (this.translateFields) { option = Object.assign({}, option); for (let field of this.translateFields) - option[field] = this.$translate.instant(option[field]); + option[field] = this.$t(option[field]); } let li = this.document.createElement('li'); diff --git a/front/core/components/icon/icon.js b/front/core/components/icon/icon.js index 1b78f4693..38aea0056 100644 --- a/front/core/components/icon/icon.js +++ b/front/core/components/icon/icon.js @@ -25,7 +25,7 @@ class Icon { } Icon.$inject = ['$attrs']; -ngModule.component('vnIcon', { +ngModule.vnComponent('vnIcon', { template: '{{::$ctrl.iconContent}}', controller: Icon, bindings: { diff --git a/front/core/components/input-file/index.spec.js b/front/core/components/input-file/index.spec.js index 3b37a8d6c..25df9a47e 100644 --- a/front/core/components/input-file/index.spec.js +++ b/front/core/components/input-file/index.spec.js @@ -7,7 +7,7 @@ describe('Component vnInputFile', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($compile, $rootScope) => { + beforeEach(inject(($compile, $rootScope) => { $scope = $rootScope.$new(); $element = $compile('')($scope); controller = $element.controller('vnInputFile'); diff --git a/front/core/components/input-number/index.spec.js b/front/core/components/input-number/index.spec.js index 0e0f8c4a5..5e80659f1 100644 --- a/front/core/components/input-number/index.spec.js +++ b/front/core/components/input-number/index.spec.js @@ -6,7 +6,7 @@ describe('Component vnInputNumber', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($compile, $rootScope) => { + beforeEach(inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); $ctrl = $element.controller('vnInputNumber'); })); diff --git a/front/core/components/input-time/index.spec.js b/front/core/components/input-time/index.spec.js index 39993b5cc..abb684df8 100644 --- a/front/core/components/input-time/index.spec.js +++ b/front/core/components/input-time/index.spec.js @@ -7,7 +7,7 @@ describe('Component vnInputTime', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => { + beforeEach(inject(($compile, $rootScope, _$filter_) => { $filter = _$filter_; $element = $compile(``)($rootScope); diff --git a/front/core/components/label-value/index.js b/front/core/components/label-value/index.js index 71863f867..ec1e6c1a3 100644 --- a/front/core/components/label-value/index.js +++ b/front/core/components/label-value/index.js @@ -42,7 +42,7 @@ export default class Controller extends Component { } } -ngModule.component('vnLabelValue', { +ngModule.vnComponent('vnLabelValue', { controller: Controller, template: require('./index.html'), transclude: true, diff --git a/front/core/components/model-proxy/model-proxy.js b/front/core/components/model-proxy/model-proxy.js index 1eaf749d5..592b25710 100644 --- a/front/core/components/model-proxy/model-proxy.js +++ b/front/core/components/model-proxy/model-proxy.js @@ -30,7 +30,7 @@ export class DataModel extends Component { clear() {} } -ngModule.component('vnDataModel', { +ngModule.vnComponent('vnDataModel', { controller: DataModel, bindings: { data: '=?', @@ -269,7 +269,7 @@ export default class ModelProxy extends DataModel { } } -ngModule.component('vnModelProxy', { +ngModule.vnComponent('vnModelProxy', { controller: ModelProxy, bindings: { orgData: ' { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject($componentController => { + beforeEach(inject($componentController => { $element = angular.element(`
`); controller = $componentController('vnMultiCheck', {$element: $element}); controller._model = crudModel; diff --git a/front/core/components/pagination/pagination.js b/front/core/components/pagination/pagination.js index f1393aee8..9979be368 100644 --- a/front/core/components/pagination/pagination.js +++ b/front/core/components/pagination/pagination.js @@ -90,7 +90,7 @@ class Pagination extends Component { } } -ngModule.component('vnPagination', { +ngModule.vnComponent('vnPagination', { template: require('./pagination.html'), bindings: { model: '<', diff --git a/front/core/components/scroll-up/scroll-up.js b/front/core/components/scroll-up/scroll-up.js index 2ada05394..f18513bca 100644 --- a/front/core/components/scroll-up/scroll-up.js +++ b/front/core/components/scroll-up/scroll-up.js @@ -22,7 +22,7 @@ export default class Controller extends Component { Controller.$inject = ['$element', '$scope', '$window']; -ngModule.component('vnScrollUp', { +ngModule.vnComponent('vnScrollUp', { template: require('./scroll-up.html'), controller: Controller, bindings: { diff --git a/front/core/components/searchbar/searchbar.js b/front/core/components/searchbar/searchbar.js index 073b77f6e..9720916ee 100644 --- a/front/core/components/searchbar/searchbar.js +++ b/front/core/components/searchbar/searchbar.js @@ -36,7 +36,7 @@ export default class Searchbar extends Component { } this.searchState = `${this.baseState}.index`; - this.placeholder = this.$translate.instant('Search by', { + this.placeholder = this.$t('Search by', { module: this.baseState }); } diff --git a/front/core/components/slot/portal.js b/front/core/components/slot/portal.js index f4dbecb09..40631c52e 100644 --- a/front/core/components/slot/portal.js +++ b/front/core/components/slot/portal.js @@ -19,7 +19,7 @@ export default class Portal { } Portal.$inject = ['$transclude', 'vnSlotService']; -ngModule.component('vnPortal', { +ngModule.vnComponent('vnPortal', { controller: Portal, transclude: true, bindings: { diff --git a/front/core/components/snackbar/snackbar.js b/front/core/components/snackbar/snackbar.js index 9439198f0..14d920211 100644 --- a/front/core/components/snackbar/snackbar.js +++ b/front/core/components/snackbar/snackbar.js @@ -144,7 +144,7 @@ export default class Controller extends Component { } } -ngModule.component('vnSnackbar', { +ngModule.vnComponent('vnSnackbar', { template: require('./snackbar.html'), controller: Controller }); diff --git a/front/core/components/spinner/spinner.js b/front/core/components/spinner/spinner.js index aee973aa6..ad535b6a4 100644 --- a/front/core/components/spinner/spinner.js +++ b/front/core/components/spinner/spinner.js @@ -54,4 +54,4 @@ export const component = { }, controller: Spinner }; -ngModule.component('vnSpinner', component); +ngModule.vnComponent('vnSpinner', component); diff --git a/front/core/components/spinner/spinner.spec.js b/front/core/components/spinner/spinner.spec.js index ef3c99623..fc1f8d207 100644 --- a/front/core/components/spinner/spinner.spec.js +++ b/front/core/components/spinner/spinner.spec.js @@ -6,7 +6,7 @@ describe('Component vnSpinner', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($compile, $rootScope) => { + beforeEach(inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); controller = $element.controller('vnSpinner'); })); diff --git a/front/core/components/step-control/step-control.js b/front/core/components/step-control/step-control.js index 0ca1f0c46..b5b3466ca 100644 --- a/front/core/components/step-control/step-control.js +++ b/front/core/components/step-control/step-control.js @@ -74,7 +74,7 @@ export default class StepControl { StepControl.$inject = ['$state']; -ngModule.component('vnStepControl', { +ngModule.vnComponent('vnStepControl', { template: require('./step-control.html'), controller: StepControl, bindings: { diff --git a/front/core/components/step-control/step-control.spec.js b/front/core/components/step-control/step-control.spec.js index 11a157470..d4fbbb1eb 100644 --- a/front/core/components/step-control/step-control.spec.js +++ b/front/core/components/step-control/step-control.spec.js @@ -6,7 +6,7 @@ describe('Component vnStepControl', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($componentController, _$state_) => { + beforeEach(inject(($componentController, _$state_) => { $state = _$state_; jest.spyOn($state, 'go'); controller = $componentController('vnStepControl', {$state: $state}); diff --git a/front/core/components/table/index.js b/front/core/components/table/index.js index 0b9236c84..a61b97485 100644 --- a/front/core/components/table/index.js +++ b/front/core/components/table/index.js @@ -45,7 +45,7 @@ export default class Table { Table.$inject = ['$scope', '$element', '$transclude']; -ngModule.component('vnTable', { +ngModule.vnComponent('vnTable', { template: require('./index.html'), transclude: true, controller: Table, diff --git a/front/core/components/table/index.spec.js b/front/core/components/table/index.spec.js index 40e1ef74e..631111b72 100644 --- a/front/core/components/table/index.spec.js +++ b/front/core/components/table/index.spec.js @@ -7,7 +7,7 @@ describe('Component vnTable', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($componentController, $rootScope) => { + beforeEach(inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); $element = angular.element(` diff --git a/front/core/components/td-editable/index.js b/front/core/components/td-editable/index.js index 844e7501e..b3ef1e436 100644 --- a/front/core/components/td-editable/index.js +++ b/front/core/components/td-editable/index.js @@ -94,7 +94,7 @@ export default class Controller extends Component { } Controller.$inject = ['$element', '$scope', '$transclude', '$timeout']; -ngModule.component('vnTdEditable', { +ngModule.vnComponent('vnTdEditable', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/front/core/components/textarea/index.spec.js b/front/core/components/textarea/index.spec.js index fc153be93..ea105db13 100644 --- a/front/core/components/textarea/index.spec.js +++ b/front/core/components/textarea/index.spec.js @@ -6,7 +6,7 @@ describe('Component vnTextarea', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($compile, $rootScope) => { + beforeEach(inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); $ctrl = $element.controller('vnTextarea'); })); diff --git a/front/core/components/th/index.js b/front/core/components/th/index.js index 682fb4eb1..b8260bd74 100644 --- a/front/core/components/th/index.js +++ b/front/core/components/th/index.js @@ -75,7 +75,7 @@ export default class Th { Th.$inject = ['$element']; -ngModule.component('vnTh', { +ngModule.vnComponent('vnTh', { template: require('./index.html'), transclude: true, controller: Th, diff --git a/front/core/components/th/index.spec.js b/front/core/components/th/index.spec.js index ce6dbeec5..a00f73cc9 100644 --- a/front/core/components/th/index.spec.js +++ b/front/core/components/th/index.spec.js @@ -7,7 +7,7 @@ describe('Component vnTh', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject($componentController => { + beforeEach(inject($componentController => { $element = angular.element(`
${template}
`); controller = $componentController('vnTh', {$element: $element}); controller.table = { diff --git a/front/core/components/tooltip/tooltip.js b/front/core/components/tooltip/tooltip.js index 72d69f83d..e2dba2d03 100644 --- a/front/core/components/tooltip/tooltip.js +++ b/front/core/components/tooltip/tooltip.js @@ -197,7 +197,7 @@ export default class Tooltip extends Component { } Tooltip.$inject = ['$element', '$scope', '$timeout']; -ngModule.component('vnTooltip', { +ngModule.vnComponent('vnTooltip', { template: require('./tooltip.html'), controller: Tooltip, transclude: true, diff --git a/front/core/components/treeview/child.js b/front/core/components/treeview/child.js index 9e4edef35..36db07601 100644 --- a/front/core/components/treeview/child.js +++ b/front/core/components/treeview/child.js @@ -49,7 +49,7 @@ class Controller { } Controller.$inject = ['$element', '$scope', '$compile']; -ngModule.component('vnTreeviewChild', { +ngModule.vnComponent('vnTreeviewChild', { template: require('./child.html'), controller: Controller, bindings: { diff --git a/front/core/components/treeview/childs.js b/front/core/components/treeview/childs.js index 03ae30233..dfb241ed2 100644 --- a/front/core/components/treeview/childs.js +++ b/front/core/components/treeview/childs.js @@ -2,7 +2,7 @@ import ngModule from '../../module'; class Controller {} -ngModule.component('vnTreeviewChilds', { +ngModule.vnComponent('vnTreeviewChilds', { template: require('./childs.html'), controller: Controller, bindings: { diff --git a/front/core/components/treeview/index.js b/front/core/components/treeview/index.js index b39ff7b46..848440cdc 100644 --- a/front/core/components/treeview/index.js +++ b/front/core/components/treeview/index.js @@ -247,7 +247,7 @@ export default class Treeview extends Component { Treeview.$inject = ['$element', '$scope', '$transclude', '$window']; -ngModule.component('vnTreeview', { +ngModule.vnComponent('vnTreeview', { template: require('./index.html'), controller: Treeview, bindings: { diff --git a/front/core/components/watcher/watcher.js b/front/core/components/watcher/watcher.js index 1a1abffa5..9de9d8c1b 100644 --- a/front/core/components/watcher/watcher.js +++ b/front/core/components/watcher/watcher.js @@ -267,7 +267,7 @@ export default class Watcher extends Component { } Watcher.$inject = ['$element', '$scope', '$state', '$stateParams', '$transitions', '$http', 'vnApp', '$translate', '$attrs', '$q']; -ngModule.component('vnWatcher', { +ngModule.vnComponent('vnWatcher', { template: require('./watcher.html'), bindings: { url: '@?', diff --git a/front/core/components/watcher/watcher.spec.js b/front/core/components/watcher/watcher.spec.js index 6c2567f7e..e19592387 100644 --- a/front/core/components/watcher/watcher.spec.js +++ b/front/core/components/watcher/watcher.spec.js @@ -12,7 +12,7 @@ describe('Component vnWatcher', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => { $scope = $rootScope.$new(); $element = angular.element('
'); $state = _$state_; diff --git a/front/core/directives/specs/zoom-image.spec.js b/front/core/directives/specs/zoom-image.spec.js index f9d9c1801..541bc65f2 100644 --- a/front/core/directives/specs/zoom-image.spec.js +++ b/front/core/directives/specs/zoom-image.spec.js @@ -7,7 +7,7 @@ describe('Directive zoomImage', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject(($compile, $rootScope) => { + beforeEach(inject(($compile, $rootScope) => { compile = $compile; scope = $rootScope.$new(); })); diff --git a/front/core/lib/specs/module-loader.spec.js b/front/core/lib/specs/module-loader.spec.js index dbed5e9a0..811922169 100644 --- a/front/core/lib/specs/module-loader.spec.js +++ b/front/core/lib/specs/module-loader.spec.js @@ -5,7 +5,7 @@ describe('factory vnModuleLoader', () => { beforeEach(ngModule('vnCore')); - beforeEach(angular.mock.inject((_vnModuleLoader_, _$rootScope_, $httpBackend, _$window_, $q) => { + beforeEach(inject((_vnModuleLoader_, _$rootScope_, $httpBackend, _$window_, $q) => { vnModuleLoader = _vnModuleLoader_; $rootScope = _$rootScope_; $window = _$window_; diff --git a/front/salix/components/descriptor/index.js b/front/salix/components/descriptor/index.js index 3d6dd1b3f..333360d2b 100644 --- a/front/salix/components/descriptor/index.js +++ b/front/salix/components/descriptor/index.js @@ -107,7 +107,7 @@ export class DescriptorContent { } DescriptorContent.$inject = ['$transclude', 'vnModules']; -ngModule.component('vnDescriptorContent', { +ngModule.vnComponent('vnDescriptorContent', { template: require('./index.html'), controller: DescriptorContent, bindings: { diff --git a/front/salix/components/descriptor/quick-link.js b/front/salix/components/descriptor/quick-link.js index 545f235a0..cd85f5250 100644 --- a/front/salix/components/descriptor/quick-link.js +++ b/front/salix/components/descriptor/quick-link.js @@ -2,7 +2,7 @@ import ngModule from '../../module'; export default class QuickLink {} -ngModule.component('vnQuickLink', { +ngModule.vnComponent('vnQuickLink', { template: require('./quick-link.html'), controller: QuickLink, bindings: { diff --git a/front/salix/components/home/home.js b/front/salix/components/home/home.js index 367880b31..3da49a265 100644 --- a/front/salix/components/home/home.js +++ b/front/salix/components/home/home.js @@ -28,7 +28,7 @@ export default class Controller extends Component { } Controller.$inject = ['$element', '$scope', 'vnModules', '$sce']; -ngModule.component('vnHome', { +ngModule.vnComponent('vnHome', { template: require('./home.html'), controller: Controller }); diff --git a/front/salix/components/layout/index..js b/front/salix/components/layout/index..js deleted file mode 100644 index 9fdcfc034..000000000 --- a/front/salix/components/layout/index..js +++ /dev/null @@ -1,24 +0,0 @@ -import './index.js'; - -describe('Component vnMainMenu', () => { - let $httpBackend; - let controller; - - beforeEach(ngModule('salix')); - - beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { - let vnModules = {get: () => {}}; - $httpBackend = _$httpBackend_; - controller = $componentController('vnMainMenu', {vnModules}); - })); - - describe('getCurrentUserName()', () => { - it(`should set the user name property in the controller`, () => { - $httpBackend.expect('GET', `Accounts/getUserData`).respond({name: 'batman'}); - controller.getCurrentUserName(); - $httpBackend.flush(); - - expect(controller.$.$root.user.name).toEqual('batman'); - }); - }); -}); diff --git a/front/salix/components/layout/index.js b/front/salix/components/layout/index.js index 883b010ba..b8ca74b99 100644 --- a/front/salix/components/layout/index.js +++ b/front/salix/components/layout/index.js @@ -21,7 +21,7 @@ export class Layout extends Component { } Layout.$inject = ['$element', '$scope', 'vnModules']; -ngModule.component('vnLayout', { +ngModule.vnComponent('vnLayout', { template: require('./index.html'), controller: Layout, require: { diff --git a/front/salix/components/layout/index.spec.js b/front/salix/components/layout/index.spec.js index 7163acb65..18aca1f01 100644 --- a/front/salix/components/layout/index.spec.js +++ b/front/salix/components/layout/index.spec.js @@ -6,7 +6,7 @@ describe('Component vnLayout', () => { beforeEach(ngModule('salix')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { + beforeEach(inject(($componentController, _$httpBackend_) => { let vnModules = {get: () => {}}; $httpBackend = _$httpBackend_; let $element = angular.element('
'); diff --git a/front/salix/components/left-menu/left-menu.js b/front/salix/components/left-menu/left-menu.js index c4bba64dd..5f047060a 100644 --- a/front/salix/components/left-menu/left-menu.js +++ b/front/salix/components/left-menu/left-menu.js @@ -117,7 +117,7 @@ export default class LeftMenu { } LeftMenu.$inject = ['$state', '$transitions', 'aclService', '$timeout', '$element']; -ngModule.component('vnLeftMenu', { +ngModule.vnComponent('vnLeftMenu', { template: require('./left-menu.html'), controller: LeftMenu, bindings: { diff --git a/front/salix/components/left-menu/left-menu.spec.js b/front/salix/components/left-menu/left-menu.spec.js index 84c1b60d4..56d7ea10d 100644 --- a/front/salix/components/left-menu/left-menu.spec.js +++ b/front/salix/components/left-menu/left-menu.spec.js @@ -6,7 +6,7 @@ describe('Component vnLeftMenu', () => { beforeEach(ngModule('salix')); - beforeEach(angular.mock.inject(($componentController, $state, $window) => { + beforeEach(inject(($componentController, $state, $window) => { $element = angular.element('
'); $state.current.name = 'client.card.summary'; $state.current.data = {moduleIndex: 0}; diff --git a/front/salix/components/login/login.js b/front/salix/components/login/login.js index efb5e02bb..b5f8c1e7d 100644 --- a/front/salix/components/login/login.js +++ b/front/salix/components/login/login.js @@ -37,7 +37,7 @@ export default class Controller { } Controller.$inject = ['$scope', '$element', 'vnAuth']; -ngModule.component('vnLogin', { +ngModule.vnComponent('vnLogin', { template: require('./login.html'), controller: Controller }); diff --git a/front/salix/components/side-menu/side-menu.js b/front/salix/components/side-menu/side-menu.js index c2b5b421e..0e683b4bb 100644 --- a/front/salix/components/side-menu/side-menu.js +++ b/front/salix/components/side-menu/side-menu.js @@ -68,7 +68,7 @@ export default class SideMenu extends Component { } } -ngModule.component('vnSideMenu', { +ngModule.vnComponent('vnSideMenu', { template: require('./side-menu.html'), controller: SideMenu, transclude: true, diff --git a/front/salix/components/user-popover/index.js b/front/salix/components/user-popover/index.js index 88efb26d1..c2fb6a130 100644 --- a/front/salix/components/user-popover/index.js +++ b/front/salix/components/user-popover/index.js @@ -80,7 +80,7 @@ class Controller { } Controller.$inject = ['$scope', '$translate', 'vnConfig', 'vnAuth']; -ngModule.component('vnUserPopover', { +ngModule.vnComponent('vnUserPopover', { template: require('./index.html'), controller: Controller }); diff --git a/front/salix/components/user-popover/index.spec.js b/front/salix/components/user-popover/index.spec.js index 217471ca5..a0f1a953c 100644 --- a/front/salix/components/user-popover/index.spec.js +++ b/front/salix/components/user-popover/index.spec.js @@ -7,7 +7,7 @@ describe('Salix', () => { beforeEach(ngModule('salix')); - beforeEach(angular.mock.inject(($componentController, $rootScope, $httpBackend) => { + beforeEach(inject(($componentController, $rootScope, $httpBackend) => { $httpBackend.expectGET('UserConfigs/getUserConfig'); $scope = $rootScope.$new(); diff --git a/modules/claim/front/action/index.js b/modules/claim/front/action/index.js index 2ba010ef2..2010d75c8 100644 --- a/modules/claim/front/action/index.js +++ b/modules/claim/front/action/index.js @@ -154,7 +154,7 @@ export default class Controller extends Section { } } -ngModule.component('vnClaimAction', { +ngModule.vnComponent('vnClaimAction', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/claim/front/action/index.spec.js b/modules/claim/front/action/index.spec.js index c477984d9..34899537b 100644 --- a/modules/claim/front/action/index.spec.js +++ b/modules/claim/front/action/index.spec.js @@ -9,7 +9,7 @@ describe('claim', () => { beforeEach(ngModule('claim')); - beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => { + beforeEach(inject(($componentController, _$state_, _$httpBackend_) => { $httpBackend = _$httpBackend_; $state = _$state_; $state.params.id = 1; @@ -91,7 +91,7 @@ describe('claim', () => { $httpBackend.flush(); expect(controller.$.model.refresh).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.lastTicketsPopover.hide).toHaveBeenCalledWith(); }); }); @@ -106,7 +106,7 @@ describe('claim', () => { $httpBackend.flush(); expect(controller.card.reload).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); diff --git a/modules/claim/front/basic-data/index.js b/modules/claim/front/basic-data/index.js index c3eac92ff..9fa3bdf4d 100644 --- a/modules/claim/front/basic-data/index.js +++ b/modules/claim/front/basic-data/index.js @@ -11,7 +11,7 @@ class Controller extends Section { } } -ngModule.component('vnClaimBasicData', { +ngModule.vnComponent('vnClaimBasicData', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/claim/front/basic-data/index.spec.js b/modules/claim/front/basic-data/index.spec.js index 65e934cb8..638f88418 100644 --- a/modules/claim/front/basic-data/index.spec.js +++ b/modules/claim/front/basic-data/index.spec.js @@ -8,7 +8,7 @@ describe('Claim', () => { beforeEach(ngModule('claim')); - beforeEach(angular.mock.inject(($componentController, $rootScope) => { + beforeEach(inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); $scope.watcher = watcher; const $element = angular.element(''); diff --git a/modules/claim/front/card/index.spec.js b/modules/claim/front/card/index.spec.js index 1b2344925..aa796c1e3 100644 --- a/modules/claim/front/card/index.spec.js +++ b/modules/claim/front/card/index.spec.js @@ -8,7 +8,7 @@ describe('Claim', () => { beforeEach(ngModule('claim')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => { + beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { $httpBackend = _$httpBackend_; let $element = angular.element('
'); diff --git a/modules/claim/front/detail/index.js b/modules/claim/front/detail/index.js index c97f3bd47..b1c6c81e0 100644 --- a/modules/claim/front/detail/index.js +++ b/modules/claim/front/detail/index.js @@ -75,7 +75,7 @@ class Controller extends Section { this.$http.post(query, saleToAdd).then(() => { this.$.addSales.hide(); this.$.model.refresh(); - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); if (this.aclService.hasAny(['salesAssistant'])) this.$state.go('claim.card.development'); @@ -90,7 +90,7 @@ class Controller extends Section { deleteClaimedSale() { let query = `ClaimBeginnings/${this.sale.id}`; this.$http.delete(query).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.model.remove(this.sale); this.calculateTotals(); }); @@ -100,7 +100,7 @@ class Controller extends Section { let params = {id: id, quantity: claimedQuantity}; let query = `ClaimBeginnings/`; this.$http.patch(query, params).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.calculateTotals(); }); } @@ -134,7 +134,7 @@ class Controller extends Section { showEditPopover(event, saleClaimed) { if (this.isEditable) { if (!this.aclService.hasAny(['salesAssistant'])) - return this.vnApp.showError(this.$translate.instant('Insuficient permisos')); + return this.vnApp.showError(this.$t('Insuficient permisos')); this.saleClaimed = saleClaimed; this.$.editPopover.parent = event.target; @@ -175,7 +175,7 @@ class Controller extends Section { this.calculateTotals(); this.clearDiscount(); - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); }).catch(err => { this.vnApp.showError(err.message); }); @@ -196,7 +196,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClaimDetail', { +ngModule.vnComponent('vnClaimDetail', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/claim/front/detail/index.spec.js b/modules/claim/front/detail/index.spec.js index 5061eaff7..972d487e5 100644 --- a/modules/claim/front/detail/index.spec.js +++ b/modules/claim/front/detail/index.spec.js @@ -9,7 +9,7 @@ describe('claim', () => { beforeEach(ngModule('claim')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $scope = $rootScope.$new(); $scope.descriptor = { show: () => {} @@ -80,7 +80,7 @@ describe('claim', () => { controller.deleteClaimedSale(); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); @@ -91,7 +91,7 @@ describe('claim', () => { controller.setClaimedQuantity(1, 1); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); @@ -126,7 +126,7 @@ describe('claim', () => { expect(controller.calculateTotals).toHaveBeenCalledWith(); expect(controller.clearDiscount).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.editPopover.hide).toHaveBeenCalledWith(); }); }); diff --git a/modules/claim/front/development/index.js b/modules/claim/front/development/index.js index cc86d5452..a19654c56 100644 --- a/modules/claim/front/development/index.js +++ b/modules/claim/front/development/index.js @@ -15,7 +15,7 @@ class Controller extends Section { } } -ngModule.component('vnClaimDevelopment', { +ngModule.vnComponent('vnClaimDevelopment', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/claim/front/development/index.spec.js b/modules/claim/front/development/index.spec.js index 5708f82f2..e2574ccb9 100644 --- a/modules/claim/front/development/index.spec.js +++ b/modules/claim/front/development/index.spec.js @@ -9,7 +9,7 @@ describe('Claim', () => { beforeEach(ngModule('claim')); - beforeEach(angular.mock.inject(($componentController, $rootScope) => { + beforeEach(inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); $scope.watcher = watcher; $scope.model = crudModel; diff --git a/modules/claim/front/index/index.js b/modules/claim/front/index/index.js index 773c6a999..fe4b6def7 100644 --- a/modules/claim/front/index/index.js +++ b/modules/claim/front/index/index.js @@ -19,7 +19,7 @@ export default class Controller extends Section { } } -ngModule.component('vnClaimIndex', { +ngModule.vnComponent('vnClaimIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/claim/front/photos/index.js b/modules/claim/front/photos/index.js index 38cb89ad1..2b77c6abc 100644 --- a/modules/claim/front/photos/index.js +++ b/modules/claim/front/photos/index.js @@ -93,7 +93,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope', 'vnFile']; -ngModule.component('vnClaimPhotos', { +ngModule.vnComponent('vnClaimPhotos', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/claim/front/photos/index.spec.js b/modules/claim/front/photos/index.spec.js index 9cb893bae..38e77d13f 100644 --- a/modules/claim/front/photos/index.spec.js +++ b/modules/claim/front/photos/index.spec.js @@ -9,7 +9,7 @@ describe('Claim', () => { beforeEach(ngModule('claim')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); controller = $componentController('vnClaimPhotos', {$element: null, $scope}); diff --git a/modules/claim/front/search-panel/index.js b/modules/claim/front/search-panel/index.js index b6bd2b974..a7e8fb046 100644 --- a/modules/claim/front/search-panel/index.js +++ b/modules/claim/front/search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnClaimSearchPanel', { +ngModule.vnComponent('vnClaimSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/claim/front/summary/index.js b/modules/claim/front/summary/index.js index 6e62252d5..6991e0975 100644 --- a/modules/claim/front/summary/index.js +++ b/modules/claim/front/summary/index.js @@ -45,7 +45,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope', 'vnFile']; -ngModule.component('vnClaimSummary', { +ngModule.vnComponent('vnClaimSummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/claim/front/summary/index.spec.js b/modules/claim/front/summary/index.spec.js index b6e03d929..d6300b30a 100644 --- a/modules/claim/front/summary/index.spec.js +++ b/modules/claim/front/summary/index.spec.js @@ -9,7 +9,7 @@ describe('Claim', () => { beforeEach(ngModule('claim')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; const $element = angular.element(''); @@ -20,8 +20,7 @@ describe('Claim', () => { describe('getSummary()', () => { it('should perform a query to set summary', () => { - $httpBackend.when('GET', `Claims/1/getSummary`).respond(200, 24); - $httpBackend.expect('GET', `Claims/1/getSummary`); + $httpBackend.expect('GET', `Claims/1/getSummary`).respond(200, 24); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/client/front/address/create/index.js b/modules/client/front/address/create/index.js index 79774cf93..02c98ab3b 100644 --- a/modules/client/front/address/create/index.js +++ b/modules/client/front/address/create/index.js @@ -79,7 +79,7 @@ export default class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientAddressCreate', { +ngModule.vnComponent('vnClientAddressCreate', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/address/create/index.spec.js b/modules/client/front/address/create/index.spec.js index 4f332e75e..1a4340115 100644 --- a/modules/client/front/address/create/index.spec.js +++ b/modules/client/front/address/create/index.spec.js @@ -11,7 +11,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; $state = _$state_; diff --git a/modules/client/front/address/edit/index.js b/modules/client/front/address/edit/index.js index 58bca6322..363621327 100644 --- a/modules/client/front/address/edit/index.js +++ b/modules/client/front/address/edit/index.js @@ -81,7 +81,7 @@ export default class Controller extends Section { } } -ngModule.component('vnClientAddressEdit', { +ngModule.vnComponent('vnClientAddressEdit', { template: require('./index.html'), controller: Controller, require: { diff --git a/modules/client/front/address/edit/index.spec.js b/modules/client/front/address/edit/index.spec.js index c4c1a78b5..f763495ac 100644 --- a/modules/client/front/address/edit/index.spec.js +++ b/modules/client/front/address/edit/index.spec.js @@ -10,7 +10,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; $state = _$state_; diff --git a/modules/client/front/address/index/index.js b/modules/client/front/address/index/index.js index 6a9d7507b..ea6a9f6b9 100644 --- a/modules/client/front/address/index/index.js +++ b/modules/client/front/address/index/index.js @@ -50,7 +50,7 @@ class Controller extends Section { if (res.data) { this.client.defaultAddressFk = res.data.defaultAddressFk; this.sortAddresses(); - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); } }); } @@ -80,7 +80,7 @@ class Controller extends Section { } Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientAddressIndex', { +ngModule.vnComponent('vnClientAddressIndex', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/address/index/index.spec.js b/modules/client/front/address/index/index.spec.js index 4240e8629..c7b4985c8 100644 --- a/modules/client/front/address/index/index.spec.js +++ b/modules/client/front/address/index/index.spec.js @@ -10,7 +10,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => { $stateParams = _$stateParams_; $stateParams.id = 1; $httpBackend = _$httpBackend_; @@ -28,8 +28,7 @@ describe('Client', () => { let data = {defaultAddressFk: address.id}; let expectedResult = {defaultAddressFk: address.id}; - $httpBackend.when('PATCH', `Clients/1`, data).respond(200, expectedResult); - $httpBackend.expect('PATCH', `Clients/1`, data); + $httpBackend.expect('PATCH', `Clients/1`, data).respond(200, expectedResult); controller.setDefault(address); $httpBackend.flush(); diff --git a/modules/client/front/balance/index/index.js b/modules/client/front/balance/index/index.js index 582456d85..8f5261176 100644 --- a/modules/client/front/balance/index/index.js +++ b/modules/client/front/balance/index/index.js @@ -83,7 +83,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientBalanceIndex', { +ngModule.vnComponent('vnClientBalanceIndex', { template: require('./index.html'), controller: Controller, }); diff --git a/modules/client/front/balance/index/index.spec.js b/modules/client/front/balance/index/index.spec.js index 6a7a6e321..496407847 100644 --- a/modules/client/front/balance/index/index.spec.js +++ b/modules/client/front/balance/index/index.spec.js @@ -6,7 +6,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope) => { + beforeEach(inject(($componentController, $rootScope) => { let $scope = $rootScope.$new(); const $element = angular.element(''); controller = $componentController('vnClientBalanceIndex', {$element, $scope}); diff --git a/modules/client/front/basic-data/index.js b/modules/client/front/basic-data/index.js index 5d491ec75..3dc7dbc2d 100644 --- a/modules/client/front/basic-data/index.js +++ b/modules/client/front/basic-data/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -ngModule.component('vnClientBasicData', { +ngModule.vnComponent('vnClientBasicData', { template: require('./index.html'), controller: Section, bindings: { diff --git a/modules/client/front/billing-data/index.js b/modules/client/front/billing-data/index.js index 589c4f528..2dda347b9 100644 --- a/modules/client/front/billing-data/index.js +++ b/modules/client/front/billing-data/index.js @@ -77,7 +77,7 @@ export default class Controller extends Section { } } -ngModule.component('vnClientBillingData', { +ngModule.vnComponent('vnClientBillingData', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/billing-data/index.spec.js b/modules/client/front/billing-data/index.spec.js index 1b295abeb..dd44bd0fa 100644 --- a/modules/client/front/billing-data/index.spec.js +++ b/modules/client/front/billing-data/index.spec.js @@ -9,7 +9,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => { let $element = angular.element(''); $httpBackend = _$httpBackend_; vnApp = _vnApp_; diff --git a/modules/client/front/card/index.js b/modules/client/front/card/index.js index 5aacc83ea..76a4711d1 100644 --- a/modules/client/front/card/index.js +++ b/modules/client/front/card/index.js @@ -8,7 +8,7 @@ export default class Controller extends ModuleCard { } } -ngModule.component('vnClientCard', { +ngModule.vnComponent('vnClientCard', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/card/index.spec.js b/modules/client/front/card/index.spec.js index 72272fe89..979497253 100644 --- a/modules/client/front/card/index.spec.js +++ b/modules/client/front/card/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => { + beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { $httpBackend = _$httpBackend_; let $element = angular.element('
'); diff --git a/modules/client/front/consumption-search-panel/index.js b/modules/client/front/consumption-search-panel/index.js index 9b9354a93..685c0c1f5 100644 --- a/modules/client/front/consumption-search-panel/index.js +++ b/modules/client/front/consumption-search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnConsumptionSearchPanel', { +ngModule.vnComponent('vnConsumptionSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/client/front/consumption/index.js b/modules/client/front/consumption/index.js index 4b075abb9..e36e94682 100644 --- a/modules/client/front/consumption/index.js +++ b/modules/client/front/consumption/index.js @@ -57,7 +57,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail']; -ngModule.component('vnClientConsumption', { +ngModule.vnComponent('vnClientConsumption', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/consumption/index.spec.js b/modules/client/front/consumption/index.spec.js index d76bc1e76..9fe92fee1 100644 --- a/modules/client/front/consumption/index.spec.js +++ b/modules/client/front/consumption/index.spec.js @@ -10,7 +10,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => { $scope = $rootScope.$new(); $httpParamSerializer = _$httpParamSerializer_; $httpBackend = _$httpBackend_; diff --git a/modules/client/front/contact/index.js b/modules/client/front/contact/index.js index 4f29ddb8c..d79c7645a 100644 --- a/modules/client/front/contact/index.js +++ b/modules/client/front/contact/index.js @@ -5,7 +5,7 @@ class Controller extends Section { add() { this.$.model.insert({ clientFk: this.client.id, - name: this.$translate.instant('Phone'), + name: this.$t('Phone'), phone: null }); } @@ -19,7 +19,7 @@ class Controller extends Section { } } -ngModule.component('vnClientContact', { +ngModule.vnComponent('vnClientContact', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/create/index.js b/modules/client/front/create/index.js index 4f7ce4104..d8ded6560 100644 --- a/modules/client/front/create/index.js +++ b/modules/client/front/create/index.js @@ -86,7 +86,7 @@ export default class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientCreate', { +ngModule.vnComponent('vnClientCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/create/index.spec.js b/modules/client/front/create/index.spec.js index c6c31c084..24fc80d21 100644 --- a/modules/client/front/create/index.spec.js +++ b/modules/client/front/create/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => { + beforeEach(inject(($componentController, $rootScope, _$state_) => { $scope = $rootScope.$new(); $state = _$state_; $scope.watcher = { diff --git a/modules/client/front/credit-insurance/create/index.js b/modules/client/front/credit-insurance/create/index.js index 5ea2a8039..83dc18806 100644 --- a/modules/client/front/credit-insurance/create/index.js +++ b/modules/client/front/credit-insurance/create/index.js @@ -11,7 +11,7 @@ class Controller extends Section { onSubmit() { if (this.$.form.$invalid) - return this.vnApp.showError(this.$translate.instant('Some fields are invalid')); + return this.vnApp.showError(this.$t('Some fields are invalid')); let query = `creditClassifications/createWithInsurance`; let data = this.creditClassification; @@ -28,7 +28,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientCreditInsuranceCreate', { +ngModule.vnComponent('vnClientCreditInsuranceCreate', { template: require('./index.html'), controller: Controller, require: { diff --git a/modules/client/front/credit-insurance/create/index.spec.js b/modules/client/front/credit-insurance/create/index.spec.js index 29bd2c11e..83cec62f8 100644 --- a/modules/client/front/credit-insurance/create/index.spec.js +++ b/modules/client/front/credit-insurance/create/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); $scope.form = { diff --git a/modules/client/front/credit-insurance/index/index.html b/modules/client/front/credit-insurance/index/index.html index d2bf1fef6..b3ebb070d 100644 --- a/modules/client/front/credit-insurance/index/index.html +++ b/modules/client/front/credit-insurance/index/index.html @@ -60,7 +60,7 @@ \ No newline at end of file diff --git a/modules/client/front/credit-insurance/index/index.js b/modules/client/front/credit-insurance/index/index.js index e386444f4..5f59c918a 100644 --- a/modules/client/front/credit-insurance/index/index.js +++ b/modules/client/front/credit-insurance/index/index.js @@ -51,17 +51,15 @@ class Controller extends Section { this.$.closeContract.show(); } - returnDialog(response) { - if (response === 'accept') { - let params = {finished: Date.now()}; - this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => { - this._getClassifications(this.client.id); - }); - } + returnDialog() { + let params = {finished: Date.now()}; + this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => { + this._getClassifications(this.client.id); + }); } } -ngModule.component('vnClientCreditInsuranceIndex', { +ngModule.vnComponent('vnClientCreditInsuranceIndex', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/credit-insurance/index/index.spec.js b/modules/client/front/credit-insurance/index/index.spec.js index bed58a7d6..678301f28 100644 --- a/modules/client/front/credit-insurance/index/index.spec.js +++ b/modules/client/front/credit-insurance/index/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(''); @@ -77,9 +77,8 @@ describe('Client', () => { it('should call the returnDialog method and perform a PATCH query, then call _getClassifications method', () => { jest.spyOn(controller, '_getClassifications').mockReturnThis(); controller.classificationId = 1; - $httpBackend.when('PATCH', `CreditClassifications/1`).respond(200); - $httpBackend.expect('PATCH', `CreditClassifications/1`); - controller.returnDialog('accept'); + $httpBackend.expect('PATCH', `CreditClassifications/1`).respond(200); + controller.returnDialog(); $httpBackend.flush(); expect(controller._getClassifications).toHaveBeenCalledWith(101); diff --git a/modules/client/front/credit-insurance/insurance/create/index.js b/modules/client/front/credit-insurance/insurance/create/index.js index 2363cac76..94de53352 100644 --- a/modules/client/front/credit-insurance/insurance/create/index.js +++ b/modules/client/front/credit-insurance/insurance/create/index.js @@ -21,7 +21,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientCreditInsuranceInsuranceCreate', { +ngModule.vnComponent('vnClientCreditInsuranceInsuranceCreate', { template: require('./index.html'), controller: Controller, require: { diff --git a/modules/client/front/credit-insurance/insurance/index/index.js b/modules/client/front/credit-insurance/insurance/index/index.js index f78d06785..193a0b088 100644 --- a/modules/client/front/credit-insurance/insurance/index/index.js +++ b/modules/client/front/credit-insurance/insurance/index/index.js @@ -29,7 +29,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientCreditInsuranceInsuranceIndex', { +ngModule.vnComponent('vnClientCreditInsuranceInsuranceIndex', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/credit-insurance/insurance/index/index.spec.js b/modules/client/front/credit-insurance/insurance/index/index.spec.js index 490d6a924..34e557fa4 100644 --- a/modules/client/front/credit-insurance/insurance/index/index.spec.js +++ b/modules/client/front/credit-insurance/insurance/index/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; const $element = angular.element(''); diff --git a/modules/client/front/credit/create/index.html b/modules/client/front/credit/create/index.html index c77c1556c..e3160a2ae 100644 --- a/modules/client/front/credit/create/index.html +++ b/modules/client/front/credit/create/index.html @@ -25,7 +25,7 @@ diff --git a/modules/client/front/credit/create/index.js b/modules/client/front/credit/create/index.js index 049c206b3..3c1d376ed 100644 --- a/modules/client/front/credit/create/index.js +++ b/modules/client/front/credit/create/index.js @@ -16,9 +16,8 @@ class Controller extends Section { this.goToIndex(); } - returnDialog(response) { - if (response === 'accept') - this.addCredit(); + returnDialog() { + this.addCredit(); } goToIndex() { @@ -34,7 +33,7 @@ class Controller extends Section { } } -ngModule.component('vnClientCreditCreate', { +ngModule.vnComponent('vnClientCreditCreate', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/credit/create/index.spec.js b/modules/client/front/credit/create/index.spec.js index a69fb64a9..2fda0af65 100644 --- a/modules/client/front/credit/create/index.spec.js +++ b/modules/client/front/credit/create/index.spec.js @@ -10,7 +10,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope, _$state_) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope, _$state_) => { $scope = $rootScope.$new(); $scope.confirmation = {show: () => { return { @@ -75,7 +75,7 @@ describe('Client', () => { describe('returnDialog()', () => { it('should call addCredit() when is called with accept', () => { jest.spyOn(controller, 'addCredit'); - controller.returnDialog('accept'); + controller.returnDialog(); expect(controller.addCredit).toHaveBeenCalledWith(); }); diff --git a/modules/client/front/credit/index/index.js b/modules/client/front/credit/index/index.js index bea30b2d1..151aa35d6 100644 --- a/modules/client/front/credit/index/index.js +++ b/modules/client/front/credit/index/index.js @@ -25,7 +25,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientCreditIndex', { +ngModule.vnComponent('vnClientCreditIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/dms/create/index.js b/modules/client/front/dms/create/index.js index 0422ab6a6..3c3f20100 100644 --- a/modules/client/front/dms/create/index.js +++ b/modules/client/front/dms/create/index.js @@ -33,7 +33,7 @@ class Controller extends Section { } get contentTypesInfo() { - return this.$translate.instant('ContentTypesInfo', { + return this.$t('ContentTypesInfo', { allowedContentTypes: this.allowedContentTypes }); } @@ -51,7 +51,7 @@ class Controller extends Section { warehouseId: warehouseId, companyId: companyId, dmsTypeId: dmsType.id, - description: this.$translate.instant('ClientFileDescription', { + description: this.$t('ClientFileDescription', { dmsTypeName: dmsType.name, clientId: this.client.id, clientName: this.client.name @@ -83,7 +83,7 @@ class Controller extends Section { }; this.$http(options).then(res => { if (res) { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.watcher.updateOriginalData(); this.$state.go('client.card.dms.index'); } @@ -104,7 +104,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientDmsCreate', { +ngModule.vnComponent('vnClientDmsCreate', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/dms/create/index.spec.js b/modules/client/front/dms/create/index.spec.js index 0f0e2cb09..0ed3f6671 100644 --- a/modules/client/front/dms/create/index.spec.js +++ b/modules/client/front/dms/create/index.spec.js @@ -9,7 +9,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; @@ -39,8 +39,7 @@ describe('Client', () => { where: {code: 'paymentsLaw'} }}; let serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 12, code: 'paymentsLaw'}); - $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`); + $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 12, code: 'paymentsLaw'}); controller.setDefaultParams(); $httpBackend.flush(); @@ -63,8 +62,7 @@ describe('Client', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `clientDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `clientDms/allowedContentTypes`); + $httpBackend.expect('GET', `clientDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/client/front/dms/edit/index.js b/modules/client/front/dms/edit/index.js index dedd67e3f..2b8a7046d 100644 --- a/modules/client/front/dms/edit/index.js +++ b/modules/client/front/dms/edit/index.js @@ -24,7 +24,7 @@ class Controller extends Section { } get contentTypesInfo() { - return this.$translate.instant('ContentTypesInfo', { + return this.$t('ContentTypesInfo', { allowedContentTypes: this.allowedContentTypes }); } @@ -67,7 +67,7 @@ class Controller extends Section { }; this.$http(options).then(res => { if (res) { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.watcher.updateOriginalData(); this.$state.go('client.card.dms.index'); } @@ -85,7 +85,7 @@ class Controller extends Section { } } -ngModule.component('vnClientDmsEdit', { +ngModule.vnComponent('vnClientDmsEdit', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/dms/edit/index.spec.js b/modules/client/front/dms/edit/index.spec.js index f4aaf52f8..e52ab7f7b 100644 --- a/modules/client/front/dms/edit/index.spec.js +++ b/modules/client/front/dms/edit/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; const $element = angular.element(''); @@ -45,7 +45,6 @@ describe('Client', () => { hasFileAttached: false }; - $httpBackend.when('GET', `Dms/${dmsId}`).respond(expectedResponse); $httpBackend.expect('GET', `Dms/${dmsId}`).respond(expectedResponse); controller.setDefaultParams(); $httpBackend.flush(); @@ -70,8 +69,7 @@ describe('Client', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `clientDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `clientDms/allowedContentTypes`); + $httpBackend.expect('GET', `clientDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/client/front/dms/index/index.js b/modules/client/front/dms/index/index.js index c80b65c9f..c65de39e4 100644 --- a/modules/client/front/dms/index/index.js +++ b/modules/client/front/dms/index/index.js @@ -58,7 +58,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope', 'vnFile']; -ngModule.component('vnClientDmsIndex', { +ngModule.vnComponent('vnClientDmsIndex', { template: require('./index.html'), controller: Controller, }); diff --git a/modules/client/front/dms/index/index.spec.js b/modules/client/front/dms/index/index.spec.js index e94cca806..71c8d74a9 100644 --- a/modules/client/front/dms/index/index.spec.js +++ b/modules/client/front/dms/index/index.spec.js @@ -9,7 +9,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); controller = $componentController('vnClientDmsIndex', {$element: null, $scope}); diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js index 92e27e54f..30c7d7656 100644 --- a/modules/client/front/fiscal-data/index.js +++ b/modules/client/front/fiscal-data/index.js @@ -65,7 +65,7 @@ export default class Controller extends Section { onAcceptEt() { const query = `Clients/${this.client.id}/addressesPropagateRe`; return this.$http.patch(query, {isEqualizated: this.client.isEqualizated}).then( - () => this.vnApp.showMessage(this.$translate.instant('Equivalent tax spreaded')) + () => this.vnApp.showMessage(this.$t('Equivalent tax spreaded')) ); } @@ -162,7 +162,7 @@ export default class Controller extends Section { } } -ngModule.component('vnClientFiscalData', { +ngModule.vnComponent('vnClientFiscalData', { template: require('./index.html'), controller: Controller, require: {card: '^vnClientCard'}, diff --git a/modules/client/front/fiscal-data/index.spec.js b/modules/client/front/fiscal-data/index.spec.js index 29608303c..e028d01f3 100644 --- a/modules/client/front/fiscal-data/index.spec.js +++ b/modules/client/front/fiscal-data/index.spec.js @@ -10,7 +10,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); $scope.watcher = watcher; @@ -126,8 +126,7 @@ describe('Client', () => { describe('onAcceptEt()', () => { it('should request to patch the propagation of tax status', () => { controller.client = {id: 123, isEqualizated: false}; - $httpBackend.when('PATCH', `Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done'); - $httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}); + $httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done'); controller.onAcceptEt(); $httpBackend.flush(); }); diff --git a/modules/client/front/greuge/create/index.js b/modules/client/front/greuge/create/index.js index 3154d15f0..baf9f6a49 100644 --- a/modules/client/front/greuge/create/index.js +++ b/modules/client/front/greuge/create/index.js @@ -28,7 +28,7 @@ class Controller extends Section { } Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientGreugeCreate', { +ngModule.vnComponent('vnClientGreugeCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/greuge/create/index.spec.js b/modules/client/front/greuge/create/index.spec.js index cb52ae2a7..2d900d258 100644 --- a/modules/client/front/greuge/create/index.spec.js +++ b/modules/client/front/greuge/create/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => { + beforeEach(inject(($componentController, $rootScope, _$state_) => { $scope = $rootScope.$new(); $state = _$state_; $scope.watcher = { diff --git a/modules/client/front/greuge/index/index.js b/modules/client/front/greuge/index/index.js index bacb93544..2451167a4 100644 --- a/modules/client/front/greuge/index/index.js +++ b/modules/client/front/greuge/index/index.js @@ -20,7 +20,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientGreugeIndex', { +ngModule.vnComponent('vnClientGreugeIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/index/index.html b/modules/client/front/index/index.html index 6a64954aa..7493ecace 100644 --- a/modules/client/front/index/index.html +++ b/modules/client/front/index/index.html @@ -65,5 +65,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/modules/client/front/index/index.js b/modules/client/front/index/index.js index f5400e05a..07d4a8803 100644 --- a/modules/client/front/index/index.js +++ b/modules/client/front/index/index.js @@ -21,7 +21,7 @@ export default class Controller extends Section { } } -ngModule.component('vnClientIndex', { +ngModule.vnComponent('vnClientIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/index/index.spec.js b/modules/client/front/index/index.spec.js index 110db5e6a..4fc2c4f8c 100644 --- a/modules/client/front/index/index.spec.js +++ b/modules/client/front/index/index.spec.js @@ -7,7 +7,7 @@ describe('Client index', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$state_, $rootScope) => { + beforeEach(inject(($componentController, _$state_, $rootScope) => { $state = _$state_; $scope = $rootScope.$new(); const $element = angular.element(''); diff --git a/modules/client/front/log/index.js b/modules/client/front/log/index.js index e4cac6e58..f4aa99bfd 100644 --- a/modules/client/front/log/index.js +++ b/modules/client/front/log/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -ngModule.component('vnClientLog', { +ngModule.vnComponent('vnClientLog', { template: require('./index.html'), controller: Section, }); diff --git a/modules/client/front/mandate/index.js b/modules/client/front/mandate/index.js index 640678e42..114e2b570 100644 --- a/modules/client/front/mandate/index.js +++ b/modules/client/front/mandate/index.js @@ -24,7 +24,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientMandate', { +ngModule.vnComponent('vnClientMandate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/note/create/index.js b/modules/client/front/note/create/index.js index 108aba407..c540c3a0b 100644 --- a/modules/client/front/note/create/index.js +++ b/modules/client/front/note/create/index.js @@ -15,7 +15,7 @@ export default class Controller extends Section { } } -ngModule.component('vnNoteCreate', { +ngModule.vnComponent('vnNoteCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/note/create/index.spec.js b/modules/client/front/note/create/index.spec.js index 0dc515b1e..117aa0720 100644 --- a/modules/client/front/note/create/index.spec.js +++ b/modules/client/front/note/create/index.spec.js @@ -7,7 +7,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$state_) => { + beforeEach(inject(($componentController, _$state_) => { $state = _$state_; $state.params.id = '1234'; const $element = angular.element(''); diff --git a/modules/client/front/note/index/index.js b/modules/client/front/note/index/index.js index 654c460e4..ed15db671 100644 --- a/modules/client/front/note/index/index.js +++ b/modules/client/front/note/index/index.js @@ -13,7 +13,7 @@ export default class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientNote', { +ngModule.vnComponent('vnClientNote', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/postcode/index.js b/modules/client/front/postcode/index.js index c05ea0518..aca7a44d3 100644 --- a/modules/client/front/postcode/index.js +++ b/modules/client/front/postcode/index.js @@ -35,18 +35,18 @@ class Controller extends Component { throw new Error(`The town can't be empty`); this.$http.patch(`postcodes`, this.data).then(res => { - this.vnApp.showMessage(this.$translate.instant('The postcode has been saved')); + this.vnApp.showMessage(this.$t('The postcode has been saved')); this.emit('response', {$response: res.data}); }); } catch (e) { - this.vnApp.showError(this.$translate.instant(e.message)); + this.vnApp.showError(this.$t(e.message)); return false; } return true; } } -ngModule.component('vnClientPostcode', { +ngModule.vnComponent('vnClientPostcode', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/postcode/index.spec.js b/modules/client/front/postcode/index.spec.js index 2cefb6985..8778fd9b0 100644 --- a/modules/client/front/postcode/index.spec.js +++ b/modules/client/front/postcode/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(''); @@ -22,8 +22,7 @@ describe('Client', () => { controller.data = {townFk: 1, provinceFk: 1, countryFk: 1, code: '46460'}; jest.spyOn(controller.vnApp, 'showMessage'); - $httpBackend.when('PATCH', `postcodes`, params).respond(200, params); - $httpBackend.expect('PATCH', `postcodes`, params).respond(params); + $httpBackend.expect('PATCH', `postcodes`, params).respond(200, params); controller.onAccept(); $httpBackend.flush(); diff --git a/modules/client/front/recovery/create/index.js b/modules/client/front/recovery/create/index.js index aa378203b..4fd05eaa0 100644 --- a/modules/client/front/recovery/create/index.js +++ b/modules/client/front/recovery/create/index.js @@ -28,7 +28,7 @@ class Controller extends Section { } Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientRecoveryCreate', { +ngModule.vnComponent('vnClientRecoveryCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/recovery/create/index.spec.js b/modules/client/front/recovery/create/index.spec.js index d2635ee8d..ec9054140 100644 --- a/modules/client/front/recovery/create/index.spec.js +++ b/modules/client/front/recovery/create/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => { + beforeEach(inject(($componentController, $rootScope, _$state_) => { $scope = $rootScope.$new(); $state = _$state_; $scope.watcher = { diff --git a/modules/client/front/recovery/index/index.js b/modules/client/front/recovery/index/index.js index f82430982..d53ded805 100644 --- a/modules/client/front/recovery/index/index.js +++ b/modules/client/front/recovery/index/index.js @@ -12,7 +12,7 @@ class Controller extends Section { } } -ngModule.component('vnClientRecoveryIndex', { +ngModule.vnComponent('vnClientRecoveryIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/sample/create/index.js b/modules/client/front/sample/create/index.js index d1dfd3ff5..bc2cee39d 100644 --- a/modules/client/front/sample/create/index.js +++ b/modules/client/front/sample/create/index.js @@ -53,7 +53,7 @@ class Controller extends Section { sendSample() { this.send(false, () => { - this.vnApp.showSuccess(this.$translate.instant('Notification sent!')); + this.vnApp.showSuccess(this.$t('Notification sent!')); this.$state.go('client.card.sample.index'); }); } @@ -66,13 +66,13 @@ class Controller extends Section { }; if (!params.recipient) - return this.vnApp.showError(this.$translate.instant('Email cannot be blank')); + return this.vnApp.showError(this.$t('Email cannot be blank')); if (!sampleType) - return this.vnApp.showError(this.$translate.instant('Choose a sample')); + return this.vnApp.showError(this.$t('Choose a sample')); if (sampleType.hasCompany && !this.clientSample.companyFk) - return this.vnApp.showError(this.$translate.instant('Choose a company')); + return this.vnApp.showError(this.$t('Choose a company')); if (sampleType.hasCompany) params.companyId = this.clientSample.companyFk; @@ -85,7 +85,7 @@ class Controller extends Section { } Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientSampleCreate', { +ngModule.vnComponent('vnClientSampleCreate', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/sample/create/index.spec.js b/modules/client/front/sample/create/index.spec.js index af7f2f3ff..40fa237b6 100644 --- a/modules/client/front/sample/create/index.spec.js +++ b/modules/client/front/sample/create/index.spec.js @@ -11,7 +11,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope, _$state_, _$httpParamSerializer_) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope, _$state_, _$httpParamSerializer_) => { $scope = $rootScope.$new(); $scope.sampleType = {}; $scope.watcher = { diff --git a/modules/client/front/sample/index/index.js b/modules/client/front/sample/index/index.js index c5e8a72cd..e93c2d2dc 100644 --- a/modules/client/front/sample/index/index.js +++ b/modules/client/front/sample/index/index.js @@ -33,7 +33,7 @@ class Controller extends Section { } } -ngModule.component('vnClientSampleIndex', { +ngModule.vnComponent('vnClientSampleIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/search-panel/index.js b/modules/client/front/search-panel/index.js index 8c30982f5..bdbbcdaef 100644 --- a/modules/client/front/search-panel/index.js +++ b/modules/client/front/search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnClientSearchPanel', { +ngModule.vnComponent('vnClientSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index fb2f1dfff..6915942c2 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -1,6 +1,6 @@ + on-accept="$ctrl.onResponse()">
Send SMS
diff --git a/modules/client/front/sms/index.js b/modules/client/front/sms/index.js index 3dfdda8a3..701ee39af 100644 --- a/modules/client/front/sms/index.js +++ b/modules/client/front/sms/index.js @@ -16,25 +16,23 @@ class Controller extends Section { return maxLength - textAreaLength; } - onResponse(response) { - if (response === 'accept') { - try { - if (!this.sms.destination) - throw new Error(`The destination can't be empty`); - if (!this.sms.message) - throw new Error(`The message can't be empty`); - if (this.charactersRemaining() < 0) - throw new Error(`The message it's too long`); + onResponse() { + try { + if (!this.sms.destination) + throw new Error(`The destination can't be empty`); + if (!this.sms.message) + throw new Error(`The message can't be empty`); + if (this.charactersRemaining() < 0) + throw new Error(`The message it's too long`); - this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => { - this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => { + this.vnApp.showMessage(this.$t('SMS sent!')); - if (res.data) this.emit('send', {response: res.data}); - }); - } catch (e) { - this.vnApp.showError(this.$translate.instant(e.message)); - return false; - } + if (res.data) this.emit('send', {response: res.data}); + }); + } catch (e) { + this.vnApp.showError(this.$t(e.message)); + return false; } return true; } @@ -42,7 +40,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope', '$http', '$translate', 'vnApp']; -ngModule.component('vnClientSms', { +ngModule.vnComponent('vnClientSms', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/sms/index.spec.js b/modules/client/front/sms/index.spec.js index a7b4cd3df..3462bf681 100644 --- a/modules/client/front/sms/index.spec.js +++ b/modules/client/front/sms/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; let $scope = $rootScope.$new(); $element = angular.element(''); @@ -30,7 +30,7 @@ describe('Client', () => { jest.spyOn(controller.vnApp, 'showMessage'); $httpBackend.expect('POST', `Clients/101/sendSms`, params).respond(200, params); - controller.onResponse('accept'); + controller.onResponse(); $httpBackend.flush(); expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); diff --git a/modules/client/front/summary/index.js b/modules/client/front/summary/index.js index 4dd299903..5737e2df4 100644 --- a/modules/client/front/summary/index.js +++ b/modules/client/front/summary/index.js @@ -38,7 +38,7 @@ class Controller extends Section { } } -ngModule.component('vnClientSummary', { +ngModule.vnComponent('vnClientSummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/summary/index.spec.js b/modules/client/front/summary/index.spec.js index 1c747d25a..05491267c 100644 --- a/modules/client/front/summary/index.spec.js +++ b/modules/client/front/summary/index.spec.js @@ -8,7 +8,7 @@ describe('Client', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(''); @@ -21,8 +21,7 @@ describe('Client', () => { let res = {name: 'Superman', classifications: []}; jest.spyOn(controller, 'sumRisk').mockReturnThis(); - $httpBackend.when('GET', `Clients/101/summary`).respond(200, res); - $httpBackend.expect('GET', `Clients/101/summary`); + $httpBackend.expect('GET', `Clients/101/summary`).respond(200, res); controller.$onChanges(); $httpBackend.flush(); diff --git a/modules/client/front/web-access/index.html b/modules/client/front/web-access/index.html index 590e823d3..f7488dbdf 100644 --- a/modules/client/front/web-access/index.html +++ b/modules/client/front/web-access/index.html @@ -34,7 +34,7 @@ + on-accept="$ctrl.onPassChange()"> { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); - }); - } catch (e) { - this.vnApp.showError(this.$translate.instant(e.message)); + this.$http.patch(`Accounts/${this.client.id}`, account).then(res => { + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } catch (e) { + this.vnApp.showError(this.$t(e.message)); - return false; - } + return false; } return true; @@ -64,7 +62,7 @@ export default class Controller extends Section { } Controller.$inject = ['$element', '$scope']; -ngModule.component('vnClientWebAccess', { +ngModule.vnComponent('vnClientWebAccess', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/client/front/web-access/index.spec.js b/modules/client/front/web-access/index.spec.js index 0ed3345d1..73c4f1043 100644 --- a/modules/client/front/web-access/index.spec.js +++ b/modules/client/front/web-access/index.spec.js @@ -8,7 +8,7 @@ describe('Component VnClientWebAccess', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; vnApp = _vnApp_; @@ -57,8 +57,7 @@ describe('Component VnClientWebAccess', () => { expect(controller.canEnableCheckBox).toBeTruthy(); - $httpBackend.when('GET', `Clients/${controller.client.id}/isValidClient`).respond(false); - $httpBackend.expectGET(`Clients/${controller.client.id}/isValidClient`); + $httpBackend.expectGET(`Clients/${controller.client.id}/isValidClient`).respond(false); controller.checkConditions(); $httpBackend.flush(); @@ -83,9 +82,8 @@ describe('Component VnClientWebAccess', () => { controller.newPassword = 'm24x8'; controller.repeatPassword = 'm24x8'; controller.canChangePassword = true; - $httpBackend.when('PATCH', 'Accounts/1234').respond('done'); - $httpBackend.expectPATCH('Accounts/1234', {password: 'm24x8'}); - controller.onPassChange('accept'); + $httpBackend.expectPATCH('Accounts/1234', {password: 'm24x8'}).respond('done'); + controller.onPassChange(); $httpBackend.flush(); }); @@ -94,7 +92,7 @@ describe('Component VnClientWebAccess', () => { controller.client = {id: '1234'}; controller.newPassword = ''; controller.canChangePassword = true; - controller.onPassChange('accept'); + controller.onPassChange(); expect(vnApp.showError).toHaveBeenCalledWith(`You must enter a new password`); }); @@ -106,7 +104,7 @@ describe('Component VnClientWebAccess', () => { controller.newPassword = 'm24x8'; controller.canChangePassword = true; controller.repeatPassword = 'notMatchingPassword'; - controller.onPassChange('accept'); + controller.onPassChange(); expect(vnApp.showError).toHaveBeenCalledWith(`Passwords don't match`); }); diff --git a/modules/client/front/web-payment/index.js b/modules/client/front/web-payment/index.js index c68abf49e..00d0adc4d 100644 --- a/modules/client/front/web-payment/index.js +++ b/modules/client/front/web-payment/index.js @@ -21,7 +21,7 @@ class Controller extends Section { } } -ngModule.component('vnClientWebPayment', { +ngModule.vnComponent('vnClientWebPayment', { template: require('./index.html'), controller: Controller }); diff --git a/modules/client/front/web-payment/index.spec.js b/modules/client/front/web-payment/index.spec.js index ee07f2fff..ee7d6c717 100644 --- a/modules/client/front/web-payment/index.spec.js +++ b/modules/client/front/web-payment/index.spec.js @@ -9,7 +9,7 @@ describe('Component vnClientWebPayment', () => { beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => { $scope = $rootScope.$new(); $scope.model = crudModel; $httpBackend = _$httpBackend_; @@ -25,8 +25,7 @@ describe('Component vnClientWebPayment', () => { let query = 'Clients/confirmTransaction'; controller.confirm(transaction); - $httpBackend.when('POST', query, transaction).respond('ok'); - $httpBackend.expect('POST', query, transaction); + $httpBackend.expect('POST', query, transaction).respond('ok'); $httpBackend.flush(); }); }); diff --git a/modules/entry/front/buy/index.js b/modules/entry/front/buy/index.js index 674243eb1..00a8421fb 100644 --- a/modules/entry/front/buy/index.js +++ b/modules/entry/front/buy/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -ngModule.component('vnEntryBuy', { +ngModule.vnComponent('vnEntryBuy', { template: require('./index.html'), controller: Section, bindings: { diff --git a/modules/entry/front/card/index.js b/modules/entry/front/card/index.js index 83f47c83d..f9ab6187c 100644 --- a/modules/entry/front/card/index.js +++ b/modules/entry/front/card/index.js @@ -50,7 +50,7 @@ class Controller extends ModuleCard { } } -ngModule.component('vnEntryCard', { +ngModule.vnComponent('vnEntryCard', { template: require('./index.html'), controller: Controller }); diff --git a/modules/entry/front/index/index.js b/modules/entry/front/index/index.js index 60d70afcb..759ce2724 100644 --- a/modules/entry/front/index/index.js +++ b/modules/entry/front/index/index.js @@ -3,7 +3,7 @@ import Section from 'salix/components/section'; export default class Controller extends Section {} -ngModule.component('vnEntryIndex', { +ngModule.vnComponent('vnEntryIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/entry/front/log/index.js b/modules/entry/front/log/index.js index d045f2035..73218f4de 100644 --- a/modules/entry/front/log/index.js +++ b/modules/entry/front/log/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -ngModule.component('vnEntryLog', { +ngModule.vnComponent('vnEntryLog', { template: require('./index.html'), controller: Section, }); diff --git a/modules/entry/front/search-panel/index.js b/modules/entry/front/search-panel/index.js index d728fe5e8..e87f31056 100644 --- a/modules/entry/front/search-panel/index.js +++ b/modules/entry/front/search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnEntrySearchPanel', { +ngModule.vnComponent('vnEntrySearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/entry/front/summary/index.js b/modules/entry/front/summary/index.js index 94eaf1791..f0b4c62b3 100644 --- a/modules/entry/front/summary/index.js +++ b/modules/entry/front/summary/index.js @@ -21,7 +21,7 @@ class Controller extends Section { } } -ngModule.component('vnEntrySummary', { +ngModule.vnComponent('vnEntrySummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/entry/front/summary/index.spec.js b/modules/entry/front/summary/index.spec.js index a59bb8009..a2d25d0d6 100644 --- a/modules/entry/front/summary/index.spec.js +++ b/modules/entry/front/summary/index.spec.js @@ -9,7 +9,7 @@ describe('component vnEntrySummary', () => { $translateProvider.translations('en', {}); })); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(``); diff --git a/modules/invoiceOut/front/card/index.js b/modules/invoiceOut/front/card/index.js index 0ad91f4c2..f718f22ae 100644 --- a/modules/invoiceOut/front/card/index.js +++ b/modules/invoiceOut/front/card/index.js @@ -32,7 +32,7 @@ class Controller extends ModuleCard { } } -ngModule.component('vnInvoiceOutCard', { +ngModule.vnComponent('vnInvoiceOutCard', { template: require('./index.html'), controller: Controller }); diff --git a/modules/invoiceOut/front/index/index.js b/modules/invoiceOut/front/index/index.js index 17eb44fec..c884fb90b 100644 --- a/modules/invoiceOut/front/index/index.js +++ b/modules/invoiceOut/front/index/index.js @@ -13,7 +13,7 @@ export default class Controller extends Section { } } -ngModule.component('vnInvoiceOutIndex', { +ngModule.vnComponent('vnInvoiceOutIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/invoiceOut/front/search-panel/index.js b/modules/invoiceOut/front/search-panel/index.js index 1ca545ec7..a77d479ca 100644 --- a/modules/invoiceOut/front/search-panel/index.js +++ b/modules/invoiceOut/front/search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnInvoiceSearchPanel', { +ngModule.vnComponent('vnInvoiceSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/invoiceOut/front/summary/index.js b/modules/invoiceOut/front/summary/index.js index ef76768de..dd4237850 100644 --- a/modules/invoiceOut/front/summary/index.js +++ b/modules/invoiceOut/front/summary/index.js @@ -19,7 +19,7 @@ class Controller extends Section { } } -ngModule.component('vnInvoiceOutSummary', { +ngModule.vnComponent('vnInvoiceOutSummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/invoiceOut/front/summary/index.spec.js b/modules/invoiceOut/front/summary/index.spec.js index ac6c40bcf..fadf0ad89 100644 --- a/modules/invoiceOut/front/summary/index.spec.js +++ b/modules/invoiceOut/front/summary/index.spec.js @@ -8,7 +8,7 @@ describe('InvoiceOut', () => { beforeEach(ngModule('invoiceOut')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(''); @@ -19,7 +19,6 @@ describe('InvoiceOut', () => { describe('getSummary()', () => { it('should perform a query to set summary', () => { $httpBackend.when('GET', `InvoiceOuts/1/summary`).respond(200, 'the data you are looking for'); - $httpBackend.expect('GET', `InvoiceOuts/1/summary`); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/item/front/barcode/index.js b/modules/item/front/barcode/index.js index d9e17a42a..4ceb87b9d 100644 --- a/modules/item/front/barcode/index.js +++ b/modules/item/front/barcode/index.js @@ -11,7 +11,7 @@ export default class Controller extends Section { } } -ngModule.component('vnItemBarcode', { +ngModule.vnComponent('vnItemBarcode', { template: require('./index.html'), controller: Controller }); diff --git a/modules/item/front/basic-data/index.js b/modules/item/front/basic-data/index.js index fb80c5178..1a256c65b 100644 --- a/modules/item/front/basic-data/index.js +++ b/modules/item/front/basic-data/index.js @@ -19,7 +19,7 @@ class Controller extends Section { } } -ngModule.component('vnItemBasicData', { +ngModule.vnComponent('vnItemBasicData', { template: require('./index.html'), bindings: { item: '<' diff --git a/modules/item/front/basic-data/index.spec.js b/modules/item/front/basic-data/index.spec.js index fd7be5d93..274453d30 100644 --- a/modules/item/front/basic-data/index.spec.js +++ b/modules/item/front/basic-data/index.spec.js @@ -8,7 +8,7 @@ describe('vnItemBasicData', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(''); diff --git a/modules/item/front/botanical/index.js b/modules/item/front/botanical/index.js index 03c62a0e3..61eed3ce8 100644 --- a/modules/item/front/botanical/index.js +++ b/modules/item/front/botanical/index.js @@ -26,7 +26,7 @@ class Controller extends Section { } } -ngModule.component('vnItemBotanical', { +ngModule.vnComponent('vnItemBotanical', { template: require('./index.html'), controller: Controller }); diff --git a/modules/item/front/botanical/index.spec.js b/modules/item/front/botanical/index.spec.js index 1cf79bbb3..24e48e4ae 100644 --- a/modules/item/front/botanical/index.spec.js +++ b/modules/item/front/botanical/index.spec.js @@ -8,7 +8,7 @@ describe('ItemBotanical', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(''); diff --git a/modules/item/front/card/index.js b/modules/item/front/card/index.js index 12167500f..8b32e030b 100644 --- a/modules/item/front/card/index.js +++ b/modules/item/front/card/index.js @@ -8,7 +8,7 @@ class Controller extends ModuleCard { } } -ngModule.component('vnItemCard', { +ngModule.vnComponent('vnItemCard', { template: require('./index.html'), controller: Controller }); diff --git a/modules/item/front/card/index.spec.js b/modules/item/front/card/index.spec.js index c0ea80e69..2c97f5935 100644 --- a/modules/item/front/card/index.spec.js +++ b/modules/item/front/card/index.spec.js @@ -8,7 +8,7 @@ describe('Item', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => { + beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { $httpBackend = _$httpBackend_; let $element = angular.element('
'); diff --git a/modules/item/front/create/index.js b/modules/item/front/create/index.js index ab51b0734..d207e6f5b 100644 --- a/modules/item/front/create/index.js +++ b/modules/item/front/create/index.js @@ -18,7 +18,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnItemCreate', { +ngModule.vnComponent('vnItemCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/item/front/create/index.spec.js b/modules/item/front/create/index.spec.js index 518d5f78b..9e54988d7 100644 --- a/modules/item/front/create/index.spec.js +++ b/modules/item/front/create/index.spec.js @@ -8,7 +8,7 @@ describe('Item', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => { + beforeEach(inject(($componentController, $rootScope, _$state_) => { $scope = $rootScope.$new(); $state = _$state_; $scope.watcher = { diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js index e1a15096a..953d203e8 100644 --- a/modules/item/front/diary/index.js +++ b/modules/item/front/diary/index.js @@ -67,7 +67,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope', '$anchorScroll', '$location']; -ngModule.component('vnItemDiary', { +ngModule.vnComponent('vnItemDiary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js index b6e50e5c5..52608cde3 100644 --- a/modules/item/front/diary/index.spec.js +++ b/modules/item/front/diary/index.spec.js @@ -8,7 +8,7 @@ describe('Item', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject(($componentController, $rootScope) => { + beforeEach(inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); const $element = angular.element(''); controller = $componentController('vnItemDiary', {$element, $scope}); diff --git a/modules/item/front/fetched-tags/index.js b/modules/item/front/fetched-tags/index.js index 9140abcf4..da18b7a7c 100644 --- a/modules/item/front/fetched-tags/index.js +++ b/modules/item/front/fetched-tags/index.js @@ -2,7 +2,7 @@ import ngModule from '../module'; import Component from 'core/lib/component'; import './style.scss'; -ngModule.component('vnFetchedTags', { +ngModule.vnComponent('vnFetchedTags', { template: require('./index.html'), controller: Component, bindings: { diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index e852d7985..cafa3e475 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -24,7 +24,7 @@ class Controller extends Section { } } -ngModule.component('vnItemIndex', { +ngModule.vnComponent('vnItemIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/item/front/index/index.spec.js b/modules/item/front/index/index.spec.js index f8cf07fe3..18abde581 100644 --- a/modules/item/front/index/index.spec.js +++ b/modules/item/front/index/index.spec.js @@ -8,7 +8,7 @@ describe('Item', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(''); diff --git a/modules/item/front/last-entries/index.js b/modules/item/front/last-entries/index.js index 752f1b035..3f9d7be36 100644 --- a/modules/item/front/last-entries/index.js +++ b/modules/item/front/last-entries/index.js @@ -35,7 +35,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnItemLastEntries', { +ngModule.vnComponent('vnItemLastEntries', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/item/front/log/index.js b/modules/item/front/log/index.js index 4433b2460..953d48df3 100644 --- a/modules/item/front/log/index.js +++ b/modules/item/front/log/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -ngModule.component('vnItemLog', { +ngModule.vnComponent('vnItemLog', { template: require('./index.html'), controller: Section, }); diff --git a/modules/item/front/niche/index.js b/modules/item/front/niche/index.js index f4e7cd0be..51621b714 100644 --- a/modules/item/front/niche/index.js +++ b/modules/item/front/niche/index.js @@ -11,7 +11,7 @@ export default class Controller extends Section { } } -ngModule.component('vnItemNiche', { +ngModule.vnComponent('vnItemNiche', { template: require('./index.html'), controller: Controller }); diff --git a/modules/item/front/request-search-panel/index.js b/modules/item/front/request-search-panel/index.js index 07fcefd6b..82639b6e2 100644 --- a/modules/item/front/request-search-panel/index.js +++ b/modules/item/front/request-search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnRequestSearchPanel', { +ngModule.vnComponent('vnRequestSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js index a5f030e78..3801c926f 100644 --- a/modules/item/front/request/index.js +++ b/modules/item/front/request/index.js @@ -94,7 +94,7 @@ export default class Controller extends Section { } } -ngModule.component('vnItemRequest', { +ngModule.vnComponent('vnItemRequest', { template: require('./index.html'), controller: Controller }); diff --git a/modules/item/front/request/index.spec.js b/modules/item/front/request/index.spec.js index 8e384b04e..a33a21ec2 100644 --- a/modules/item/front/request/index.spec.js +++ b/modules/item/front/request/index.spec.js @@ -8,7 +8,7 @@ describe('Item', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); controller = $componentController('vnItemRequest', {$element: null, $scope}); diff --git a/modules/item/front/search-panel/index.js b/modules/item/front/search-panel/index.js index 6b3e7786d..f1a3367c4 100644 --- a/modules/item/front/search-panel/index.js +++ b/modules/item/front/search-panel/index.js @@ -73,7 +73,7 @@ class Controller extends SearchPanel { } } -ngModule.component('vnItemSearchPanel', { +ngModule.vnComponent('vnItemSearchPanel', { template: require('./index.html'), controller: Controller }); diff --git a/modules/item/front/search-panel/index.spec.js b/modules/item/front/search-panel/index.spec.js index cc0cf0375..0e2b7f848 100644 --- a/modules/item/front/search-panel/index.spec.js +++ b/modules/item/front/search-panel/index.spec.js @@ -7,7 +7,7 @@ describe('Item', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject($componentController => { + beforeEach(inject($componentController => { $element = angular.element(`
`); controller = $componentController('vnItemSearchPanel', {$element}); })); diff --git a/modules/item/front/summary/index.js b/modules/item/front/summary/index.js index d38f1f29a..5e441ecf1 100644 --- a/modules/item/front/summary/index.js +++ b/modules/item/front/summary/index.js @@ -15,7 +15,7 @@ class Controller extends Section { } } -ngModule.component('vnItemSummary', { +ngModule.vnComponent('vnItemSummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/item/front/summary/index.spec.js b/modules/item/front/summary/index.spec.js index 069c24512..0b349194c 100644 --- a/modules/item/front/summary/index.spec.js +++ b/modules/item/front/summary/index.spec.js @@ -8,7 +8,7 @@ describe('Item', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(''); @@ -19,8 +19,7 @@ describe('Item', () => { describe('getSummary()', () => { it('should perform a query to set summary', () => { let data = {id: 1, name: 'Gem of mind'}; - $httpBackend.when('GET', `Items/1/getSummary`).respond(200, data); - $httpBackend.expect('GET', `Items/1/getSummary`); + $httpBackend.expect('GET', `Items/1/getSummary`).respond(200, data); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/item/front/tags/index.js b/modules/item/front/tags/index.js index 8737aeed4..0a3ff0f2d 100644 --- a/modules/item/front/tags/index.js +++ b/modules/item/front/tags/index.js @@ -72,7 +72,7 @@ class Controller extends Section { } } -ngModule.component('vnItemTags', { +ngModule.vnComponent('vnItemTags', { template: require('./index.html'), controller: Controller, require: { diff --git a/modules/item/front/tags/index.spec.js b/modules/item/front/tags/index.spec.js index 10128e4f0..fabdc162b 100644 --- a/modules/item/front/tags/index.spec.js +++ b/modules/item/front/tags/index.spec.js @@ -8,7 +8,7 @@ describe('Item', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject(($componentController, $rootScope) => { + beforeEach(inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); $scope.model = crudModel; $scope.model.data = [{priority: 1}, {priority: 2}, {priority: 1}]; diff --git a/modules/item/front/tax/index.js b/modules/item/front/tax/index.js index 251e0802d..b72fbefa3 100644 --- a/modules/item/front/tax/index.js +++ b/modules/item/front/tax/index.js @@ -35,7 +35,7 @@ export default class Controller extends Section { } } -ngModule.component('vnItemTax', { +ngModule.vnComponent('vnItemTax', { template: require('./index.html'), controller: Controller }); diff --git a/modules/item/front/tax/index.spec.js b/modules/item/front/tax/index.spec.js index 95e46cfbf..0aec866b2 100644 --- a/modules/item/front/tax/index.spec.js +++ b/modules/item/front/tax/index.spec.js @@ -9,7 +9,7 @@ describe('Item', () => { beforeEach(ngModule('item')); - beforeEach(angular.mock.inject((_$httpBackend_, $rootScope, _$stateParams_, $compile) => { + beforeEach(inject((_$httpBackend_, $rootScope, _$stateParams_, $compile) => { $stateParams = _$stateParams_; $stateParams.id = 1; $httpBackend = _$httpBackend_; diff --git a/modules/item/front/waste/index.js b/modules/item/front/waste/index.js index d1a10fbf4..3c5d1a6be 100644 --- a/modules/item/front/waste/index.js +++ b/modules/item/front/waste/index.js @@ -2,7 +2,7 @@ import ngModule from '../module'; import Section from 'salix/components/section'; import './style.scss'; -ngModule.component('vnItemWaste', { +ngModule.vnComponent('vnItemWaste', { template: require('./index.html'), controller: Section }); diff --git a/modules/order/front/basic-data/index.js b/modules/order/front/basic-data/index.js index d1f1fc225..3719eb42f 100644 --- a/modules/order/front/basic-data/index.js +++ b/modules/order/front/basic-data/index.js @@ -22,7 +22,7 @@ class Controller extends Section { } } -ngModule.component('vnOrderBasicData', { +ngModule.vnComponent('vnOrderBasicData', { controller: Controller, template: require('./index.html'), bindings: { diff --git a/modules/order/front/basic-data/index.spec.js b/modules/order/front/basic-data/index.spec.js index 0150bd3b3..4442fadcc 100644 --- a/modules/order/front/basic-data/index.spec.js +++ b/modules/order/front/basic-data/index.spec.js @@ -8,7 +8,7 @@ describe('Order', () => { beforeEach(ngModule('order')); - beforeEach(angular.mock.inject(($compile, _$httpBackend_, $rootScope) => { + beforeEach(inject(($compile, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); diff --git a/modules/order/front/card/index.js b/modules/order/front/card/index.js index 80fa99d1d..d154b0b52 100644 --- a/modules/order/front/card/index.js +++ b/modules/order/front/card/index.js @@ -58,7 +58,7 @@ class Controller extends ModuleCard { } } -ngModule.component('vnOrderCard', { +ngModule.vnComponent('vnOrderCard', { template: require('./index.html'), controller: Controller }); diff --git a/modules/order/front/card/index.spec.js b/modules/order/front/card/index.spec.js index 19d070920..f0de26b72 100644 --- a/modules/order/front/card/index.spec.js +++ b/modules/order/front/card/index.spec.js @@ -9,7 +9,7 @@ describe('Order', () => { beforeEach(ngModule('order')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => { + beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { $httpBackend = _$httpBackend_; let $element = angular.element('
'); diff --git a/modules/order/front/catalog-search-panel/index.js b/modules/order/front/catalog-search-panel/index.js index 7d5f1bfd1..99f3e1c12 100644 --- a/modules/order/front/catalog-search-panel/index.js +++ b/modules/order/front/catalog-search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnOrderCatalogSearchPanel', { +ngModule.vnComponent('vnOrderCatalogSearchPanel', { template: require('./index.html'), controller: SearchPanel, bindings: { diff --git a/modules/order/front/catalog-view/index.js b/modules/order/front/catalog-view/index.js index 37a2b70a2..1e99ab82b 100644 --- a/modules/order/front/catalog-view/index.js +++ b/modules/order/front/catalog-view/index.js @@ -4,7 +4,7 @@ import './style.scss'; class Controller extends Component {} -ngModule.component('vnOrderCatalogView', { +ngModule.vnComponent('vnOrderCatalogView', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index 7d73a4dea..ddfe69cc9 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -344,7 +344,7 @@ class Controller extends Section { } } -ngModule.component('vnOrderCatalog', { +ngModule.vnComponent('vnOrderCatalog', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/order/front/catalog/index.spec.js b/modules/order/front/catalog/index.spec.js index f7635665a..eceb3eb66 100644 --- a/modules/order/front/catalog/index.spec.js +++ b/modules/order/front/catalog/index.spec.js @@ -10,7 +10,7 @@ describe('Order', () => { beforeEach(ngModule('order')); - beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$state_, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); $scope.model = crudModel; diff --git a/modules/order/front/create/card.js b/modules/order/front/create/card.js index 158ad9a10..315cc8255 100644 --- a/modules/order/front/create/card.js +++ b/modules/order/front/create/card.js @@ -99,13 +99,13 @@ class Controller extends Component { agencyModeId: this.order.agencyModeFk }; this.$http.post(`Orders/new`, params).then(res => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$state.go('order.card.catalog', {id: res.data}); }); } } -ngModule.component('vnOrderCreateCard', { +ngModule.vnComponent('vnOrderCreateCard', { template: require('./card.html'), controller: Controller, bindings: { diff --git a/modules/order/front/create/card.spec.js b/modules/order/front/create/card.spec.js index f8f0653a7..99e8c1f8a 100644 --- a/modules/order/front/create/card.spec.js +++ b/modules/order/front/create/card.spec.js @@ -8,7 +8,7 @@ describe('Order', () => { beforeEach(ngModule('order')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, _vnApp_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, _vnApp_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(''); @@ -91,12 +91,11 @@ describe('Order', () => { jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller.$state, 'go'); - $httpBackend.when('POST', 'Orders/new', {landed: 101, addressId: 101, agencyModeId: 101}).respond(200, 1); - $httpBackend.expect('POST', 'Orders/new', {landed: 101, addressId: 101, agencyModeId: 101}); + $httpBackend.expect('POST', 'Orders/new', {landed: 101, addressId: 101, agencyModeId: 101}).respond(200, 1); controller.createOrder(); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$state.go).toHaveBeenCalledWith('order.card.catalog', {id: 1}); }); }); diff --git a/modules/order/front/create/index.js b/modules/order/front/create/index.js index 5c02e8225..317c4e27e 100644 --- a/modules/order/front/create/index.js +++ b/modules/order/front/create/index.js @@ -8,7 +8,7 @@ class Controller extends Section { } } -ngModule.component('vnOrderCreate', { +ngModule.vnComponent('vnOrderCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/order/front/create/index.spec.js b/modules/order/front/create/index.spec.js index 82834a987..af8c8f974 100644 --- a/modules/order/front/create/index.spec.js +++ b/modules/order/front/create/index.spec.js @@ -7,7 +7,7 @@ describe('Order', () => { beforeEach(ngModule('order')); - beforeEach(angular.mock.inject(($componentController, $rootScope) => { + beforeEach(inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); $scope.card = {createOrder: () => {}}; const $element = angular.element(''); diff --git a/modules/order/front/index/index.js b/modules/order/front/index/index.js index ae3da68ae..0251f777f 100644 --- a/modules/order/front/index/index.js +++ b/modules/order/front/index/index.js @@ -22,7 +22,7 @@ export default class Controller extends Section { } } -ngModule.component('vnOrderIndex', { +ngModule.vnComponent('vnOrderIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/order/front/line/index.js b/modules/order/front/line/index.js index bd41acedc..94d1fbfbf 100644 --- a/modules/order/front/line/index.js +++ b/modules/order/front/line/index.js @@ -58,7 +58,7 @@ class Controller extends Section { } } -ngModule.component('vnOrderLine', { +ngModule.vnComponent('vnOrderLine', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/order/front/line/index.spec.js b/modules/order/front/line/index.spec.js index 458bbbdd8..ad0e1edbc 100644 --- a/modules/order/front/line/index.spec.js +++ b/modules/order/front/line/index.spec.js @@ -19,7 +19,7 @@ describe('Order', () => { beforeEach(ngModule('order')); - beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => { + beforeEach(inject(($componentController, _$state_, _$httpBackend_) => { $state = _$state_; $httpBackend = _$httpBackend_; diff --git a/modules/order/front/search-panel/index.js b/modules/order/front/search-panel/index.js index 1ab4c15cf..07be9ca24 100644 --- a/modules/order/front/search-panel/index.js +++ b/modules/order/front/search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnOrderSearchPanel', { +ngModule.vnComponent('vnOrderSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/order/front/summary/index.js b/modules/order/front/summary/index.js index 1597e5e0a..2ee07872c 100644 --- a/modules/order/front/summary/index.js +++ b/modules/order/front/summary/index.js @@ -32,7 +32,7 @@ class Controller extends Section { } } -ngModule.component('vnOrderSummary', { +ngModule.vnComponent('vnOrderSummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/order/front/summary/index.spec.js b/modules/order/front/summary/index.spec.js index f0e831aab..0c04593e1 100644 --- a/modules/order/front/summary/index.spec.js +++ b/modules/order/front/summary/index.spec.js @@ -7,7 +7,7 @@ describe('Order', () => { beforeEach(ngModule('order')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { + beforeEach(inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; const $element = angular.element(''); controller = $componentController('vnOrderSummary', {$element}); diff --git a/modules/order/front/volume/index.js b/modules/order/front/volume/index.js index 5941611ee..aaadf2af6 100644 --- a/modules/order/front/volume/index.js +++ b/modules/order/front/volume/index.js @@ -27,7 +27,7 @@ class Controller extends Section { } } -ngModule.component('vnOrderVolume', { +ngModule.vnComponent('vnOrderVolume', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/order/front/volume/index.spec.js b/modules/order/front/volume/index.spec.js index 241277d78..6d7b18865 100644 --- a/modules/order/front/volume/index.spec.js +++ b/modules/order/front/volume/index.spec.js @@ -8,7 +8,7 @@ describe('Order', () => { beforeEach(ngModule('order')); - beforeEach(angular.mock.inject(($componentController, $state, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, $state, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); $scope.model = { diff --git a/modules/route/front/basic-data/index.js b/modules/route/front/basic-data/index.js index cced46f55..b8602ed12 100644 --- a/modules/route/front/basic-data/index.js +++ b/modules/route/front/basic-data/index.js @@ -9,7 +9,7 @@ class Controller extends Section { } } -ngModule.component('vnRouteBasicData', { +ngModule.vnComponent('vnRouteBasicData', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/route/front/card/index.js b/modules/route/front/card/index.js index 0760259d3..5813c9e89 100644 --- a/modules/route/front/card/index.js +++ b/modules/route/front/card/index.js @@ -63,7 +63,7 @@ class Controller extends ModuleCard { } } -ngModule.component('vnRouteCard', { +ngModule.vnComponent('vnRouteCard', { template: require('./index.html'), controller: Controller }); diff --git a/modules/route/front/create/index.js b/modules/route/front/create/index.js index 703ecb49a..56c8cc25a 100644 --- a/modules/route/front/create/index.js +++ b/modules/route/front/create/index.js @@ -9,7 +9,7 @@ export default class Controller extends Section { } } -ngModule.component('vnRouteCreate', { +ngModule.vnComponent('vnRouteCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/route/front/index/index.js b/modules/route/front/index/index.js index 7014bc609..400684a0d 100644 --- a/modules/route/front/index/index.js +++ b/modules/route/front/index/index.js @@ -8,7 +8,7 @@ export default class Controller extends Section { } } -ngModule.component('vnRouteIndex', { +ngModule.vnComponent('vnRouteIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/route/front/log/index.js b/modules/route/front/log/index.js index b7d456b23..c1a7052a9 100644 --- a/modules/route/front/log/index.js +++ b/modules/route/front/log/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -ngModule.component('vnRouteLog', { +ngModule.vnComponent('vnRouteLog', { template: require('./index.html'), controller: Section, }); diff --git a/modules/route/front/search-panel/index.js b/modules/route/front/search-panel/index.js index 6226236f2..d2de05709 100644 --- a/modules/route/front/search-panel/index.js +++ b/modules/route/front/search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnRouteSearchPanel', { +ngModule.vnComponent('vnRouteSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/route/front/summary/index.js b/modules/route/front/summary/index.js index 95e208b84..66ad17a8d 100644 --- a/modules/route/front/summary/index.js +++ b/modules/route/front/summary/index.js @@ -29,7 +29,7 @@ class Controller extends Section { } } -ngModule.component('vnRouteSummary', { +ngModule.vnComponent('vnRouteSummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/route/front/summary/index.spec.js b/modules/route/front/summary/index.spec.js index 99c029394..ad300817a 100644 --- a/modules/route/front/summary/index.spec.js +++ b/modules/route/front/summary/index.spec.js @@ -7,7 +7,7 @@ describe('Route', () => { beforeEach(ngModule('route')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { + beforeEach(inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; const $element = angular.element(''); controller = $componentController('vnRouteSummary', {$element}); @@ -17,7 +17,6 @@ describe('Route', () => { describe('getSummary()', () => { it('should perform a query to set summary', () => { $httpBackend.when('GET', `Routes/1/summary`).respond(200, 24); - $httpBackend.expect('GET', `Routes/1/summary`); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index fee60dcca..9e48d50ed 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -108,7 +108,7 @@ + on-accept="$ctrl.removeTicketFromRoute()"> diff --git a/modules/route/front/tickets/index.js b/modules/route/front/tickets/index.js index e7c6cb7b1..a811d6d88 100644 --- a/modules/route/front/tickets/index.js +++ b/modules/route/front/tickets/index.js @@ -59,7 +59,7 @@ class Controller extends Section { let params = {priority: priority}; let query = `Tickets/${id}/`; this.$http.patch(query, params).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.model.refresh(); }); } @@ -101,15 +101,13 @@ class Controller extends Section { this.$.confirm.show(); } - removeTicketFromRoute(response) { - if (response === 'accept') { - let params = {routeFk: null}; - let query = `Tickets/${this.selectedTicket}/`; - this.$http.patch(query, params).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Ticket removed from route')); - this.updateVolume(); - }); - } + removeTicketFromRoute() { + let params = {routeFk: null}; + let query = `Tickets/${this.selectedTicket}/`; + this.$http.patch(query, params).then(() => { + this.vnApp.showSuccess(this.$t('Ticket removed from route')); + this.updateVolume(); + }); } updateVolume() { @@ -123,7 +121,7 @@ class Controller extends Section { guessPriority() { let query = `Routes/${this.$params.id}/guessPriority/`; this.$http.get(query).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Order changed')); + this.vnApp.showSuccess(this.$t('Order changed')); this.$.model.refresh(); }); } @@ -133,20 +131,17 @@ class Controller extends Section { this.$.possibleTicketsDialog.show(); } - setTicketsRoute(response) { - if (response === 'accept') { - let tickets = this.getSelectedItems(this.possibleTickets); - - for (let i = 0; i < tickets.length; i++) { - delete tickets[i].checked; - tickets[i].routeFk = this.route.id; - } - - return this.$.possibleTicketsModel.save().then(() => { - this.$.model.data = this.$.model.data.concat(tickets); - }); + setTicketsRoute() { + let tickets = this.getSelectedItems(this.possibleTickets); + if (tickets.length === 0) return; + for (let i = 0; i < tickets.length; i++) { + delete tickets[i].checked; + tickets[i].routeFk = this.route.id; } - return Promise.resolve(); + + return this.$.possibleTicketsModel.save().then(() => { + this.$.model.data = this.$.model.data.concat(tickets); + }); } onDrop($event) { @@ -159,7 +154,7 @@ class Controller extends Section { if (matches && matches.length) this.insert(matches[1]); else - this.vnApp.showError(this.$translate.instant('Ticket not found')); + this.vnApp.showError(this.$t('Ticket not found')); } if (!isNaN(ticketId)) @@ -169,18 +164,18 @@ class Controller extends Section { insert(id) { const params = {routeFk: this.route.id}; this.$http.patch(`Tickets/${id}`, params).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.model.refresh(); this.card.reload(); }).catch(error => { if (error.status == 404) - return this.vnApp.showError(this.$translate.instant('Ticket not found')); + return this.vnApp.showError(this.$t('Ticket not found')); throw error; }); } } -ngModule.component('vnRouteTickets', { +ngModule.vnComponent('vnRouteTickets', { template: require('./index.html'), controller: Controller, require: { diff --git a/modules/route/front/tickets/index.spec.js b/modules/route/front/tickets/index.spec.js index c2671c3d7..a32b368ba 100644 --- a/modules/route/front/tickets/index.spec.js +++ b/modules/route/front/tickets/index.spec.js @@ -7,7 +7,7 @@ describe('Route', () => { beforeEach(ngModule('route')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(''); @@ -101,7 +101,7 @@ describe('Route', () => { controller.setPriority(ticketId, priority); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.model.refresh).toHaveBeenCalledWith(); }); }); @@ -170,7 +170,7 @@ describe('Route', () => { controller.selectedTicket = ticketId; $httpBackend.expectPATCH(`Tickets/${ticketId}/`).respond('ok'); - controller.removeTicketFromRoute('accept'); + controller.removeTicketFromRoute(); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Ticket removed from route'); @@ -250,15 +250,11 @@ describe('Route', () => { {id: 5, routeFk: 111} ]; - controller.setTicketsRoute('accept').then(() => { + controller.setTicketsRoute().then(() => { expect(controller.$.model.data).toEqual(expectedResult); done(); }).catch(done.fail); }); - - it('should just return a promise', () => { - expect(controller.setTicketsRoute('cancel')).toEqual(jasmine.any(Promise)); - }); }); describe('onDrop()', () => { @@ -318,7 +314,7 @@ describe('Route', () => { controller.insert(ticketId); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.model.refresh).toHaveBeenCalledWith(); }); }); diff --git a/modules/ticket/front/basic-data/index.js b/modules/ticket/front/basic-data/index.js index 4deebff17..5d4ad2b73 100644 --- a/modules/ticket/front/basic-data/index.js +++ b/modules/ticket/front/basic-data/index.js @@ -21,7 +21,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketBasicData', { +ngModule.vnComponent('vnTicketBasicData', { template: require('./index.html'), bindings: { ticket: '<' diff --git a/modules/ticket/front/basic-data/step-one/index.js b/modules/ticket/front/basic-data/step-one/index.js index 6cfa51a1f..68f5ac54d 100644 --- a/modules/ticket/front/basic-data/step-one/index.js +++ b/modules/ticket/front/basic-data/step-one/index.js @@ -173,7 +173,7 @@ class Controller extends Component { async onStepChange() { if (this.isFormInvalid()) { return this.vnApp.showError( - this.$translate.instant('Some fields are invalid') + this.$t('Some fields are invalid') ); } @@ -193,7 +193,7 @@ class Controller extends Component { return true; }, err => { this.vnApp.showError( - this.$translate.instant(err.data.error.message) + this.$t(err.data.error.message) ); }); } @@ -211,7 +211,7 @@ class Controller extends Component { this.ticket.shipped = params.shipped; } else { return this.vnApp.showError( - this.$translate.instant(`No delivery zone available for this landing date`) + this.$t(`No delivery zone available for this landing date`) ); } }); @@ -230,7 +230,7 @@ class Controller extends Component { this.ticket.shipped = res.data.shipped; } else { return this.vnApp.showError( - this.$translate.instant(`No delivery zone available for this landing date`) + this.$t(`No delivery zone available for this landing date`) ); } }); @@ -243,7 +243,7 @@ class Controller extends Component { } } -ngModule.component('vnTicketBasicDataStepOne', { +ngModule.vnComponent('vnTicketBasicDataStepOne', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/basic-data/step-one/index.spec.js b/modules/ticket/front/basic-data/step-one/index.spec.js index 43842f5a1..d9c72b660 100644 --- a/modules/ticket/front/basic-data/step-one/index.spec.js +++ b/modules/ticket/front/basic-data/step-one/index.spec.js @@ -8,7 +8,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => { $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; const $element = angular.element(''); @@ -251,8 +251,7 @@ describe('Ticket', () => { }; filter = encodeURIComponent(JSON.stringify(filter)); - $httpBackend.when('GET', `Clients/${clientId}/addresses?filter=${filter}`).respond(200); - $httpBackend.expect('GET', `Clients/${clientId}/addresses?filter=${filter}`); + $httpBackend.expect('GET', `Clients/${clientId}/addresses?filter=${filter}`).respond(200); controller.clientAddressesList(clientId); $httpBackend.flush(); }); @@ -262,8 +261,7 @@ describe('Ticket', () => { it('should return the default address from choosed client', async() => { const clientId = 102; - $httpBackend.when('GET', `Clients/${clientId}`).respond(200); - $httpBackend.expect('GET', `Clients/${clientId}`); + $httpBackend.expect('GET', `Clients/${clientId}`).respond(200); controller.getClientDefaultAddress(clientId); $httpBackend.flush(); }); @@ -273,8 +271,7 @@ describe('Ticket', () => { it('should return an available zone', async() => { const zoneId = 5; const agencyModeFk = 8; - $httpBackend.when('GET', `Zones/${zoneId}`).respond(200, {agencyModeFk}); - $httpBackend.expect('GET', `Zones/${zoneId}`); + $httpBackend.expect('GET', `Zones/${zoneId}`).respond(200, {agencyModeFk}); controller.onChangeZone(zoneId); $httpBackend.flush(); @@ -337,8 +334,7 @@ describe('Ticket', () => { }; const serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `Agencies/getLanded?${serializedParams}`).respond(200, expectedResult); - $httpBackend.expect('GET', `Agencies/getLanded?${serializedParams}`); + $httpBackend.expect('GET', `Agencies/getLanded?${serializedParams}`).respond(200, expectedResult); controller.getLanded(params); $httpBackend.flush(); @@ -359,8 +355,7 @@ describe('Ticket', () => { }; const serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `Agencies/getShipped?${serializedParams}`).respond(200, expectedResult); - $httpBackend.expect('GET', `Agencies/getShipped?${serializedParams}`); + $httpBackend.expect('GET', `Agencies/getShipped?${serializedParams}`).respond(200, expectedResult); controller.getShipped(params); $httpBackend.flush(); diff --git a/modules/ticket/front/basic-data/step-two/index.js b/modules/ticket/front/basic-data/step-two/index.js index 00556350b..ff09bf9ff 100644 --- a/modules/ticket/front/basic-data/step-two/index.js +++ b/modules/ticket/front/basic-data/step-two/index.js @@ -63,7 +63,7 @@ class Controller extends Component { onSubmit() { if (!this.ticket.option) { return this.vnApp.showError( - this.$translate.instant('Choose an option') + this.$t('Choose an option') ); } @@ -83,7 +83,7 @@ class Controller extends Component { this.$http.post(query, params).then(res => { this.vnApp.showMessage( - this.$translate.instant(`The ticket has been unrouted`) + this.$t(`The ticket has been unrouted`) ); this.card.reload(); this.$state.go('ticket.card.summary', {id: this.$params.id}); @@ -91,7 +91,7 @@ class Controller extends Component { } } -ngModule.component('vnTicketBasicDataStepTwo', { +ngModule.vnComponent('vnTicketBasicDataStepTwo', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/basic-data/step-two/index.spec.js b/modules/ticket/front/basic-data/step-two/index.spec.js index e67389f9d..ea8268716 100644 --- a/modules/ticket/front/basic-data/step-two/index.spec.js +++ b/modules/ticket/front/basic-data/step-two/index.spec.js @@ -6,7 +6,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject($componentController => { + beforeEach(inject($componentController => { const $element = angular.element(''); controller = $componentController('vnTicketBasicDataStepTwo', {$element}); })); diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index 80174b5e2..843bc9f4a 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -68,7 +68,7 @@ class Controller extends ModuleCard { } } -ngModule.component('vnTicketCard', { +ngModule.vnComponent('vnTicketCard', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/card/index.spec.js b/modules/ticket/front/card/index.spec.js index 33757860c..6a66e355e 100644 --- a/modules/ticket/front/card/index.spec.js +++ b/modules/ticket/front/card/index.spec.js @@ -12,7 +12,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => { + beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { $httpBackend = _$httpBackend_; let $element = angular.element('
'); diff --git a/modules/ticket/front/component/index.js b/modules/ticket/front/component/index.js index 3efd7d56d..a2f9e70ad 100644 --- a/modules/ticket/front/component/index.js +++ b/modules/ticket/front/component/index.js @@ -47,7 +47,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketComponents', { +ngModule.vnComponent('vnTicketComponents', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/component/index.spec.js b/modules/ticket/front/component/index.spec.js index 3547a4905..1cffcdb52 100644 --- a/modules/ticket/front/component/index.spec.js +++ b/modules/ticket/front/component/index.spec.js @@ -7,7 +7,7 @@ describe('ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, $rootScope, $state) => { + beforeEach(inject(($componentController, $rootScope, $state) => { $state.params.id = '1'; let $scope = $rootScope.$new(); $scope.model = crudModel; diff --git a/modules/ticket/front/create/card.js b/modules/ticket/front/create/card.js index 01c5da4c9..213a0b082 100644 --- a/modules/ticket/front/create/card.js +++ b/modules/ticket/front/create/card.js @@ -120,13 +120,13 @@ class Controller extends Component { warehouseId: this.ticket.warehouseFk, }; this.$http.post(`Tickets/new`, params).then(res => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$state.go('ticket.card.summary', {id: res.data.id}); }); } } -ngModule.component('vnTicketCreateCard', { +ngModule.vnComponent('vnTicketCreateCard', { template: require('./card.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/create/index.js b/modules/ticket/front/create/index.js index c93051d7a..0166b9e91 100644 --- a/modules/ticket/front/create/index.js +++ b/modules/ticket/front/create/index.js @@ -8,7 +8,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketCreate', { +ngModule.vnComponent('vnTicketCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/descriptor/addStowaway.js b/modules/ticket/front/descriptor/addStowaway.js index 4497fef82..c88bda0af 100644 --- a/modules/ticket/front/descriptor/addStowaway.js +++ b/modules/ticket/front/descriptor/addStowaway.js @@ -8,7 +8,7 @@ class Controller extends Component { this.$http.post(`Stowaways/`, params) .then(() => this.cardReload()) .then(() => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.dialog.hide(); }); } @@ -22,7 +22,7 @@ class Controller extends Component { } } -ngModule.component('vnAddStowaway', { +ngModule.vnComponent('vnAddStowaway', { template: require('./addStowaway.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/descriptor/index.spec.js b/modules/ticket/front/descriptor/index.spec.js index ef032d775..4904f2ff1 100644 --- a/modules/ticket/front/descriptor/index.spec.js +++ b/modules/ticket/front/descriptor/index.spec.js @@ -25,7 +25,7 @@ describe('Ticket Component vnTicketDescriptor', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, _$state_) => { + beforeEach(inject(($componentController, _$httpBackend_, _$state_) => { $httpBackend = _$httpBackend_; $httpBackend.whenGET(`Tickets/${ticket.id}/canHaveStowaway`).respond(true); $httpBackend.whenGET(`Tickets/1/isEditable`).respond(true); diff --git a/modules/ticket/front/dms/create/index.js b/modules/ticket/front/dms/create/index.js index e745d98b8..142158e46 100644 --- a/modules/ticket/front/dms/create/index.js +++ b/modules/ticket/front/dms/create/index.js @@ -32,7 +32,7 @@ class Controller extends Section { } get contentTypesInfo() { - return this.$translate.instant('ContentTypesInfo', { + return this.$t('ContentTypesInfo', { allowedContentTypes: this.allowedContentTypes }); } @@ -49,7 +49,7 @@ class Controller extends Section { warehouseId: warehouseId, companyId: this.ticket.companyFk, dmsTypeId: dmsTypeId, - description: this.$translate.instant('FileDescription', { + description: this.$t('FileDescription', { ticketId: this.ticket.id, clientId: this.ticket.client.id, clientName: this.ticket.client.name @@ -81,7 +81,7 @@ class Controller extends Section { }; this.$http(options).then(res => { if (res) { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.watcher.updateOriginalData(); this.$state.go('ticket.card.dms.index'); } @@ -99,7 +99,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketDmsCreate', { +ngModule.vnComponent('vnTicketDmsCreate', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/dms/create/index.spec.js b/modules/ticket/front/dms/create/index.spec.js index c6cb1da5a..e3c195799 100644 --- a/modules/ticket/front/dms/create/index.spec.js +++ b/modules/ticket/front/dms/create/index.spec.js @@ -9,7 +9,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; @@ -44,8 +44,7 @@ describe('Ticket', () => { where: {code: 'ticket'} }}; let serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 14, code: 'ticket'}); - $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`); + $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 14, code: 'ticket'}); controller.setDefaultParams(); $httpBackend.flush(); @@ -68,8 +67,7 @@ describe('Ticket', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `ticketDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `ticketDms/allowedContentTypes`); + $httpBackend.expect('GET', `ticketDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/ticket/front/dms/edit/index.js b/modules/ticket/front/dms/edit/index.js index 44e3890f8..e50092f77 100644 --- a/modules/ticket/front/dms/edit/index.js +++ b/modules/ticket/front/dms/edit/index.js @@ -23,7 +23,7 @@ class Controller extends Section { } get contentTypesInfo() { - return this.$translate.instant('ContentTypesInfo', { + return this.$t('ContentTypesInfo', { allowedContentTypes: this.allowedContentTypes }); } @@ -66,7 +66,7 @@ class Controller extends Section { }; this.$http(options).then(res => { if (res) { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.watcher.updateOriginalData(); this.$state.go('ticket.card.dms.index'); } @@ -84,7 +84,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketDmsEdit', { +ngModule.vnComponent('vnTicketDmsEdit', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/dms/edit/index.spec.js b/modules/ticket/front/dms/edit/index.spec.js index 20224a4b9..052b08a1b 100644 --- a/modules/ticket/front/dms/edit/index.spec.js +++ b/modules/ticket/front/dms/edit/index.spec.js @@ -8,7 +8,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; const $element = angular.element(''); @@ -45,7 +45,6 @@ describe('Ticket', () => { hasFileAttached: false }; - $httpBackend.when('GET', `Dms/${dmsId}`).respond(expectedResponse); $httpBackend.expect('GET', `Dms/${dmsId}`).respond(expectedResponse); controller.setDefaultParams(); $httpBackend.flush(); @@ -70,8 +69,7 @@ describe('Ticket', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `ticketDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `ticketDms/allowedContentTypes`); + $httpBackend.expect('GET', `ticketDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/ticket/front/dms/index/index.js b/modules/ticket/front/dms/index/index.js index c3d468e60..2a67d6890 100644 --- a/modules/ticket/front/dms/index/index.js +++ b/modules/ticket/front/dms/index/index.js @@ -59,7 +59,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope', 'vnFile']; -ngModule.component('vnTicketDmsIndex', { +ngModule.vnComponent('vnTicketDmsIndex', { template: require('./index.html'), controller: Controller, }); diff --git a/modules/ticket/front/dms/index/index.spec.js b/modules/ticket/front/dms/index/index.spec.js index 2cd63462a..8221abcd8 100644 --- a/modules/ticket/front/dms/index/index.spec.js +++ b/modules/ticket/front/dms/index/index.spec.js @@ -8,7 +8,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { + beforeEach(inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; controller = $componentController('vnTicketDmsIndex', {$element: null}); controller.$.model = crudModel; diff --git a/modules/ticket/front/expedition/index.js b/modules/ticket/front/expedition/index.js index 673c18e33..0c395e6ce 100644 --- a/modules/ticket/front/expedition/index.js +++ b/modules/ticket/front/expedition/index.js @@ -8,7 +8,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketExpedition', { +ngModule.vnComponent('vnTicketExpedition', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/expedition/index.spec.js b/modules/ticket/front/expedition/index.spec.js index 761dc1fb6..425539aef 100644 --- a/modules/ticket/front/expedition/index.spec.js +++ b/modules/ticket/front/expedition/index.spec.js @@ -8,7 +8,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); $scope.model = { diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index abd772229..6f3079a29 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -61,7 +61,7 @@ diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js index 2c8b9b83c..32c2f0baa 100644 --- a/modules/ticket/front/index/index.js +++ b/modules/ticket/front/index/index.js @@ -158,7 +158,7 @@ export default class Controller extends Section { } Controller.$inject = ['$element', '$scope', 'vnReport']; -ngModule.component('vnTicketIndex', { +ngModule.vnComponent('vnTicketIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/log/index.js b/modules/ticket/front/log/index.js index df2584481..dc186c6ee 100644 --- a/modules/ticket/front/log/index.js +++ b/modules/ticket/front/log/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -ngModule.component('vnTicketLog', { +ngModule.vnComponent('vnTicketLog', { template: require('./index.html'), controller: Section, }); diff --git a/modules/ticket/front/note/index.js b/modules/ticket/front/note/index.js index 3eda4561b..419c079e9 100644 --- a/modules/ticket/front/note/index.js +++ b/modules/ticket/front/note/index.js @@ -11,7 +11,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketObservation', { +ngModule.vnComponent('vnTicketObservation', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/package/index.js b/modules/ticket/front/package/index.js index df0b9a503..ed13f12d8 100644 --- a/modules/ticket/front/package/index.js +++ b/modules/ticket/front/package/index.js @@ -20,7 +20,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketPackage', { +ngModule.vnComponent('vnTicketPackage', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/picture/index.js b/modules/ticket/front/picture/index.js index 50d7cc777..89cf9e078 100644 --- a/modules/ticket/front/picture/index.js +++ b/modules/ticket/front/picture/index.js @@ -15,7 +15,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketPicture', { +ngModule.vnComponent('vnTicketPicture', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/request/create/index.js b/modules/ticket/front/request/create/index.js index 2d432e637..f2781a810 100644 --- a/modules/ticket/front/request/create/index.js +++ b/modules/ticket/front/request/create/index.js @@ -17,7 +17,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketRequestCreate', { +ngModule.vnComponent('vnTicketRequestCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/request/index/index.js b/modules/ticket/front/request/index/index.js index 7ee1399e6..b4b11292e 100644 --- a/modules/ticket/front/request/index/index.js +++ b/modules/ticket/front/request/index/index.js @@ -68,7 +68,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketRequestIndex', { +ngModule.vnComponent('vnTicketRequestIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/sale-checked/index.js b/modules/ticket/front/sale-checked/index.js index 37d63a485..cfc3985ba 100644 --- a/modules/ticket/front/sale-checked/index.js +++ b/modules/ticket/front/sale-checked/index.js @@ -33,7 +33,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketSaleChecked', { +ngModule.vnComponent('vnTicketSaleChecked', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index ebb6f9ada..394ef4f1e 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -3,7 +3,7 @@ import Section from 'salix/components/section'; class Controller extends Section {} -ngModule.component('vnTicketSaleTracking', { +ngModule.vnComponent('vnTicketSaleTracking', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 4b96b6326..7cae5529f 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -384,14 +384,14 @@ vn-id="delete-lines" question="You are going to delete lines of the ticket" message="Continue anyway?" - on-response="$ctrl.removeSales()"> + on-accept="$ctrl.removeSales()"> + on-accept="$ctrl.transferSales($ctrl.transfer.ticketId)"> diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index bd3fa4813..48f33454c 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -281,7 +281,7 @@ class Controller extends Section { const params = {salesIds: saleIds, newDiscount: this.edit.discount}; const query = `Tickets/${this.$params.id}/updateDiscount`; this.$http.post(query, params).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); for (let sale of sales) sale.discount = this.edit.discount; @@ -476,7 +476,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketSale', { +ngModule.vnComponent('vnTicketSale', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index ba08d9733..28b3ce3dd 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -11,7 +11,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { const ticket = { id: 1, clientFk: 101, @@ -248,7 +248,7 @@ describe('Ticket', () => { $httpBackend.flush(); expect(controller.card.reload).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); }); @@ -267,7 +267,7 @@ describe('Ticket', () => { $httpBackend.flush(); expect(controller.removeSelectedSales).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); }); @@ -371,7 +371,7 @@ describe('Ticket', () => { expect(selectedSale.price).toEqual(2); expect(controller.refreshTotal).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.editPricePopover.hide).toHaveBeenCalledWith(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); @@ -472,7 +472,7 @@ describe('Ticket', () => { expect(firstSelectedSale.discount).toEqual(expectedDiscount); expect(secondSelectedSale.discount).toEqual(expectedDiscount); expect(controller.refreshTotal).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); }); @@ -678,7 +678,7 @@ describe('Ticket', () => { controller.addSale(newSale); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.refreshTotal).toHaveBeenCalledWith(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); @@ -719,7 +719,7 @@ describe('Ticket', () => { controller.calculateSalePrice(); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.model.refresh).toHaveBeenCalledWith(); expect(controller.refreshTotal).toHaveBeenCalledWith(); }); diff --git a/modules/ticket/front/search-panel/index.js b/modules/ticket/front/search-panel/index.js index 5c3c44107..22093784a 100644 --- a/modules/ticket/front/search-panel/index.js +++ b/modules/ticket/front/search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnTicketSearchPanel', { +ngModule.vnComponent('vnTicketSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/ticket/front/services/index.js b/modules/ticket/front/services/index.js index efb62fe2e..01678c7bb 100644 --- a/modules/ticket/front/services/index.js +++ b/modules/ticket/front/services/index.js @@ -47,7 +47,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketService', { +ngModule.vnComponent('vnTicketService', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/services/index.spec.js b/modules/ticket/front/services/index.spec.js index 10e3ad47e..5d8d58505 100644 --- a/modules/ticket/front/services/index.spec.js +++ b/modules/ticket/front/services/index.spec.js @@ -8,7 +8,7 @@ describe('Ticket component vnTicketService', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); diff --git a/modules/ticket/front/sms/index.html b/modules/ticket/front/sms/index.html index eeb98cbcb..97bdfef14 100644 --- a/modules/ticket/front/sms/index.html +++ b/modules/ticket/front/sms/index.html @@ -1,6 +1,6 @@
diff --git a/modules/ticket/front/sms/index.js b/modules/ticket/front/sms/index.js index 56959e3ee..33369acae 100644 --- a/modules/ticket/front/sms/index.js +++ b/modules/ticket/front/sms/index.js @@ -16,31 +16,29 @@ class Controller extends Component { return maxLength - textAreaLength; } - onResponse(response) { - if (response === 'accept') { - try { - if (!this.sms.destination) - throw new Error(`The destination can't be empty`); - if (!this.sms.message) - throw new Error(`The message can't be empty`); - if (this.charactersRemaining() < 0) - throw new Error(`The message it's too long`); + onResponse() { + try { + if (!this.sms.destination) + throw new Error(`The destination can't be empty`); + if (!this.sms.message) + throw new Error(`The message can't be empty`); + if (this.charactersRemaining() < 0) + throw new Error(`The message it's too long`); - this.$http.post(`Tickets/${this.$params.id}/sendSms`, this.sms).then(res => { - this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + this.$http.post(`Tickets/${this.$params.id}/sendSms`, this.sms).then(res => { + this.vnApp.showMessage(this.$t('SMS sent!')); - if (res.data) this.emit('send', {response: res.data}); - }); - } catch (e) { - this.vnApp.showError(this.$translate.instant(e.message)); - return false; - } + if (res.data) this.emit('send', {response: res.data}); + }); + } catch (e) { + this.vnApp.showError(this.$t(e.message)); + return false; } return true; } } -ngModule.component('vnTicketSms', { +ngModule.vnComponent('vnTicketSms', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/sms/index.spec.js b/modules/ticket/front/sms/index.spec.js index 45e7765d1..e918ffb54 100644 --- a/modules/ticket/front/sms/index.spec.js +++ b/modules/ticket/front/sms/index.spec.js @@ -7,7 +7,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; let $scope = $rootScope.$new(); const $element = angular.element(''); @@ -28,7 +28,7 @@ describe('Ticket', () => { jest.spyOn(controller.vnApp, 'showMessage'); $httpBackend.expect('POST', `Tickets/11/sendSms`, params).respond(200, params); - controller.onResponse('accept'); + controller.onResponse(); $httpBackend.flush(); expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); @@ -39,7 +39,7 @@ describe('Ticket', () => { jest.spyOn(controller.vnApp, 'showError'); - controller.onResponse('accept'); + controller.onResponse(); expect(controller.vnApp.showError).toHaveBeenCalledWith(`The destination can't be empty`); }); @@ -49,7 +49,7 @@ describe('Ticket', () => { jest.spyOn(controller.vnApp, 'showError'); - controller.onResponse('accept'); + controller.onResponse(); expect(controller.vnApp.showError).toHaveBeenCalledWith(`The message can't be empty`); }); diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 8b73c9c48..7b0e9d06d 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -108,7 +108,7 @@ + vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimBeginning.claimFk}}"> { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); if (this.card) this.card.reload(); else @@ -74,7 +74,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketSummary', { +ngModule.vnComponent('vnTicketSummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/summary/index.spec.js b/modules/ticket/front/summary/index.spec.js index e1f0e8836..e94f316de 100644 --- a/modules/ticket/front/summary/index.spec.js +++ b/modules/ticket/front/summary/index.spec.js @@ -7,7 +7,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { + beforeEach(inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; const $element = angular.element(''); controller = $componentController('vnTicketSummary', {$element}); @@ -18,7 +18,6 @@ describe('Ticket', () => { it('should perform a GET query and define the summary property', () => { let res = {id: 1, nickname: 'Batman'}; $httpBackend.when('GET', `Tickets/1/summary`).respond(200, res); - $httpBackend.expect('GET', `Tickets/1/summary`); controller.ticket = {id: 1}; $httpBackend.flush(); diff --git a/modules/ticket/front/tracking/edit/index.js b/modules/ticket/front/tracking/edit/index.js index f2de08389..055a8ad67 100644 --- a/modules/ticket/front/tracking/edit/index.js +++ b/modules/ticket/front/tracking/edit/index.js @@ -56,13 +56,13 @@ class Controller extends Section { this.$http.post(`TicketTrackings/changeState`, this.params).then(() => { this.$.watcher.updateOriginalData(); this.card.reload(); - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$state.go('ticket.card.tracking.index'); }); } } -ngModule.component('vnTicketTrackingEdit', { +ngModule.vnComponent('vnTicketTrackingEdit', { template: require('./index.html'), controller: Controller, require: { diff --git a/modules/ticket/front/tracking/edit/index.spec.js b/modules/ticket/front/tracking/edit/index.spec.js index cf8036814..8fc21309b 100644 --- a/modules/ticket/front/tracking/edit/index.spec.js +++ b/modules/ticket/front/tracking/edit/index.spec.js @@ -7,7 +7,7 @@ describe('Ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $translate, vnApp) => { + beforeEach(inject(($componentController, _$httpBackend_, $translate, vnApp) => { $httpBackend = _$httpBackend_; const $element = angular.element(''); controller = $componentController('vnTicketTrackingEdit', {$element}); @@ -67,7 +67,7 @@ describe('Ticket', () => { expect(controller.card.reload).toHaveBeenCalledWith(); expect(controller.$.watcher.updateOriginalData).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith(controller.$translate.instant('Data saved!')); + expect(controller.vnApp.showSuccess).toHaveBeenCalledWith(controller.$t('Data saved!')); expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.tracking.index'); }); }); diff --git a/modules/ticket/front/tracking/index/index.js b/modules/ticket/front/tracking/index/index.js index 2826cbf26..5528fc1ad 100644 --- a/modules/ticket/front/tracking/index/index.js +++ b/modules/ticket/front/tracking/index/index.js @@ -28,7 +28,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketTrackingIndex', { +ngModule.vnComponent('vnTicketTrackingIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/volume/index.js b/modules/ticket/front/volume/index.js index 74ff61c85..ead46024b 100644 --- a/modules/ticket/front/volume/index.js +++ b/modules/ticket/front/volume/index.js @@ -45,7 +45,7 @@ class Controller extends Section { } } -ngModule.component('vnTicketVolume', { +ngModule.vnComponent('vnTicketVolume', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/volume/index.spec.js b/modules/ticket/front/volume/index.spec.js index f7cb5a58d..8ffb1dfc1 100644 --- a/modules/ticket/front/volume/index.spec.js +++ b/modules/ticket/front/volume/index.spec.js @@ -9,7 +9,7 @@ describe('ticket', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$state_, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); $scope.model = {data: [{id: 1}, {id: 2}], accept: () => { diff --git a/modules/ticket/front/weekly/index.js b/modules/ticket/front/weekly/index.js index 0c373eae3..71365c4b3 100644 --- a/modules/ticket/front/weekly/index.js +++ b/modules/ticket/front/weekly/index.js @@ -32,7 +32,7 @@ export default class Controller extends Section { } } -ngModule.component('vnTicketWeeklyIndex', { +ngModule.vnComponent('vnTicketWeeklyIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/ticket/front/weekly/index.spec.js b/modules/ticket/front/weekly/index.spec.js index a66e5c637..2af01db16 100644 --- a/modules/ticket/front/weekly/index.spec.js +++ b/modules/ticket/front/weekly/index.spec.js @@ -8,7 +8,7 @@ describe('ticket weekly', () => { beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; const $scope = $rootScope.$new(); const $element = angular.element(''); @@ -23,7 +23,7 @@ describe('ticket weekly', () => { controller.onUpdate('ticketFk', 'field', 'value'); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); @@ -38,7 +38,7 @@ describe('ticket weekly', () => { controller.onDeleteWeeklyAccept('ticketFk'); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.model.remove).toHaveBeenCalledWith(0); }); }); diff --git a/modules/travel/front/basic-data/index.js b/modules/travel/front/basic-data/index.js index 139ef46e8..581fd71e5 100644 --- a/modules/travel/front/basic-data/index.js +++ b/modules/travel/front/basic-data/index.js @@ -9,7 +9,7 @@ class Controller extends Section { } } -ngModule.component('vnTravelBasicData', { +ngModule.vnComponent('vnTravelBasicData', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/travel/front/basic-data/index.spec.js b/modules/travel/front/basic-data/index.spec.js index aaad487ef..11894d6e0 100644 --- a/modules/travel/front/basic-data/index.spec.js +++ b/modules/travel/front/basic-data/index.spec.js @@ -7,7 +7,7 @@ describe('Travel Component vnTravelBasicData', () => { $translateProvider.translations('en', {}); })); - beforeEach(angular.mock.inject($componentController => { + beforeEach(inject($componentController => { const $element = angular.element(''); controller = $componentController('vnTravelBasicData', {$element}); controller.card = {reload: () => {}}; diff --git a/modules/travel/front/card/index.js b/modules/travel/front/card/index.js index c3ad41702..d46244cb5 100644 --- a/modules/travel/front/card/index.js +++ b/modules/travel/front/card/index.js @@ -24,7 +24,7 @@ class Controller extends ModuleCard { } } -ngModule.component('vnTravelCard', { +ngModule.vnComponent('vnTravelCard', { template: require('./index.html'), controller: Controller }); diff --git a/modules/travel/front/create/index.js b/modules/travel/front/create/index.js index 286d508de..7d0020034 100644 --- a/modules/travel/front/create/index.js +++ b/modules/travel/front/create/index.js @@ -14,7 +14,7 @@ class Controller extends Section { } } -ngModule.component('vnTravelCreate', { +ngModule.vnComponent('vnTravelCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/travel/front/create/index.spec.js b/modules/travel/front/create/index.spec.js index e47f30bd3..4bde7747e 100644 --- a/modules/travel/front/create/index.spec.js +++ b/modules/travel/front/create/index.spec.js @@ -8,7 +8,7 @@ describe('Travel Component vnTravelCreate', () => { beforeEach(ngModule('travel')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => { + beforeEach(inject(($componentController, $rootScope, _$state_) => { $scope = $rootScope.$new(); $state = _$state_; $scope.watcher = watcher; diff --git a/modules/travel/front/index/index.js b/modules/travel/front/index/index.js index 1115af2c3..d1fd4f381 100644 --- a/modules/travel/front/index/index.js +++ b/modules/travel/front/index/index.js @@ -20,7 +20,7 @@ export default class Controller extends Section { } } -ngModule.component('vnTravelIndex', { +ngModule.vnComponent('vnTravelIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/travel/front/index/index.spec.js b/modules/travel/front/index/index.spec.js index 4b018dea6..f88705cc7 100644 --- a/modules/travel/front/index/index.spec.js +++ b/modules/travel/front/index/index.spec.js @@ -11,7 +11,7 @@ describe('Travel Component vnTravelIndex', () => { beforeEach(ngModule('travel')); - beforeEach(angular.mock.inject($componentController => { + beforeEach(inject($componentController => { const $element = angular.element(''); controller = $componentController('vnTravelIndex', {$element}); controller.$.summary = {show: jasmine.createSpy('show')}; diff --git a/modules/travel/front/log/index.js b/modules/travel/front/log/index.js index 742488058..7af601b5c 100644 --- a/modules/travel/front/log/index.js +++ b/modules/travel/front/log/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -ngModule.component('vnTravelLog', { +ngModule.vnComponent('vnTravelLog', { template: require('./index.html'), controller: Section, }); diff --git a/modules/travel/front/main/index.spec.js b/modules/travel/front/main/index.spec.js index 27dfa0392..96d819a6f 100644 --- a/modules/travel/front/main/index.spec.js +++ b/modules/travel/front/main/index.spec.js @@ -5,7 +5,7 @@ describe('Travel Component vnTravel', () => { beforeEach(ngModule('travel')); - beforeEach(angular.mock.inject($componentController => { + beforeEach(inject($componentController => { let $element = angular.element(`
`); controller = $componentController('vnTravel', {$element}); })); diff --git a/modules/travel/front/search-panel/index.js b/modules/travel/front/search-panel/index.js index d7b2a6eff..8aa25e594 100644 --- a/modules/travel/front/search-panel/index.js +++ b/modules/travel/front/search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnTravelSearchPanel', { +ngModule.vnComponent('vnTravelSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/travel/front/summary/index.js b/modules/travel/front/summary/index.js index 1f2d14e58..9107ea29f 100644 --- a/modules/travel/front/summary/index.js +++ b/modules/travel/front/summary/index.js @@ -58,7 +58,7 @@ class Controller extends Section { } } -ngModule.component('vnTravelSummary', { +ngModule.vnComponent('vnTravelSummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/travel/front/summary/index.spec.js b/modules/travel/front/summary/index.spec.js index 95f98bb85..b1b750689 100644 --- a/modules/travel/front/summary/index.spec.js +++ b/modules/travel/front/summary/index.spec.js @@ -10,7 +10,7 @@ describe('component vnTravelSummary', () => { $translateProvider.translations('en', {}); })); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; $scope = $rootScope.$new(); diff --git a/modules/travel/front/thermograph/create/index.js b/modules/travel/front/thermograph/create/index.js index d398febf1..4b4cebb9f 100644 --- a/modules/travel/front/thermograph/create/index.js +++ b/modules/travel/front/thermograph/create/index.js @@ -28,7 +28,7 @@ class Controller extends Section { } get contentTypesInfo() { - return this.$translate.instant('ContentTypesInfo', { + return this.$t('ContentTypesInfo', { allowedContentTypes: this.allowedContentTypes }); } @@ -46,7 +46,7 @@ class Controller extends Section { warehouseId: warehouseId, companyId: companyId, dmsTypeId: dmsTypeId, - description: this.$translate.instant('FileDescription', { + description: this.$t('FileDescription', { travelId: this.travel.id }).toUpperCase() }; @@ -97,14 +97,14 @@ class Controller extends Section { data: this.dms.files }; this.$http(options).then(res => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.watcher.updateOriginalData(); this.$state.go('travel.card.thermograph.index'); }); } } -ngModule.component('vnTravelThermographCreate', { +ngModule.vnComponent('vnTravelThermographCreate', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/travel/front/thermograph/create/index.spec.js b/modules/travel/front/thermograph/create/index.spec.js index 23976fc96..36f17a409 100644 --- a/modules/travel/front/thermograph/create/index.spec.js +++ b/modules/travel/front/thermograph/create/index.spec.js @@ -10,7 +10,7 @@ describe('Ticket', () => { beforeEach(ngModule('travel')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => { $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; const $element = angular.element(''); @@ -40,8 +40,7 @@ describe('Ticket', () => { where: {code: 'miscellaneous'} }}; let serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: dmsTypeId, code: 'miscellaneous'}); - $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`); + $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: dmsTypeId, code: 'miscellaneous'}); controller.setDefaultParams(); $httpBackend.flush(); @@ -54,8 +53,7 @@ describe('Ticket', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['application/pdf', 'image/png', 'image/jpg']; - $httpBackend.when('GET', `TravelThermographs/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `TravelThermographs/allowedContentTypes`); + $httpBackend.expect('GET', `TravelThermographs/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/travel/front/thermograph/edit/index.js b/modules/travel/front/thermograph/edit/index.js index 90e0cc7b1..daa0f696b 100644 --- a/modules/travel/front/thermograph/edit/index.js +++ b/modules/travel/front/thermograph/edit/index.js @@ -24,7 +24,7 @@ class Controller extends Section { } get contentTypesInfo() { - return this.$translate.instant('ContentTypesInfo', { + return this.$t('ContentTypesInfo', { allowedContentTypes: this.allowedContentTypes }); } @@ -71,7 +71,7 @@ class Controller extends Section { }; this.$http(options).then(res => { if (res) { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.watcher.updateOriginalData(); this.$state.go('travel.card.thermograph.index'); } @@ -89,7 +89,7 @@ class Controller extends Section { } } -ngModule.component('vnTravelThermographEdit', { +ngModule.vnComponent('vnTravelThermographEdit', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/travel/front/thermograph/edit/index.spec.js b/modules/travel/front/thermograph/edit/index.spec.js index 180827134..68ce763c2 100644 --- a/modules/travel/front/thermograph/edit/index.spec.js +++ b/modules/travel/front/thermograph/edit/index.spec.js @@ -10,7 +10,7 @@ describe('Worker', () => { beforeEach(ngModule('travel')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; @@ -79,8 +79,7 @@ describe('Worker', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `TravelThermographs/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `TravelThermographs/allowedContentTypes`); + $httpBackend.expect('GET', `TravelThermographs/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/travel/front/thermograph/index/index.js b/modules/travel/front/thermograph/index/index.js index 55c1720c3..f8b239cfe 100644 --- a/modules/travel/front/thermograph/index/index.js +++ b/modules/travel/front/thermograph/index/index.js @@ -26,7 +26,7 @@ class Controller extends Section { const thermographId = data[this.thermographIndex].id; const query = `Travels/deleteThermograph?id=${thermographId}`; this.$http.delete(query).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Thermograph deleted')); + this.vnApp.showSuccess(this.$t('Thermograph deleted')); this.$.model.remove(this.thermographIndex); this.thermographIndex = null; }); @@ -39,7 +39,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope', 'vnFile']; -ngModule.component('vnTravelThermographIndex', { +ngModule.vnComponent('vnTravelThermographIndex', { template: require('./index.html'), controller: Controller, require: { diff --git a/modules/worker/front/basic-data/index.js b/modules/worker/front/basic-data/index.js index ebeb4716b..d2c7f5b70 100644 --- a/modules/worker/front/basic-data/index.js +++ b/modules/worker/front/basic-data/index.js @@ -8,7 +8,7 @@ class Controller extends Section { } } -ngModule.component('vnWorkerBasicData', { +ngModule.vnComponent('vnWorkerBasicData', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js index 32adc272d..e47335804 100644 --- a/modules/worker/front/calendar/index.js +++ b/modules/worker/front/calendar/index.js @@ -205,7 +205,7 @@ class Controller extends Section { } } -ngModule.component('vnWorkerCalendar', { +ngModule.vnComponent('vnWorkerCalendar', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/worker/front/calendar/index.spec.js b/modules/worker/front/calendar/index.spec.js index 9d14cca20..635bacca2 100644 --- a/modules/worker/front/calendar/index.spec.js +++ b/modules/worker/front/calendar/index.spec.js @@ -10,7 +10,7 @@ describe('Worker', () => { beforeEach(ngModule('worker')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; diff --git a/modules/worker/front/card/index.js b/modules/worker/front/card/index.js index 14723947e..415b60787 100644 --- a/modules/worker/front/card/index.js +++ b/modules/worker/front/card/index.js @@ -37,7 +37,7 @@ class Controller extends ModuleCard { } } -ngModule.component('vnWorkerCard', { +ngModule.vnComponent('vnWorkerCard', { template: require('./index.html'), controller: Controller }); diff --git a/modules/worker/front/department/index.html b/modules/worker/front/department/index.html index 92102c7d3..df8630104 100644 --- a/modules/worker/front/department/index.html +++ b/modules/worker/front/department/index.html @@ -19,7 +19,7 @@ @@ -27,7 +27,7 @@ { - const item = res.data; - item.parent = parent; + const query = `departments/createChild`; + this.$http.post(query, params).then(res => { + const item = res.data; + item.parent = parent; - this.$.treeview.create(item); - }); - } catch (e) { - this.vnApp.showError(this.$translate.instant(e.message)); - return false; - } + this.$.treeview.create(item); + }); + } catch (e) { + this.vnApp.showError(this.$t(e.message)); + return false; } return true; } @@ -70,18 +68,16 @@ class Controller extends Section { this.$.deleteNode.show(); } - onRemoveResponse(response) { - if (response === 'accept') { - const childId = this.removedChild.id; - const path = `departments/${childId}/removeChild`; - this.$http.post(path).then(() => { - this.$.treeview.remove(this.removedChild); - }); - } + onRemoveResponse() { + const childId = this.removedChild.id; + const path = `departments/${childId}/removeChild`; + this.$http.post(path).then(() => { + this.$.treeview.remove(this.removedChild); + }); } } -ngModule.component('vnWorkerDepartment', { +ngModule.vnComponent('vnWorkerDepartment', { template: require('./index.html'), controller: Controller }); diff --git a/modules/worker/front/department/locale/es.yml b/modules/worker/front/department/locale/es.yml index c481bf4a9..74dec0c45 100644 --- a/modules/worker/front/department/locale/es.yml +++ b/modules/worker/front/department/locale/es.yml @@ -1,3 +1,4 @@ New department: Nuevo departamento Delete department: Eliminar departamento -Are you sure you want to delete it?: ¿Seguro que quieres eliminarlo? \ No newline at end of file +Are you sure you want to delete it?: ¿Seguro que quieres eliminarlo? +Name can't be empty: El nombre esta vacio \ No newline at end of file diff --git a/modules/worker/front/dms/create/index.js b/modules/worker/front/dms/create/index.js index 79d7c5fdd..f712edaf3 100644 --- a/modules/worker/front/dms/create/index.js +++ b/modules/worker/front/dms/create/index.js @@ -33,7 +33,7 @@ class Controller extends Section { } get contentTypesInfo() { - return this.$translate.instant('ContentTypesInfo', { + return this.$t('ContentTypesInfo', { allowedContentTypes: this.allowedContentTypes }); } @@ -51,7 +51,7 @@ class Controller extends Section { warehouseId: warehouseId, companyId: companyId, dmsTypeId: dmsType.id, - description: this.$translate.instant('WorkerFileDescription', { + description: this.$t('WorkerFileDescription', { dmsTypeName: dmsType.name, workerId: this.worker.id, workerName: this.worker.name @@ -83,7 +83,7 @@ class Controller extends Section { }; this.$http(options).then(res => { if (res) { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.watcher.updateOriginalData(); this.$state.go('worker.card.dms.index'); } @@ -104,7 +104,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope']; -ngModule.component('vnWorkerDmsCreate', { +ngModule.vnComponent('vnWorkerDmsCreate', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/worker/front/dms/create/index.spec.js b/modules/worker/front/dms/create/index.spec.js index 6202032af..f0d088715 100644 --- a/modules/worker/front/dms/create/index.spec.js +++ b/modules/worker/front/dms/create/index.spec.js @@ -10,7 +10,7 @@ describe('Client', () => { beforeEach(ngModule('worker')); - beforeEach(angular.mock.inject(($compile, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(inject(($compile, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; @@ -64,8 +64,7 @@ describe('Client', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `workerDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `workerDms/allowedContentTypes`); + $httpBackend.expect('GET', `workerDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/worker/front/dms/edit/index.js b/modules/worker/front/dms/edit/index.js index ac0104fa1..68c851ff3 100644 --- a/modules/worker/front/dms/edit/index.js +++ b/modules/worker/front/dms/edit/index.js @@ -24,7 +24,7 @@ class Controller extends Section { } get contentTypesInfo() { - return this.$translate.instant('ContentTypesInfo', { + return this.$t('ContentTypesInfo', { allowedContentTypes: this.allowedContentTypes }); } @@ -67,7 +67,7 @@ class Controller extends Section { }; this.$http(options).then(res => { if (res) { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.$.watcher.updateOriginalData(); this.$state.go('worker.card.dms.index'); } @@ -85,7 +85,7 @@ class Controller extends Section { } } -ngModule.component('vnWorkerDmsEdit', { +ngModule.vnComponent('vnWorkerDmsEdit', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/worker/front/dms/edit/index.spec.js b/modules/worker/front/dms/edit/index.spec.js index 7dfad9643..3724a6c7c 100644 --- a/modules/worker/front/dms/edit/index.spec.js +++ b/modules/worker/front/dms/edit/index.spec.js @@ -9,7 +9,7 @@ describe('Worker', () => { beforeEach(ngModule('worker')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; $element = angular.element(` { hasFileAttached: false }; - $httpBackend.when('GET', `Dms/${dmsId}`).respond(expectedResponse); $httpBackend.expect('GET', `Dms/${dmsId}`).respond(expectedResponse); controller.setDefaultParams(); $httpBackend.flush(); @@ -71,8 +70,7 @@ describe('Worker', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `WorkerDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `WorkerDms/allowedContentTypes`); + $httpBackend.expect('GET', `WorkerDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/worker/front/dms/index/index.js b/modules/worker/front/dms/index/index.js index d4514fdc1..e67240a73 100644 --- a/modules/worker/front/dms/index/index.js +++ b/modules/worker/front/dms/index/index.js @@ -60,7 +60,7 @@ class Controller extends Component { Controller.$inject = ['$element', '$scope', 'vnFile']; -ngModule.component('vnWorkerDmsIndex', { +ngModule.vnComponent('vnWorkerDmsIndex', { template: require('./index.html'), controller: Controller, }); diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html index dfab7f16a..3d383ae04 100644 --- a/modules/worker/front/index/index.html +++ b/modules/worker/front/index/index.html @@ -46,5 +46,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/modules/worker/front/index/index.js b/modules/worker/front/index/index.js index 02632e095..77dd872e1 100644 --- a/modules/worker/front/index/index.js +++ b/modules/worker/front/index/index.js @@ -25,7 +25,7 @@ export default class Controller extends Section { } } -ngModule.component('vnWorkerIndex', { +ngModule.vnComponent('vnWorkerIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/worker/front/log/index.js b/modules/worker/front/log/index.js index 325200aa9..ca64bed17 100644 --- a/modules/worker/front/log/index.js +++ b/modules/worker/front/log/index.js @@ -64,7 +64,7 @@ export default class Controller extends Section { } } -ngModule.component('vnLog', { +ngModule.vnComponent('vnLog', { controller: Controller, template: require('./index.html'), bindings: { diff --git a/modules/worker/front/pbx/index.js b/modules/worker/front/pbx/index.js index a62280d9b..d37f6f7d8 100644 --- a/modules/worker/front/pbx/index.js +++ b/modules/worker/front/pbx/index.js @@ -16,7 +16,7 @@ class Controller extends Section { } } -ngModule.component('vnWorkerPbx', { +ngModule.vnComponent('vnWorkerPbx', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/worker/front/search-panel/index.js b/modules/worker/front/search-panel/index.js index ef85c998b..ac7405e78 100644 --- a/modules/worker/front/search-panel/index.js +++ b/modules/worker/front/search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnWorkerSearchPanel', { +ngModule.vnComponent('vnWorkerSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/worker/front/summary/index.js b/modules/worker/front/summary/index.js index f6ee85a5b..adc248ee2 100644 --- a/modules/worker/front/summary/index.js +++ b/modules/worker/front/summary/index.js @@ -54,7 +54,7 @@ class Controller extends Section { } } -ngModule.component('vnWorkerSummary', { +ngModule.vnComponent('vnWorkerSummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index d2c91bf94..a333b8585 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -92,7 +92,7 @@ { beforeEach(ngModule('worker')); - beforeEach(angular.mock.inject(($componentController, $rootScope, $stateParams, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, $stateParams, _$httpBackend_) => { $stateParams.id = 1; $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); diff --git a/modules/worker/front/worker-log/index.js b/modules/worker/front/worker-log/index.js index 1f1a4f2f8..e30ce7e22 100644 --- a/modules/worker/front/worker-log/index.js +++ b/modules/worker/front/worker-log/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -ngModule.component('vnWorkerLog', { +ngModule.vnComponent('vnWorkerLog', { template: require('./index.html'), controller: Section, }); diff --git a/modules/zone/back/models/zone-warehouse.json b/modules/zone/back/models/zone-warehouse.json index afb3bc2b4..14c4e84a4 100644 --- a/modules/zone/back/models/zone-warehouse.json +++ b/modules/zone/back/models/zone-warehouse.json @@ -10,6 +10,10 @@ "id": { "id": true, "type": "Number" + }, + "warehouseFk": { + "type": "Number", + "required": true } }, "relations": { diff --git a/modules/zone/front/basic-data/index.js b/modules/zone/front/basic-data/index.js index 40e5b49dc..402b471fc 100644 --- a/modules/zone/front/basic-data/index.js +++ b/modules/zone/front/basic-data/index.js @@ -9,7 +9,7 @@ class Controller extends Section { } } -ngModule.component('vnZoneBasicData', { +ngModule.vnComponent('vnZoneBasicData', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/zone/front/calendar/index.js b/modules/zone/front/calendar/index.js index e9265621e..00b6176c7 100644 --- a/modules/zone/front/calendar/index.js +++ b/modules/zone/front/calendar/index.js @@ -163,7 +163,7 @@ class Controller extends Component { } Controller.$inject = ['$element', '$scope', 'vnWeekDays']; -ngModule.component('vnZoneCalendar', { +ngModule.vnComponent('vnZoneCalendar', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/zone/front/calendar/index.spec.js b/modules/zone/front/calendar/index.spec.js index 00645b317..82d7a4471 100644 --- a/modules/zone/front/calendar/index.spec.js +++ b/modules/zone/front/calendar/index.spec.js @@ -8,7 +8,7 @@ describe('component vnZoneCalendar', () => { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(``); diff --git a/modules/zone/front/card/index.spec.js b/modules/zone/front/card/index.spec.js index 9d0911de2..64127990f 100644 --- a/modules/zone/front/card/index.spec.js +++ b/modules/zone/front/card/index.spec.js @@ -7,7 +7,7 @@ describe('Zone Component vnZoneCard', () => { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => { + beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { $httpBackend = _$httpBackend_; let $element = angular.element('
'); diff --git a/modules/zone/front/create/index.js b/modules/zone/front/create/index.js index c0bce4f08..859204d8d 100644 --- a/modules/zone/front/create/index.js +++ b/modules/zone/front/create/index.js @@ -18,7 +18,7 @@ export default class Controller extends Section { } } -ngModule.component('vnZoneCreate', { +ngModule.vnComponent('vnZoneCreate', { template: require('./index.html'), controller: Controller }); diff --git a/modules/zone/front/create/index.spec.js b/modules/zone/front/create/index.spec.js index 79fe00ed8..fe0088225 100644 --- a/modules/zone/front/create/index.spec.js +++ b/modules/zone/front/create/index.spec.js @@ -8,7 +8,7 @@ describe('Zone Component vnZoneCreate', () => { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => { + beforeEach(inject(($componentController, $rootScope, _$state_) => { $scope = $rootScope.$new(); $state = _$state_; $scope.watcher = watcher; diff --git a/modules/zone/front/delivery-days/index.js b/modules/zone/front/delivery-days/index.js index eb6d7795d..408c77be2 100644 --- a/modules/zone/front/delivery-days/index.js +++ b/modules/zone/front/delivery-days/index.js @@ -67,7 +67,7 @@ class Controller extends Section { } } -ngModule.component('vnZoneDeliveryDays', { +ngModule.vnComponent('vnZoneDeliveryDays', { template: require('./index.html'), controller: Controller }); diff --git a/modules/zone/front/delivery-days/index.spec.js b/modules/zone/front/delivery-days/index.spec.js index db99add2c..c39b34296 100644 --- a/modules/zone/front/delivery-days/index.spec.js +++ b/modules/zone/front/delivery-days/index.spec.js @@ -9,7 +9,7 @@ describe('Zone Component vnZoneDeliveryDays', () => { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { + beforeEach(inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; $element = angular.element(' { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { + beforeEach(inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; $element = angular.element(' { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(``); diff --git a/modules/zone/front/index/index.js b/modules/zone/front/index/index.js index b39c6139a..ad54f7df4 100644 --- a/modules/zone/front/index/index.js +++ b/modules/zone/front/index/index.js @@ -15,7 +15,7 @@ export default class Controller extends Section { } } -ngModule.component('vnZoneIndex', { +ngModule.vnComponent('vnZoneIndex', { template: require('./index.html'), controller: Controller }); diff --git a/modules/zone/front/location/index.js b/modules/zone/front/location/index.js index c30ded3ad..e1490c528 100644 --- a/modules/zone/front/location/index.js +++ b/modules/zone/front/location/index.js @@ -48,7 +48,7 @@ class Controller extends Section { } } -ngModule.component('vnZoneLocation', { +ngModule.vnComponent('vnZoneLocation', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/zone/front/location/index.spec.js b/modules/zone/front/location/index.spec.js index 6f2b139c0..30968209c 100644 --- a/modules/zone/front/location/index.spec.js +++ b/modules/zone/front/location/index.spec.js @@ -8,7 +8,7 @@ describe('component vnZoneLocation', () => { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); const $element = angular.element(``); diff --git a/modules/zone/front/main/index.spec.js b/modules/zone/front/main/index.spec.js index 24b63a959..1e50cee80 100644 --- a/modules/zone/front/main/index.spec.js +++ b/modules/zone/front/main/index.spec.js @@ -5,7 +5,7 @@ describe('Zone Component vnZone', () => { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject($componentController => { + beforeEach(inject($componentController => { const $element = angular.element(''); controller = $componentController('vnZone', {$element}); })); diff --git a/modules/zone/front/search-panel/index.js b/modules/zone/front/search-panel/index.js index c01ac35e5..598af02b2 100644 --- a/modules/zone/front/search-panel/index.js +++ b/modules/zone/front/search-panel/index.js @@ -1,7 +1,7 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; -ngModule.component('vnZoneSearchPanel', { +ngModule.vnComponent('vnZoneSearchPanel', { template: require('./index.html'), controller: SearchPanel }); diff --git a/modules/zone/front/summary/index.js b/modules/zone/front/summary/index.js index 47a6ba32a..6edb47a39 100644 --- a/modules/zone/front/summary/index.js +++ b/modules/zone/front/summary/index.js @@ -47,7 +47,7 @@ class Controller extends Section { } } -ngModule.component('vnZoneSummary', { +ngModule.vnComponent('vnZoneSummary', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/zone/front/summary/index.spec.js b/modules/zone/front/summary/index.spec.js index 49d6614ff..7541ee795 100644 --- a/modules/zone/front/summary/index.spec.js +++ b/modules/zone/front/summary/index.spec.js @@ -8,7 +8,7 @@ describe('component vnZoneSummary', () => { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; $scope = $rootScope.$new(); diff --git a/modules/zone/front/upcoming-deliveries/index.js b/modules/zone/front/upcoming-deliveries/index.js index e8e6909ae..371321711 100644 --- a/modules/zone/front/upcoming-deliveries/index.js +++ b/modules/zone/front/upcoming-deliveries/index.js @@ -17,7 +17,7 @@ class Controller extends Section { Controller.$inject = ['$element', '$scope', 'vnWeekDays']; -ngModule.component('vnUpcomingDeliveries', { +ngModule.vnComponent('vnUpcomingDeliveries', { template: require('./index.html'), controller: Controller }); diff --git a/modules/zone/front/upcoming-deliveries/index.spec.js b/modules/zone/front/upcoming-deliveries/index.spec.js index a92056102..95eb999f9 100644 --- a/modules/zone/front/upcoming-deliveries/index.spec.js +++ b/modules/zone/front/upcoming-deliveries/index.spec.js @@ -6,7 +6,7 @@ describe('component vnUpcomingDeliveries', () => { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject(($componentController, $rootScope) => { + beforeEach(inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); const $element = angular.element(``); controller = $componentController('vnUpcomingDeliveries', {$element, $scope}); diff --git a/modules/zone/front/warehouses/index.html b/modules/zone/front/warehouses/index.html index 835880c75..c22890958 100644 --- a/modules/zone/front/warehouses/index.html +++ b/modules/zone/front/warehouses/index.html @@ -28,7 +28,7 @@ + on-accept="$ctrl.onSave()"> { this.selected = null; @@ -52,7 +50,7 @@ class Controller extends Section { } } -ngModule.component('vnZoneWarehouses', { +ngModule.vnComponent('vnZoneWarehouses', { template: require('./index.html'), controller: Controller }); diff --git a/modules/zone/front/warehouses/index.spec.js b/modules/zone/front/warehouses/index.spec.js index aa9cef2e1..0e71d541c 100644 --- a/modules/zone/front/warehouses/index.spec.js +++ b/modules/zone/front/warehouses/index.spec.js @@ -8,7 +8,7 @@ describe('Zone warehouses', () => { beforeEach(ngModule('zone')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => { $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; $element = angular.element(' { jest.spyOn(controller, 'refresh').mockReturnThis(); $httpBackend.expect('POST', `Zones/1/warehouses`).respond(200); - controller.onSave('accept'); + controller.onSave(); $httpBackend.flush(); expect(controller.selected).toBeNull();