2378-imap #385

Merged
joan merged 8 commits from 2378-imap into dev 2020-09-23 12:46:34 +00:00
349 changed files with 679 additions and 717 deletions
Showing only changes of commit 96af9bdcf1 - Show all commits

View File

@ -0,0 +1,2 @@
UPDATE `salix`.`ACL` SET `model` = 'Calendar' WHERE (`id` = '155');
UPDATE `salix`.`ACL` SET `model` = 'Calendar' WHERE (`id` = '157');

View File

@ -1,12 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `workerCalendar2` AS
SELECT
`ce`.`id` AS `id`,
`ce`.`business_id` AS `businessFk`,
`ce`.`calendar_state_id` AS `absenceTypeFk`,
`ce`.`date` AS `dated`
FROM `postgresql`.`calendar_employee` `ce`;

View File

@ -556,7 +556,7 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF
(12, 1, 1, 1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
(13, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 3, CURDATE()),
(14, 1, 2, 1, NULL, CURDATE(), CURDATE(), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()),
(15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, 3, CURDATE()),
(15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, CURDATE()),
(16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
(17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
(18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()),

View File

@ -870,7 +870,7 @@ export default {
confirmed: 'vn-entry-summary vn-check[label="Confirmed"]',
},
entryDescriptor: {
agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(2) span',
agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(1) span',
travelsQuicklink: 'vn-entry-descriptor vn-quick-link[icon="local_airport"] > a',
entriesQuicklink: 'vn-entry-descriptor vn-quick-link[icon="icon-entry"] > a'
}

View File

@ -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: '<?',

View File

@ -192,7 +192,7 @@ export default class Autocomplete extends Field {
if (this.translateFields) {
if (this.translateFields.indexOf(this.showField) > -1)
this.input.value = this.$translate.instant(display);
this.input.value = this.$t(display);
}
}

View File

@ -135,7 +135,10 @@ export default class Calendar extends FormInput {
$days: [day],
$type: 'day'
});
// this.repaint();
// Repaint only if 'selection' event is not listening
if (!this.$events || this.$events && !this.$events['selection'])
this.repaint();
}
/*

View File

@ -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(`<div>${template}</div>`);
controller = $componentController('vnChip', {$element, $scope, $transclude: () => {}});

View File

@ -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: '<?',

View File

@ -21,7 +21,7 @@ export default class DataViewer {
}
}
ngModule.component('vnDataViewer', {
ngModule.vnComponent('vnDataViewer', {
template: require('./index.html'),
transclude: true,
controller: DataViewer,

View File

@ -9,7 +9,7 @@ describe('Component vnDatePicker', () => {
beforeEach(ngModule('vnCore'));
beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
beforeEach(inject(($compile, $rootScope, _$filter_) => {
$filter = _$filter_;
$element = $compile(`<vn-date-picker></vn-date-picker>`)($rootScope);

View File

@ -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('<vn-dialog><tpl-body>Body</tpl-body></vn-dialog>')($scope);
controller = $element.controller('vnDialog');

View File

@ -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');

View File

@ -25,7 +25,7 @@ class Icon {
}
Icon.$inject = ['$attrs'];
ngModule.component('vnIcon', {
ngModule.vnComponent('vnIcon', {
template: '<i class="{{::$ctrl.iconClass}} unselectable">{{::$ctrl.iconContent}}</i>',
controller: Icon,
bindings: {

View File

@ -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('<vn-input-file></vn-input-file>')($scope);
controller = $element.controller('vnInputFile');

View File

@ -6,7 +6,7 @@ describe('Component vnInputNumber', () => {
beforeEach(ngModule('vnCore'));
beforeEach(angular.mock.inject(($compile, $rootScope) => {
beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-input-number ng-model="model" />`)($rootScope);
$ctrl = $element.controller('vnInputNumber');
}));

View File

@ -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(`<vn-input-time></vn-input-time>`)($rootScope);

View File

@ -42,7 +42,7 @@ export default class Controller extends Component {
}
}
ngModule.component('vnLabelValue', {
ngModule.vnComponent('vnLabelValue', {
controller: Controller,
template: require('./index.html'),
transclude: true,

View File

@ -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: '<?',

View File

@ -11,6 +11,7 @@ import './style.scss';
export default class MultiCheck extends FormInput {
constructor($element, $scope) {
super($element, $scope);
this.checkAll = false;
this._checked = false;
this.checkField = 'checked';
this.isIntermediate = false;
@ -114,7 +115,7 @@ export default class MultiCheck extends FormInput {
}
}
ngModule.component('vnMultiCheck', {
ngModule.vnComponent('vnMultiCheck', {
template: require('./multi-check.html'),
controller: MultiCheck,
bindings: {

View File

@ -7,7 +7,7 @@ describe('Component vnMultiCheck', () => {
beforeEach(ngModule('vnCore'));
beforeEach(angular.mock.inject($componentController => {
beforeEach(inject($componentController => {
$element = angular.element(`<div class="shown"></div>`);
controller = $componentController('vnMultiCheck', {$element: $element});
controller._model = crudModel;

View File

@ -90,7 +90,7 @@ class Pagination extends Component {
}
}
ngModule.component('vnPagination', {
ngModule.vnComponent('vnPagination', {
template: require('./pagination.html'),
bindings: {
model: '<',

View File

@ -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: {

View File

@ -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
});
}
@ -189,7 +189,7 @@ export default class Searchbar extends Component {
}
doSearch(filter, source) {
if (filter === this.filter) return;
if (filter === this.filter && source != 'state') return;
let promise = this.onSearch({$params: filter});
promise = promise || this.$q.resolve();
promise.then(data => this.onFilter(filter, source, data));

View File

@ -19,7 +19,7 @@ export default class Portal {
}
Portal.$inject = ['$transclude', 'vnSlotService'];
ngModule.component('vnPortal', {
ngModule.vnComponent('vnPortal', {
controller: Portal,
transclude: true,
bindings: {

View File

@ -144,7 +144,7 @@ export default class Controller extends Component {
}
}
ngModule.component('vnSnackbar', {
ngModule.vnComponent('vnSnackbar', {
template: require('./snackbar.html'),
controller: Controller
});

View File

@ -54,4 +54,4 @@ export const component = {
},
controller: Spinner
};
ngModule.component('vnSpinner', component);
ngModule.vnComponent('vnSpinner', component);

View File

@ -6,7 +6,7 @@ describe('Component vnSpinner', () => {
beforeEach(ngModule('vnCore'));
beforeEach(angular.mock.inject(($compile, $rootScope) => {
beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-spinner></vn-spinner>`)($rootScope);
controller = $element.controller('vnSpinner');
}));

View File

@ -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: {

View File

@ -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});

View File

@ -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,

View File

@ -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(`
<vn-table model="model">

View File

@ -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: {

View File

@ -6,7 +6,7 @@ describe('Component vnTextarea', () => {
beforeEach(ngModule('vnCore'));
beforeEach(angular.mock.inject(($compile, $rootScope) => {
beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-textarea></vn-textarea>`)($rootScope);
$ctrl = $element.controller('vnTextarea');
}));

View File

@ -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,

View File

@ -7,7 +7,7 @@ describe('Component vnTh', () => {
beforeEach(ngModule('vnCore'));
beforeEach(angular.mock.inject($componentController => {
beforeEach(inject($componentController => {
$element = angular.element(`<div>${template}</div>`);
controller = $componentController('vnTh', {$element: $element});
controller.table = {

View File

@ -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,

View File

@ -49,7 +49,7 @@ class Controller {
}
Controller.$inject = ['$element', '$scope', '$compile'];
ngModule.component('vnTreeviewChild', {
ngModule.vnComponent('vnTreeviewChild', {
template: require('./child.html'),
controller: Controller,
bindings: {

View File

@ -2,7 +2,7 @@ import ngModule from '../../module';
class Controller {}
ngModule.component('vnTreeviewChilds', {
ngModule.vnComponent('vnTreeviewChilds', {
template: require('./childs.html'),
controller: Controller,
bindings: {

View File

@ -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: {

View File

@ -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: '@?',

View File

@ -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('<div></div>');
$state = _$state_;

View File

@ -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();
}));

View File

@ -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_;

View File

@ -107,7 +107,7 @@ export class DescriptorContent {
}
DescriptorContent.$inject = ['$transclude', 'vnModules'];
ngModule.component('vnDescriptorContent', {
ngModule.vnComponent('vnDescriptorContent', {
template: require('./index.html'),
controller: DescriptorContent,
bindings: {

View File

@ -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: {

View File

@ -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
});

View File

@ -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');
});
});
});

View File

@ -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: {

View File

@ -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('<div></div>');

View File

@ -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: {

View File

@ -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('<div></div>');
$state.current.name = 'client.card.summary';
$state.current.data = {moduleIndex: 0};

View File

@ -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
});

View File

@ -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,

View File

@ -80,7 +80,7 @@ class Controller {
}
Controller.$inject = ['$scope', '$translate', 'vnConfig', 'vnAuth'];
ngModule.component('vnUserPopover', {
ngModule.vnComponent('vnUserPopover', {
template: require('./index.html'),
controller: Controller
});

View File

@ -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();

View File

@ -154,7 +154,7 @@ export default class Controller extends Section {
}
}
ngModule.component('vnClaimAction', {
ngModule.vnComponent('vnClaimAction', {
template: require('./index.html'),
controller: Controller,
bindings: {

View File

@ -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();
});
});

View File

@ -11,7 +11,7 @@ class Controller extends Section {
}
}
ngModule.component('vnClaimBasicData', {
ngModule.vnComponent('vnClaimBasicData', {
template: require('./index.html'),
controller: Controller,
bindings: {

View File

@ -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('<vn-claim-basic-data></vn-claim-basic-data>');

View File

@ -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('<div></div>');

View File

@ -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: {

View File

@ -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();
});
});

View File

@ -15,7 +15,7 @@ class Controller extends Section {
}
}
ngModule.component('vnClaimDevelopment', {
ngModule.vnComponent('vnClaimDevelopment', {
template: require('./index.html'),
controller: Controller,
bindings: {

View File

@ -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;

View File

@ -19,7 +19,7 @@ export default class Controller extends Section {
}
}
ngModule.component('vnClaimIndex', {
ngModule.vnComponent('vnClaimIndex', {
template: require('./index.html'),
controller: Controller
});

View File

@ -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: {

View File

@ -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});

View File

@ -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
});

View File

@ -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: {

View File

@ -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('<vn-claim-summary></vn-claim-summary>');
@ -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();

View File

@ -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: {

View File

@ -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_;

View File

@ -81,7 +81,7 @@ export default class Controller extends Section {
}
}
ngModule.component('vnClientAddressEdit', {
ngModule.vnComponent('vnClientAddressEdit', {
template: require('./index.html'),
controller: Controller,
require: {

View File

@ -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_;

View File

@ -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: {

View File

@ -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();

View File

@ -83,7 +83,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
ngModule.component('vnClientBalanceIndex', {
ngModule.vnComponent('vnClientBalanceIndex', {
template: require('./index.html'),
controller: Controller,
});

View File

@ -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('<vn-client-balance-index></vn-client-balance-index>');
controller = $componentController('vnClientBalanceIndex', {$element, $scope});

View File

@ -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: {

View File

@ -77,7 +77,7 @@ export default class Controller extends Section {
}
}
ngModule.component('vnClientBillingData', {
ngModule.vnComponent('vnClientBillingData', {
template: require('./index.html'),
controller: Controller,
bindings: {

View File

@ -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('<vn-client-billing-data></vn-client-billing-data>');
$httpBackend = _$httpBackend_;
vnApp = _vnApp_;

View File

@ -8,7 +8,7 @@ export default class Controller extends ModuleCard {
}
}
ngModule.component('vnClientCard', {
ngModule.vnComponent('vnClientCard', {
template: require('./index.html'),
controller: Controller
});

View File

@ -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('<div></div>');

View File

@ -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
});

View File

@ -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: {

View File

@ -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_;

View File

@ -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: {

View File

@ -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
});

View File

@ -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 = {

View File

@ -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: {

View File

@ -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 = {

View File

@ -60,7 +60,7 @@
</vn-float-button>
<vn-confirm
vn-id="close-contract"
on-response="$ctrl.returnDialog($response)"
on-accept="$ctrl.returnDialog()"
question="Close contract"
message="Are you sure you want to close this contract?">
</vn-confirm>

View File

@ -51,17 +51,15 @@ class Controller extends Section {
this.$.closeContract.show();
}
returnDialog(response) {
if (response === 'accept') {
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: {

View File

@ -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('<vn-client-credit-insurance-index></vn-client-credit-insurance-index>');
@ -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);

View File

@ -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: {

View File

@ -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: {

Some files were not shown because too many files have changed in this diff Show More