API path prefix, repeated code removed from tests

This commit is contained in:
Juan Ferrer 2019-10-25 00:53:53 +02:00
parent ee196df2ff
commit c7384bb3ac
334 changed files with 854 additions and 1069 deletions

View File

@ -3,9 +3,7 @@ describe('Component vnAutocomplete', () => {
let controller; let controller;
let data = {id: 1, name: 'Bruce Wayne'}; let data = {id: 1, name: 'Bruce Wayne'};
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(($compile, $rootScope) => { beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-autocomplete></vn-autocomplete>`)($rootScope); $element = $compile(`<vn-autocomplete></vn-autocomplete>`)($rootScope);

View File

@ -2,9 +2,7 @@ describe('Component vnButtonMenu', () => {
let controller; let controller;
let $element; let $element;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(($compile, $rootScope) => { beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-icon-menu></vn-icon-menu>`)($rootScope); $element = $compile(`<vn-icon-menu></vn-icon-menu>`)($rootScope);

View File

@ -6,9 +6,7 @@ describe('Component vnCalendar', () => {
date.setHours(0, 0, 0, 0); date.setHours(0, 0, 0, 0);
date.setDate(1); date.setDate(1);
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(($compile, $rootScope) => { beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-calendar></vn-calendar`)($rootScope); $element = $compile(`<vn-calendar></vn-calendar`)($rootScope);

View File

@ -3,9 +3,7 @@ describe('Component vnCheck', () => {
let $ctrl; let $ctrl;
let element; let element;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(($compile, $rootScope) => { beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-check></vn-check>`)($rootScope); $element = $compile(`<vn-check></vn-check>`)($rootScope);

View File

@ -6,9 +6,7 @@ describe('Component vnChip', () => {
let $scope; let $scope;
let controller; let controller;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope) => { beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new(); $scope = $rootScope.$new();

View File

@ -3,9 +3,7 @@ describe('Component vnDatePicker', () => {
let $element; let $element;
let $ctrl; let $ctrl;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => { beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
$filter = _$filter_; $filter = _$filter_;

View File

@ -2,9 +2,7 @@ describe('Component vnDialog', () => {
let $element; let $element;
let controller; let controller;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject($componentController => { beforeEach(angular.mock.inject($componentController => {
$element = angular.element('<vn-dialog></vn-dialog>'); $element = angular.element('<vn-dialog></vn-dialog>');

View File

@ -2,9 +2,7 @@ describe('Component vnDropDown', () => {
let $element; let $element;
let controller; let controller;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(($compile, $rootScope, $document) => { beforeEach(inject(($compile, $rootScope, $document) => {
$element = $compile(`<vn-drop-down></vn-drop-down>`)($rootScope); $element = $compile(`<vn-drop-down></vn-drop-down>`)($rootScope);

View File

@ -7,9 +7,7 @@ describe('Component vnInputFile', () => {
let $element; let $element;
let controller; let controller;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope) => { beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new(); $scope = $rootScope.$new();

View File

@ -4,9 +4,7 @@ describe('Component vnInputNumber', () => {
let $element; let $element;
let $ctrl; let $ctrl;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($compile, $rootScope) => { beforeEach(angular.mock.inject(($compile, $rootScope) => {
$element = $compile(`<vn-input-number></vn-input-number>`)($rootScope); $element = $compile(`<vn-input-number></vn-input-number>`)($rootScope);

View File

@ -5,9 +5,7 @@ describe('Component vnInputTime', () => {
let $element; let $element;
let $ctrl; let $ctrl;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => { beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
$filter = _$filter_; $filter = _$filter_;

View File

@ -5,9 +5,7 @@ describe('Component vnInputTime', () => {
let $element; let $element;
let controller; let controller;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject($componentController => { beforeEach(angular.mock.inject($componentController => {
const $attrs = {}; const $attrs = {};

View File

@ -5,9 +5,7 @@ describe('Component vnMultiCheck', () => {
let controller; let controller;
let $element; let $element;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject($componentController => { beforeEach(angular.mock.inject($componentController => {
$element = angular.element(`<div class="shown"></div>`); $element = angular.element(`<div class="shown"></div>`);

View File

@ -4,9 +4,7 @@ describe('Component vnPopover', () => {
let $parent; let $parent;
let controller; let controller;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(($compile, $rootScope, $document) => { beforeEach(inject(($compile, $rootScope, $document) => {
$element = $compile(`<vn-popover>test</vn-popover>`)($rootScope); $element = $compile(`<vn-popover>test</vn-popover>`)($rootScope);

View File

@ -3,9 +3,7 @@ describe('Component vnRadio', () => {
let $ctrl; let $ctrl;
let element; let element;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(($compile, $rootScope) => { beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-radio val="myVal"></vn-radio`)($rootScope); $element = $compile(`<vn-radio val="myVal"></vn-radio`)($rootScope);

View File

@ -6,9 +6,7 @@ describe('Component vnSearchbar', () => {
let $state; let $state;
let $scope; let $scope;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, _$state_, $rootScope, $compile) => { beforeEach(angular.mock.inject(($componentController, _$state_, $rootScope, $compile) => {
$scope = $rootScope.$new(); $scope = $rootScope.$new();

View File

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

View File

@ -4,9 +4,7 @@ describe('Component vnStepControl', () => {
let controller; let controller;
let $state; let $state;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, _$state_) => { beforeEach(angular.mock.inject(($componentController, _$state_) => {
$state = _$state_; $state = _$state_;

View File

@ -5,9 +5,7 @@ describe('Component vnTable', () => {
let $element; let $element;
let controller; let controller;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope) => { beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new(); $scope = $rootScope.$new();

View File

@ -4,9 +4,7 @@ describe('Component vnTextarea', () => {
let $element; let $element;
let $ctrl; let $ctrl;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($compile, $rootScope) => { beforeEach(angular.mock.inject(($compile, $rootScope) => {
$element = $compile(`<vn-textarea></vn-textarea>`)($rootScope); $element = $compile(`<vn-textarea></vn-textarea>`)($rootScope);

View File

@ -5,9 +5,7 @@ describe('Component vnTh', () => {
let controller; let controller;
let $element; let $element;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject($componentController => { beforeEach(angular.mock.inject($componentController => {
$element = angular.element(`<div>${template}</div>`); $element = angular.element(`<div>${template}</div>`);

View File

@ -8,9 +8,7 @@ xdescribe('Component vnTooltip', () => {
let element; let element;
let window; let window;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(($componentController, $compile, $templateRequest, $document) => { beforeEach(inject(($componentController, $compile, $templateRequest, $document) => {
$element = angular.element(`<vn-tooltip class="text">test</span></vn-tooltip>`); $element = angular.element(`<vn-tooltip class="text">test</span></vn-tooltip>`);

View File

@ -2,9 +2,7 @@ describe('Component vnTreeview', () => {
let controller; let controller;
let $element; let $element;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(($compile, $rootScope) => { beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-treeview></vn-treeview>`)($rootScope); $element = $compile(`<vn-treeview></vn-treeview>`)($rootScope);

View File

@ -10,9 +10,7 @@ describe('Component vnWatcher', () => {
let $attrs; let $attrs;
let $q; let $q;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => { beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => {
$scope = $rootScope.$new(); $scope = $rootScope.$new();

View File

@ -4,12 +4,10 @@ describe('Directive acl', () => {
let element; let element;
let compile; let compile;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(($httpBackend, aclService) => { beforeEach(inject(($httpBackend, aclService) => {
$httpBackend.whenGET('/api/Accounts/acl') $httpBackend.whenGET('Accounts/acl')
.respond({ .respond({
user: {id: 1, name: 'myUser'}, user: {id: 1, name: 'myUser'},
roles: [ roles: [

View File

@ -1,9 +1,7 @@
describe('Directive bind', () => { describe('Directive bind', () => {
let compile; let compile;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
compile = html => { compile = html => {
inject(($compile, $rootScope) => { inject(($compile, $rootScope) => {

View File

@ -5,9 +5,7 @@ describe('Directive dialog', () => {
let compile; let compile;
let controller; let controller;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
compile = _element => { compile = _element => {
inject(($compile, $rootScope) => { inject(($compile, $rootScope) => {

View File

@ -3,9 +3,7 @@ describe('Directive focus', () => {
let $element; let $element;
let compile; let compile;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
compile = (_element, _childElement) => { compile = (_element, _childElement) => {
inject(($compile, $rootScope) => { inject(($compile, $rootScope) => {

View File

@ -4,9 +4,7 @@ describe('Directive vnId', () => {
let $element; let $element;
let compile; let compile;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
compile = _element => { compile = _element => {
inject(($compile, $rootScope) => { inject(($compile, $rootScope) => {

View File

@ -3,9 +3,7 @@ describe('Directive rule', () => {
let $element; let $element;
let element; let element;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
function compile(html, value) { function compile(html, value) {
inject(($compile, $rootScope, $window) => { inject(($compile, $rootScope, $window) => {

View File

@ -5,9 +5,7 @@ describe('Directive zoomImage', () => {
let srcZoom = 'http://zoom.img.jpg/'; let srcZoom = 'http://zoom.img.jpg/';
let findContainer; let findContainer;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($compile, $rootScope) => { beforeEach(angular.mock.inject(($compile, $rootScope) => {
compile = $compile; compile = $compile;

View File

@ -23,7 +23,7 @@ export function directive($http, $compile, vnApp, $translate) {
} }
function getTableConfig(tableCode) { function getTableConfig(tableCode) {
return $http.get(`/api/UserConfigViews/getConfig?tableCode=${tableCode}`); return $http.get(`UserConfigViews/getConfig?tableCode=${tableCode}`);
} }
function createViewConfig(config, fields) { function createViewConfig(config, fields) {
@ -73,7 +73,7 @@ export function directive($http, $compile, vnApp, $translate) {
function saveConfiguration(tableConfiguration) { function saveConfiguration(tableConfiguration) {
tableConfiguration.configuration = JSON.parse(JSON.stringify(tableConfiguration.configuration)); tableConfiguration.configuration = JSON.parse(JSON.stringify(tableConfiguration.configuration));
return $http.post(`/api/UserConfigViews/save`, tableConfiguration); return $http.post(`UserConfigViews/save`, tableConfiguration);
} }
return { return {

View File

@ -2,9 +2,7 @@ describe('Currency filter', () => {
let compile; let compile;
let $element; let $element;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
compile = html => { compile = html => {
inject(($compile, $rootScope) => { inject(($compile, $rootScope) => {

View File

@ -1,12 +1,10 @@
describe('Service acl', () => { describe('Service acl', () => {
let aclService; let aclService;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject((_aclService_, $httpBackend) => { beforeEach(inject((_aclService_, $httpBackend) => {
$httpBackend.when('GET', `/api/Accounts/acl`).respond({ $httpBackend.when('GET', `Accounts/acl`).respond({
roles: [ roles: [
{role: {name: 'foo'}}, {role: {name: 'foo'}},
{role: {name: 'bar'}}, {role: {name: 'bar'}},

View File

@ -1,9 +1,7 @@
describe('factory vnModuleLoader', () => { describe('factory vnModuleLoader', () => {
let vnModuleLoader; let vnModuleLoader;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject((_vnModuleLoader_, $rootScope, $window) => { beforeEach(angular.mock.inject((_vnModuleLoader_, $rootScope, $window) => {
vnModuleLoader = _vnModuleLoader_; vnModuleLoader = _vnModuleLoader_;

View File

@ -3,9 +3,7 @@ import {validate} from '../validator.js';
describe('Validator', () => { describe('Validator', () => {
let $translate; let $translate;
beforeEach(angular.mock.module('vnCore', $translateProvider => { beforeEach(ngModule('vnCore'));
$translateProvider.translations('en', {});
}));
beforeEach(inject(_$translate_ => { beforeEach(inject(_$translate_ => {
$translate = _$translate_; $translate = _$translate_;

View File

@ -9,8 +9,8 @@ export default ngModule;
* to the component controller class with the merged component options. To * to the component controller class with the merged component options. To
* retrieve parent options, it reads the same property of the parent class, so * retrieve parent options, it reads the same property of the parent class, so
* for the parent options to be copied, it must have been declared using this * for the parent options to be copied, it must have been declared using this
* same function. If any of the options (template, transclude, bindings ...) is * same function. If any of the options (template, transclude, bindings...) is
* redeclared in the child component, it has preference. * redeclared in the child component, the last has preference.
* *
* @param {String} name Coponent name in camelCase * @param {String} name Coponent name in camelCase
* @param {Object} options The component options * @param {Object} options The component options
@ -32,6 +32,10 @@ ngModule.vnComponent = function(name, options) {
bindings: Object.assign({}, bindings: Object.assign({},
parentOptions.bindings, parentOptions.bindings,
options.bindings options.bindings
),
require: Object.assign({},
parentOptions.require,
options.require
) )
} }
); );

View File

@ -11,7 +11,7 @@ class AclService {
} }
load() { load() {
return this.$http.get('/api/Accounts/acl').then(res => { return this.$http.get('Accounts/acl').then(res => {
this.user = res.data.user; this.user = res.data.user;
this.roles = {}; this.roles = {};

View File

@ -53,7 +53,7 @@ export default class Auth {
password: password || undefined password: password || undefined
}; };
return this.$http.post('/api/Accounts/login', params).then( return this.$http.post('Accounts/login', params).then(
json => this.onLoginOk(json, remember)); json => this.onLoginOk(json, remember));
} }
@ -70,7 +70,7 @@ export default class Auth {
} }
logout() { logout() {
let promise = this.$http.post('/api/Accounts/logout', null, { let promise = this.$http.post('Accounts/logout', null, {
headers: {Authorization: this.vnToken.token} headers: {Authorization: this.vnToken.token}
}).catch(() => {}); }).catch(() => {});

View File

@ -25,7 +25,7 @@ export default class Config {
for (let param of this.params) for (let param of this.params)
this.local[param] = this.getItem(param); this.local[param] = this.getItem(param);
return this.$http.get('api/UserConfigs/getUserConfig') return this.$http.get('UserConfigs/getUserConfig')
.then(res => { .then(res => {
for (let param of this.params) for (let param of this.params)
this.user[param] = res.data[param]; this.user[param] = res.data[param];
@ -47,7 +47,7 @@ export default class Config {
this.mergeParams(); this.mergeParams();
let params = {[param]: value}; let params = {[param]: value};
return this.$http.post('api/UserConfigs/setUserConfig', params) return this.$http.post('UserConfigs/setUserConfig', params)
.then(() => this.showSaved()); .then(() => this.showSaved());
} }

View File

@ -3,10 +3,17 @@ import HttpError from 'core/lib/http-error';
interceptor.$inject = ['$q', 'vnApp', 'vnToken', '$translate']; interceptor.$inject = ['$q', 'vnApp', 'vnToken', '$translate'];
function interceptor($q, vnApp, vnToken, $translate) { function interceptor($q, vnApp, vnToken, $translate) {
let apiPath = 'api/';
return { return {
request: function(config) { setApiPath(path) {
apiPath = path;
},
request(config) {
vnApp.pushLoader(); vnApp.pushLoader();
if (config.url.charAt(0) !== '/' && apiPath)
config.url = `${apiPath}/${config.url}`;
if (vnToken.token) if (vnToken.token)
config.headers.Authorization = vnToken.token; config.headers.Authorization = vnToken.token;
if ($translate.use()) if ($translate.use())
@ -14,14 +21,14 @@ function interceptor($q, vnApp, vnToken, $translate) {
return config; return config;
}, },
requestError: function(rejection) { requestError(rejection) {
return $q.reject(rejection); return $q.reject(rejection);
}, },
response: function(response) { response(response) {
vnApp.popLoader(); vnApp.popLoader();
return response; return response;
}, },
responseError: function(rejection) { responseError(rejection) {
vnApp.popLoader(); vnApp.popLoader();
let err = new HttpError(rejection.statusText); let err = new HttpError(rejection.statusText);
Object.assign(err, rejection); Object.assign(err, rejection);

View File

@ -4,9 +4,7 @@ describe('Component vnLeftMenu', () => {
let controller; let controller;
let $element; let $element;
beforeEach(angular.mock.module('salix', $translateProvider => { beforeEach(ngModule('salix'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $state, $window) => { beforeEach(angular.mock.inject(($componentController, $state, $window) => {
$element = angular.element('<div></div>'); $element = angular.element('<div></div>');

View File

@ -16,7 +16,7 @@ export default class MainMenu {
} }
getCurrentUserName() { getCurrentUserName() {
this.$http.get('/api/Accounts/getCurrentUserData').then(json => { this.$http.get('Accounts/getCurrentUserData').then(json => {
this.$.$root.user = json.data; this.$.$root.user = json.data;
window.localStorage.currentUserWorkerId = json.data.workerId; window.localStorage.currentUserWorkerId = json.data.workerId;
}); });

View File

@ -4,9 +4,7 @@ describe('Component vnMainMenu', () => {
let $httpBackend; let $httpBackend;
let controller; let controller;
beforeEach(angular.mock.module('salix', $translateProvider => { beforeEach(ngModule('salix'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
let vnModules = {get: () => {}}; let vnModules = {get: () => {}};
@ -16,8 +14,8 @@ describe('Component vnMainMenu', () => {
describe('getCurrentUserName()', () => { describe('getCurrentUserName()', () => {
it(`should set the user name property in the controller`, () => { it(`should set the user name property in the controller`, () => {
$httpBackend.when('GET', `/api/Accounts/getCurrentUserData`).respond({name: 'batman'}); $httpBackend.when('GET', `Accounts/getCurrentUserData`).respond({name: 'batman'});
$httpBackend.expect('GET', `/api/Accounts/getCurrentUserData`); $httpBackend.expect('GET', `Accounts/getCurrentUserData`);
controller.getCurrentUserName(); controller.getCurrentUserName();
$httpBackend.flush(); $httpBackend.flush();

View File

@ -1,11 +1,11 @@
<vn-crud-model <vn-crud-model
url="/api/Warehouses" url="Warehouses"
vn-id="warehouses" vn-id="warehouses"
data="warehousesData" data="warehousesData"
order="name"> order="name">
</vn-crud-model> </vn-crud-model>
<vn-crud-model <vn-crud-model
url="/api/Companies" url="Companies"
vn-id="companies" vn-id="companies"
data="companiesData" data="companiesData"
order="code"> order="code">
@ -41,7 +41,7 @@
label="Local bank" label="Local bank"
id="localBank" id="localBank"
ng-model="$ctrl.localBankFk" ng-model="$ctrl.localBankFk"
url="/api/Banks" url="Banks"
select-fields="['id','bank']" select-fields="['id','bank']"
show-field="bank" show-field="bank"
order="id" order="id"

View File

@ -5,12 +5,10 @@ describe('Salix', () => {
let controller; let controller;
let $scope; let $scope;
beforeEach(angular.mock.module('salix', $translateProvider => { beforeEach(ngModule('salix'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope, $httpBackend) => { beforeEach(angular.mock.inject(($componentController, $rootScope, $httpBackend) => {
$httpBackend.expectGET('api/UserConfigs/getUserConfig'); $httpBackend.expectGET('UserConfigs/getUserConfig');
$scope = $rootScope.$new(); $scope = $rootScope.$new();
controller = $componentController('vnUserPopover', {$scope}); controller = $componentController('vnUserPopover', {$scope});

View File

@ -1,6 +1,6 @@
import 'angular'; import 'angular';
import 'angular-mocks'; import 'angular-mocks';
import './front/core/module.js'; import core from './front/core/module.js';
import './front/salix/components/app/app.js'; import './front/salix/components/app/app.js';
import './modules/agency/front/module.js'; import './modules/agency/front/module.js';
import './modules/claim/front/module.js'; import './modules/claim/front/module.js';
@ -12,3 +12,23 @@ import './modules/route/front/module.js';
import './modules/ticket/front/module.js'; import './modules/ticket/front/module.js';
import './modules/travel/front/module.js'; import './modules/travel/front/module.js';
import './modules/worker/front/module.js'; import './modules/worker/front/module.js';
core.run(vnInterceptor => {
vnInterceptor.setApiPath(null);
});
window.ngModule = function(moduleName) {
return angular.mock.module(moduleName, function($provide, $translateProvider) {
// Avoid unexpected request warnings caused by angular translate
// https://angular-translate.github.io/docs/#/guide/22_unit-testing-with-angular-translate
$provide.factory('customLocaleLoader', function($q) {
return function() {
let deferred = $q.defer();
deferred.resolve({});
return deferred.promise;
};
});
$translateProvider.useLoader('customLocaleLoader');
});
};

View File

@ -1,4 +1,4 @@
<mg-ajax path="/agency/api/Zones/{{patch.params.id}}" options="vnPatch"></mg-ajax> <mg-ajax path="Zones/{{patch.params.id}}" options="vnPatch"></mg-ajax>
<vn-watcher <vn-watcher
vn-id="watcher" vn-id="watcher"
data="$ctrl.zone" data="$ctrl.zone"
@ -22,7 +22,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="$ctrl.zone.agencyModeFk" ng-model="$ctrl.zone.agencyModeFk"
url="/agency/api/AgencyModes" url="AgencyModes"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Agency" label="Agency"

View File

@ -18,7 +18,7 @@ class Controller {
} }
}; };
let json = encodeURIComponent(JSON.stringify(filter)); let json = encodeURIComponent(JSON.stringify(filter));
let query = `/agency/api/Zones/${this.$stateParams.id}?filter=${json}`; let query = `Zones/${this.$stateParams.id}?filter=${json}`;
this.$http.get(query).then(res => { this.$http.get(query).then(res => {
if (res.data) if (res.data)
this.zone = res.data; this.zone = res.data;

View File

@ -6,9 +6,7 @@ describe('Agency Component vnZoneCard', () => {
let $httpBackend; let $httpBackend;
let $stateParams; let $stateParams;
beforeEach(angular.mock.module('agency', $translateProvider => { beforeEach(ngModule('agency'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
@ -26,7 +24,7 @@ describe('Agency Component vnZoneCard', () => {
} }
}; };
let json = encodeURIComponent(JSON.stringify(filter)); let json = encodeURIComponent(JSON.stringify(filter));
$httpBackend.expectGET(`/agency/api/Zones/1?filter=${json}`).respond({id: 1}); $httpBackend.expectGET(`Zones/1?filter=${json}`).respond({id: 1});
controller.getCard(); controller.getCard();
$httpBackend.flush(); $httpBackend.flush();

View File

@ -1,4 +1,4 @@
<mg-ajax path="/agency/api/Zones" options="vnPost"></mg-ajax> <mg-ajax path="Zones" options="vnPost"></mg-ajax>
<vn-watcher <vn-watcher
vn-id="watcher" vn-id="watcher"
data="$ctrl.zone" data="$ctrl.zone"
@ -21,7 +21,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="$ctrl.zone.warehouseFk" ng-model="$ctrl.zone.warehouseFk"
url="/agency/api/Warehouses" url="Warehouses"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Warehouse" label="Warehouse"
@ -30,7 +30,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="$ctrl.zone.agencyModeFk" ng-model="$ctrl.zone.agencyModeFk"
url="/agency/api/AgencyModes/isActive" url="AgencyModes/isActive"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Agency" label="Agency"

View File

@ -6,9 +6,7 @@ describe('Agency Component vnZoneCreate', () => {
let $state; let $state;
let controller; let controller;
beforeEach(angular.mock.module('agency', $translateProvider => { beforeEach(ngModule('agency'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => { beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
$scope = $rootScope.$new(); $scope = $rootScope.$new();

View File

@ -6,7 +6,7 @@
vn-one vn-one
label="Agency" label="Agency"
ng-model="$ctrl.params.agencyModeFk" ng-model="$ctrl.params.agencyModeFk"
url="/api/AgencyModes/isActive"> url="AgencyModes/isActive">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
@ -14,7 +14,7 @@
vn-one vn-one
label="Province" label="Province"
ng-model="$ctrl.params.provinceFk" ng-model="$ctrl.params.provinceFk"
url="/api/Provinces" url="Provinces"
fields="['countryFk']" fields="['countryFk']"
include="'country'" include="'country'"
style="margin-right: .5em;"> style="margin-right: .5em;">

View File

@ -10,7 +10,7 @@ class Controller {
} }
onSubmit() { onSubmit() {
this.$http.get(`/api/Zones/getEvents`, {params: this.params}) this.$http.get(`Zones/getEvents`, {params: this.params})
.then(res => this.$.data = res.data); .then(res => this.$.data = res.data);
} }
} }

View File

@ -20,7 +20,7 @@ class Controller {
returnDialog(response) { returnDialog(response) {
if (response === 'ACCEPT') { if (response === 'ACCEPT') {
this.$http.delete(`/agency/api/Zones/${this.zone.id}`).then(() => { this.$http.delete(`Zones/${this.zone.id}`).then(() => {
this.$state.go('zone.index'); this.$state.go('zone.index');
}); });
} }

View File

@ -1,4 +1,4 @@
<mg-ajax path="/agency/api/Zones/{{patch.params.id}}" options="vnPatch"></mg-ajax> <mg-ajax path="Zones/{{patch.params.id}}" options="vnPatch"></mg-ajax>
<vn-watcher <vn-watcher
vn-id="watcher" vn-id="watcher"
data="$ctrl.zone" data="$ctrl.zone"
@ -22,7 +22,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="$ctrl.zone.warehouseFk" ng-model="$ctrl.zone.warehouseFk"
url="/agency/api/Warehouses" url="Warehouses"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Warehouse" label="Warehouse"
@ -31,7 +31,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="$ctrl.zone.agencyModeFk" ng-model="$ctrl.zone.agencyModeFk"
url="/agency/api/AgencyModes/isActive" url="AgencyModes/isActive"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Agency" label="Agency"

View File

@ -7,8 +7,8 @@ class Controller extends Component {
this.vnWeekDays = vnWeekDays; this.vnWeekDays = vnWeekDays;
this.editMode = 'include'; this.editMode = 'include';
this.path = `api/Zones/${this.$params.id}/events`; this.path = `Zones/${this.$params.id}/events`;
this.exclusionsPath = `api/Zones/${this.$params.id}/exclusions`; this.exclusionsPath = `Zones/${this.$params.id}/exclusions`;
this.refresh(); this.refresh();
} }

View File

@ -1,6 +1,6 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="/api/Zones" url="Zones"
filter="::$ctrl.filter" filter="::$ctrl.filter"
limit="20" limit="20"
data="zones" data="zones"

View File

@ -43,7 +43,7 @@ export default class Controller {
*/ */
onCloneAccept(response) { onCloneAccept(response) {
if (!(response == 'ACCEPT' && this.selectedZone)) return; if (!(response == 'ACCEPT' && this.selectedZone)) return;
const query = `/agency/api/Zones/${this.selectedZone.id}/clone`; const query = `Zones/${this.selectedZone.id}/clone`;
this.$http.post(query).then(res => { this.$http.post(query).then(res => {
if (res && res.data) if (res && res.data)
this.$state.go('zone.card.basicData', {id: res.data.id}); this.$state.go('zone.card.basicData', {id: res.data.id});

View File

@ -4,9 +4,7 @@ describe('Agency Component vnZoneIndex', () => {
let $componentController; let $componentController;
let controller; let controller;
beforeEach(angular.mock.module('agency', $translateProvider => { beforeEach(ngModule('agency'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(_$componentController_ => { beforeEach(angular.mock.inject(_$componentController_ => {
$componentController = _$componentController_; $componentController = _$componentController_;

View File

@ -20,7 +20,7 @@
vn-one vn-one
label="Agency" label="Agency"
ng-model="filter.agencyModeFk" ng-model="filter.agencyModeFk"
url="/agency/api/AgencyModes/isActive" url="AgencyModes/isActive"
show-field="name" show-field="name"
value-field="id"> value-field="id">
</vn-autocomplete> </vn-autocomplete>
@ -28,7 +28,7 @@
vn-one vn-one
label="Warehouse" label="Warehouse"
ng-model="filter.warehouseFk" ng-model="filter.warehouseFk"
url="/agency/api/Warehouses" url="Warehouses"
show-field="name" show-field="name"
value-field="id"> value-field="id">
</vn-autocomplete> </vn-autocomplete>

View File

@ -1,6 +1,6 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="/api/Zones/{{$ctrl.$params.id}}/getLeaves" url="Zones/{{$ctrl.$params.id}}/getLeaves"
filter="::$ctrl.filter"> filter="::$ctrl.filter">
</vn-crud-model> </vn-crud-model>
<div class="vn-w-md"> <div class="vn-w-md">

View File

@ -40,7 +40,7 @@ class Controller extends Component {
if (value == null) if (value == null)
value = undefined; value = undefined;
const params = {geoId: item.id, isIncluded: value}; const params = {geoId: item.id, isIncluded: value};
const path = `/api/zones/${this.zone.id}/toggleIsIncluded`; const path = `zones/${this.zone.id}/toggleIsIncluded`;
this.$http.post(path, params); this.$http.post(path, params);
} }
} }

View File

@ -21,7 +21,7 @@
vn-one vn-one
label="Agency" label="Agency"
ng-model="filter.agencyModeFk" ng-model="filter.agencyModeFk"
url="/api/AgencyModes/isActive" url="AgencyModes/isActive"
show-field="name" show-field="name"
value-field="id"> value-field="id">
</vn-autocomplete> </vn-autocomplete>

View File

@ -23,7 +23,7 @@ class Controller {
where: {id: this.zone.id} where: {id: this.zone.id}
}; };
filter = encodeURIComponent(JSON.stringify((filter))); filter = encodeURIComponent(JSON.stringify((filter)));
this.$http.get(`/agency/api/Zones/findOne?filter=${filter}`).then(res => { this.$http.get(`Zones/findOne?filter=${filter}`).then(res => {
if (res && res.data) if (res && res.data)
this.summary = res.data; this.summary = res.data;
}); });

View File

@ -33,7 +33,7 @@
<vn-vertical> <vn-vertical>
<vn-autocomplete <vn-autocomplete
ng-model="$ctrl.selected.warehouseFk" ng-model="$ctrl.selected.warehouseFk"
url="/api/Warehouses" url="Warehouses"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Warehouse"> label="Warehouse">

View File

@ -5,7 +5,7 @@ class Controller extends Component {
constructor($element, $) { constructor($element, $) {
super($element, $); super($element, $);
this.path = `/api/Zones/${this.$params.id}/warehouses`; this.path = `Zones/${this.$params.id}/warehouses`;
this.refresh(); this.refresh();
} }

View File

@ -1,11 +1,11 @@
<vn-crud-model vn-id="model" auto-load="true" auto-save="true" <vn-crud-model vn-id="model" auto-load="true" auto-save="true"
url="claim/api/ClaimEnds" url="ClaimEnds"
filter="$ctrl.filter" filter="$ctrl.filter"
data="$ctrl.salesClaimed"> data="$ctrl.salesClaimed">
</vn-crud-model> </vn-crud-model>
<vn-crud-model auto-load="true" <vn-crud-model auto-load="true"
url="/claim/api/ClaimDestinations" url="ClaimDestinations"
data="claimDestinations"> data="claimDestinations">
</vn-crud-model> </vn-crud-model>
@ -161,7 +161,7 @@
</vn-dialog> </vn-dialog>
<vn-crud-model <vn-crud-model
vn-id="lastTicketsModel" vn-id="lastTicketsModel"
url="/claim/api/Tickets" url="Tickets"
limit="20" limit="20"
data="lastTickets" auto-load="false"> data="lastTickets" auto-load="false">
</vn-crud-model> </vn-crud-model>

View File

@ -35,7 +35,7 @@ class Controller {
getClaimedSales() { getClaimedSales() {
let json = encodeURIComponent(JSON.stringify(this.claim.id)); let json = encodeURIComponent(JSON.stringify(this.claim.id));
let query = `/claim/api/ClaimBeginnings/${json}`; let query = `ClaimBeginnings/${json}`;
this.$http.get(query).then(res => { this.$http.get(query).then(res => {
if (res.data) if (res.data)
this.claimedSales = res.data; this.claimedSales = res.data;
@ -44,7 +44,7 @@ class Controller {
addClaimedSale(saleFk) { addClaimedSale(saleFk) {
let saleToAdd = {saleFk: saleFk, claimFk: this.claim.id, workerFk: this.claim.workerFk, claimDestinationFk: 1}; let saleToAdd = {saleFk: saleFk, claimFk: this.claim.id, workerFk: this.claim.workerFk, claimDestinationFk: 1};
let query = `claim/api/ClaimEnds/`; let query = `ClaimEnds/`;
this.$http.post(query, saleToAdd).then(() => { this.$http.post(query, saleToAdd).then(() => {
this.$.model.refresh(); this.$.model.refresh();
this.$.addSales.hide(); this.$.addSales.hide();
@ -54,7 +54,7 @@ class Controller {
deleteClaimedSale(id) { deleteClaimedSale(id) {
let json = encodeURIComponent(JSON.stringify(id)); let json = encodeURIComponent(JSON.stringify(id));
let query = `claim/api/ClaimEnds/${json}`; let query = `ClaimEnds/${json}`;
this.$http.delete(query).then(() => { this.$http.delete(query).then(() => {
this.$.model.refresh(); this.$.model.refresh();
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
@ -62,7 +62,7 @@ class Controller {
} }
importToNewRefundTicket() { importToNewRefundTicket() {
let query = `claim/api/ClaimBeginnings/${this.$stateParams.id}/importToNewRefundTicket`; let query = `ClaimBeginnings/${this.$stateParams.id}/importToNewRefundTicket`;
return this.$http.post(query).then(() => { return this.$http.post(query).then(() => {
this.$.model.refresh(); this.$.model.refresh();
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
@ -113,7 +113,7 @@ class Controller {
importTicketLines(ticketFk) { importTicketLines(ticketFk) {
let data = {claimFk: this.$stateParams.id, ticketFk: ticketFk}; let data = {claimFk: this.$stateParams.id, ticketFk: ticketFk};
let query = `/claim/api/ClaimEnds/importTicketSales`; let query = `ClaimEnds/importTicketSales`;
this.$http.post(query, data).then(() => { this.$http.post(query, data).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.$.lastTicketsPopover.hide(); this.$.lastTicketsPopover.hide();
@ -123,7 +123,7 @@ class Controller {
regularize() { regularize() {
let data = {claimFk: this.$stateParams.id}; let data = {claimFk: this.$stateParams.id};
let query = `/claim/api/Claims/regularizeClaim`; let query = `Claims/regularizeClaim`;
return this.$http.post(query, data).then(() => { return this.$http.post(query, data).then(() => {
this.card.reload(); this.card.reload();
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
@ -136,7 +136,7 @@ class Controller {
if (response !== 'ACCEPT') if (response !== 'ACCEPT')
return; return;
let greugeTypeFreight = 7; let greugeTypeFreight = 7;
let query = `claim/api/Greuges/`; let query = `Greuges/`;
let data = { let data = {
clientFk: this.claim.clientFk, clientFk: this.claim.clientFk,
description: `claim: ${this.claim.id}`, description: `claim: ${this.claim.id}`,
@ -158,14 +158,14 @@ class Controller {
} }
saveResponsibility(value) { saveResponsibility(value) {
let query = `/api/Claims/${this.$stateParams.id}/updateClaimAction`; let query = `Claims/${this.$stateParams.id}/updateClaimAction`;
this.$http.post(query, {responsibility: value}).then(() => { this.$http.post(query, {responsibility: value}).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
}); });
} }
saveMana(value) { saveMana(value) {
let query = `/api/Claims/${this.$stateParams.id}/updateClaimAction`; let query = `Claims/${this.$stateParams.id}/updateClaimAction`;
this.$http.post(query, {isChargedToMana: value}).then(() => { this.$http.post(query, {isChargedToMana: value}).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));

View File

@ -7,9 +7,7 @@ describe('claim', () => {
let $httpBackend; let $httpBackend;
let $state; let $state;
beforeEach(angular.mock.module('claim', $translateProvider => { beforeEach(ngModule('claim'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => { beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => {
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
@ -46,7 +44,7 @@ describe('claim', () => {
describe('getClaimedSales()', () => { describe('getClaimedSales()', () => {
it('should make a query and set salesToClaim', () => { it('should make a query and set salesToClaim', () => {
controller.claim.id = 1; controller.claim.id = 1;
$httpBackend.expectGET(`/claim/api/ClaimBeginnings/1`).respond(200, 1); $httpBackend.expectGET(`ClaimBeginnings/1`).respond(200, 1);
controller.getClaimedSales(); controller.getClaimedSales();
$httpBackend.flush(); $httpBackend.flush();
@ -59,7 +57,7 @@ describe('claim', () => {
spyOn(controller.$.model, 'refresh'); spyOn(controller.$.model, 'refresh');
spyOn(controller.$.addSales, 'hide'); spyOn(controller.$.addSales, 'hide');
spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.vnApp, 'showSuccess');
$httpBackend.expectPOST(`claim/api/ClaimEnds/`).respond({}); $httpBackend.expectPOST(`ClaimEnds/`).respond({});
controller.addClaimedSale(1); controller.addClaimedSale(1);
$httpBackend.flush(); $httpBackend.flush();
@ -73,7 +71,7 @@ describe('claim', () => {
it('should make a delete and call refresh and showSuccess', () => { it('should make a delete and call refresh and showSuccess', () => {
spyOn(controller.$.model, 'refresh'); spyOn(controller.$.model, 'refresh');
spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.vnApp, 'showSuccess');
$httpBackend.expectDELETE(`claim/api/ClaimEnds/1`).respond({}); $httpBackend.expectDELETE(`ClaimEnds/1`).respond({});
controller.deleteClaimedSale(1); controller.deleteClaimedSale(1);
$httpBackend.flush(); $httpBackend.flush();
@ -99,7 +97,7 @@ describe('claim', () => {
it('should perform a post query and add lines from a new ticket', () => { it('should perform a post query and add lines from a new ticket', () => {
spyOn(controller.$.model, 'refresh'); spyOn(controller.$.model, 'refresh');
spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.vnApp, 'showSuccess');
$httpBackend.expect('POST', `claim/api/ClaimBeginnings/1/importToNewRefundTicket`).respond({}); $httpBackend.expect('POST', `ClaimBeginnings/1/importToNewRefundTicket`).respond({});
controller.importToNewRefundTicket(); controller.importToNewRefundTicket();
$httpBackend.flush(); $httpBackend.flush();
@ -125,7 +123,7 @@ describe('claim', () => {
spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.vnApp, 'showSuccess');
spyOn(controller.$.lastTicketsPopover, 'hide'); spyOn(controller.$.lastTicketsPopover, 'hide');
let data = {claimFk: 1, ticketFk: 1}; let data = {claimFk: 1, ticketFk: 1};
$httpBackend.expect('POST', `/claim/api/ClaimEnds/importTicketSales`, data).respond({}); $httpBackend.expect('POST', `ClaimEnds/importTicketSales`, data).respond({});
controller.importTicketLines(1); controller.importTicketLines(1);
$httpBackend.flush(); $httpBackend.flush();
@ -141,7 +139,7 @@ describe('claim', () => {
spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.vnApp, 'showSuccess');
let data = {claimFk: $state.params.id}; let data = {claimFk: $state.params.id};
$httpBackend.expect('POST', `/claim/api/Claims/regularizeClaim`, data).respond({}); $httpBackend.expect('POST', `Claims/regularizeClaim`, data).respond({});
controller.regularize(); controller.regularize();
$httpBackend.flush(); $httpBackend.flush();
@ -175,7 +173,7 @@ describe('claim', () => {
greugeTypeFk: 7, greugeTypeFk: 7,
ticketFk: controller.claim.ticketFk ticketFk: controller.claim.ticketFk
}; };
$httpBackend.expect('POST', `claim/api/Greuges/`, data).respond(); $httpBackend.expect('POST', `Greuges/`, data).respond();
controller.onUpdateGreugeResponse('ACCEPT'); controller.onUpdateGreugeResponse('ACCEPT');
$httpBackend.flush(); $httpBackend.flush();

View File

@ -2,7 +2,7 @@
vn-id="watcher" vn-id="watcher"
data="$ctrl.claim" data="$ctrl.claim"
form="form" form="form"
url="/api/Claims/{{$ctrl.$stateParams.id}}/updateClaim" url="Claims/{{$ctrl.$stateParams.id}}/updateClaim"
save="post"> save="post">
</vn-watcher> </vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()" compact> <form name="form" ng-submit="$ctrl.onSubmit()" compact>
@ -26,7 +26,7 @@
vn-one vn-one
disabled="false" disabled="false"
ng-model="$ctrl.claim.workerFk" ng-model="$ctrl.claim.workerFk"
url="/api/Clients/activeWorkersWithRole" url="Clients/activeWorkersWithRole"
show-field="nickname" show-field="nickname"
search-function="{firstName: $search}" search-function="{firstName: $search}"
value-field="id" value-field="id"
@ -36,7 +36,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="$ctrl.claim.claimStateFk" ng-model="$ctrl.claim.claimStateFk"
url="/claim/api/ClaimStates" url="ClaimStates"
show-field="description" show-field="description"
value-field="id" value-field="id"
label="Claim state" label="Claim state"

View File

@ -6,9 +6,7 @@ describe('Claim', () => {
let controller; let controller;
let $scope; let $scope;
beforeEach(angular.mock.module('claim', $translateProvider => { beforeEach(ngModule('claim'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope) => { beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new(); $scope = $rootScope.$new();

View File

@ -61,7 +61,7 @@ class Controller {
getCard() { getCard() {
let json = encodeURIComponent(JSON.stringify(this.filter)); let json = encodeURIComponent(JSON.stringify(this.filter));
let query = `/claim/api/Claims/${this.$state.params.id}?filter=${json}`; let query = `Claims/${this.$state.params.id}?filter=${json}`;
this.$http.get(query).then(res => { this.$http.get(query).then(res => {
if (res.data) if (res.data)
this.claim = res.data; this.claim = res.data;

View File

@ -7,9 +7,7 @@ describe('Claim', () => {
let $httpBackend; let $httpBackend;
let $state; let $state;
beforeEach(angular.mock.module('claim', $translateProvider => { beforeEach(ngModule('claim'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
@ -21,7 +19,7 @@ describe('Claim', () => {
describe('getCard()', () => { describe('getCard()', () => {
it(`should make a query and save the data in claim`, () => { it(`should make a query and save the data in claim`, () => {
let json = encodeURIComponent(JSON.stringify(controller.filter)); let json = encodeURIComponent(JSON.stringify(controller.filter));
$httpBackend.expectGET(`/claim/api/Claims/${controller.$state.params.id}?filter=${json}`).respond({id: 1}); $httpBackend.expectGET(`Claims/${controller.$state.params.id}?filter=${json}`).respond({id: 1});
controller.getCard(); controller.getCard();
$httpBackend.flush(); $httpBackend.flush();

View File

@ -60,7 +60,7 @@ class Controller {
} }
showPickupOrder() { showPickupOrder() {
let url = `/api/report/rpt-claim-pickup-order?claimFk=${this.claim.id}`; let url = `report/rpt-claim-pickup-order?claimFk=${this.claim.id}`;
window.open(url); window.open(url);
} }
@ -70,7 +70,7 @@ class Controller {
sendPickupOrder(response) { sendPickupOrder(response) {
if (response === 'ACCEPT') { if (response === 'ACCEPT') {
this.$http.post(`/api/email/claim-pickup-order`, {claimFk: this.claim.id}).then( this.$http.post(`email/claim-pickup-order`, {claimFk: this.claim.id}).then(
() => this.vnApp.showMessage(this.$translate.instant('Notification sent!')) () => this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
); );
} }
@ -82,7 +82,7 @@ class Controller {
deleteClaim(response) { deleteClaim(response) {
if (response === 'ACCEPT') { if (response === 'ACCEPT') {
this.$http.delete(`/claim/api/Claims/${this.claim.id}`).then(() => { this.$http.delete(`Claims/${this.claim.id}`).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Claim deleted!')); this.vnApp.showSuccess(this.$translate.instant('Claim deleted!'));
this.$state.go('claim.index'); this.$state.go('claim.index');
}); });

View File

@ -4,9 +4,7 @@ describe('Item Component vnClaimDescriptor', () => {
let $httpBackend; let $httpBackend;
let controller; let controller;
beforeEach(angular.mock.module('claim', $translateProvider => { beforeEach(ngModule('claim'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
@ -16,7 +14,7 @@ describe('Item Component vnClaimDescriptor', () => {
describe('showPickupOrder()', () => { describe('showPickupOrder()', () => {
it('should open a new window showing a pickup order PDF document', () => { it('should open a new window showing a pickup order PDF document', () => {
let expectedPath = '/api/report/rpt-claim-pickup-order?claimFk=2'; let expectedPath = 'report/rpt-claim-pickup-order?claimFk=2';
spyOn(window, 'open'); spyOn(window, 'open');
controller.showPickupOrder(); controller.showPickupOrder();
@ -40,8 +38,8 @@ describe('Item Component vnClaimDescriptor', () => {
it('should make a query and call vnApp.showMessage() if the response is ACCEPT', () => { it('should make a query and call vnApp.showMessage() if the response is ACCEPT', () => {
spyOn(controller.vnApp, 'showMessage'); spyOn(controller.vnApp, 'showMessage');
$httpBackend.when('POST', `/api/email/claim-pickup-order`, {claimFk: 2}).respond(); $httpBackend.when('POST', `email/claim-pickup-order`, {claimFk: 2}).respond();
$httpBackend.expect('POST', `/api/email/claim-pickup-order`, {claimFk: 2}).respond(); $httpBackend.expect('POST', `email/claim-pickup-order`, {claimFk: 2}).respond();
controller.sendPickupOrder('ACCEPT'); controller.sendPickupOrder('ACCEPT');
$httpBackend.flush(); $httpBackend.flush();
@ -68,8 +66,8 @@ describe('Item Component vnClaimDescriptor', () => {
spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.vnApp, 'showSuccess');
spyOn(controller.$state, 'go'); spyOn(controller.$state, 'go');
$httpBackend.when('DELETE', `/claim/api/Claims/2`).respond(200); $httpBackend.when('DELETE', `Claims/2`).respond(200);
$httpBackend.expect('DELETE', `/claim/api/Claims/2`); $httpBackend.expect('DELETE', `Claims/2`);
controller.deleteClaim(response); controller.deleteClaim(response);
$httpBackend.flush(); $httpBackend.flush();

View File

@ -1,7 +1,7 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
auto-load="true" auto-load="true"
url="claim/api/ClaimBeginnings" url="ClaimBeginnings"
filter="$ctrl.filter" filter="$ctrl.filter"
data="$ctrl.salesClaimed" data="$ctrl.salesClaimed"
on-data-change="$ctrl.calculateTotals()"> on-data-change="$ctrl.calculateTotals()">

View File

@ -53,7 +53,7 @@ class Controller {
getClaimableFromTicket() { getClaimableFromTicket() {
let config = {params: {ticketFk: this.claim.ticketFk}}; let config = {params: {ticketFk: this.claim.ticketFk}};
let query = `/api/Sales/getClaimableFromTicket`; let query = `Sales/getClaimableFromTicket`;
this.$http.get(query, config).then(res => { this.$http.get(query, config).then(res => {
if (res.data) if (res.data)
this.salesToClaim = res.data; this.salesToClaim = res.data;
@ -63,7 +63,7 @@ class Controller {
addClaimedSale(index) { addClaimedSale(index) {
let sale = this.salesToClaim[index]; let sale = this.salesToClaim[index];
let saleToAdd = {saleFk: sale.saleFk, claimFk: this.claim.id, quantity: sale.quantity}; let saleToAdd = {saleFk: sale.saleFk, claimFk: this.claim.id, quantity: sale.quantity};
let query = `claim/api/ClaimBeginnings/`; let query = `ClaimBeginnings/`;
this.$http.post(query, saleToAdd).then(() => { this.$http.post(query, saleToAdd).then(() => {
this.$.addSales.hide(); this.$.addSales.hide();
this.$.model.refresh(); this.$.model.refresh();
@ -76,7 +76,7 @@ class Controller {
deleteClaimedSale(index) { deleteClaimedSale(index) {
let sale = this.salesClaimed[index]; let sale = this.salesClaimed[index];
let query = `claim/api/ClaimBeginnings/${sale.id}`; let query = `ClaimBeginnings/${sale.id}`;
this.$http.delete(query).then(() => { this.$http.delete(query).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.$.model.remove(index); this.$.model.remove(index);
@ -86,7 +86,7 @@ class Controller {
setClaimedQuantity(id, claimedQuantity) { setClaimedQuantity(id, claimedQuantity) {
let params = {id: id, quantity: claimedQuantity}; let params = {id: id, quantity: claimedQuantity};
let query = `claim/api/ClaimBeginnings/`; let query = `ClaimBeginnings/`;
this.$http.patch(query, params).then(() => { this.$http.patch(query, params).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.calculateTotals(); this.calculateTotals();
@ -129,7 +129,7 @@ class Controller {
} }
getManaSalespersonMana() { getManaSalespersonMana() {
this.$http.get(`/api/Tickets/${this.claim.ticketFk}/getSalesPersonMana`).then(res => { this.$http.get(`Tickets/${this.claim.ticketFk}/getSalesPersonMana`).then(res => {
this.mana = res.data; this.mana = res.data;
}); });
} }
@ -137,7 +137,7 @@ class Controller {
updateDiscount() { updateDiscount() {
if (this.newDiscount != this.saleClaimed.sale.discount) { if (this.newDiscount != this.saleClaimed.sale.discount) {
const params = {salesIds: [this.saleClaimed.sale.id], newDiscount: this.newDiscount}; const params = {salesIds: [this.saleClaimed.sale.id], newDiscount: this.newDiscount};
const query = `/api/Tickets/${this.saleClaimed.sale.ticketFk}/updateDiscount`; const query = `Tickets/${this.saleClaimed.sale.ticketFk}/updateDiscount`;
this.$http.post(query, params).then(() => { this.$http.post(query, params).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));

View File

@ -9,9 +9,7 @@ describe('claim', () => {
let $state; let $state;
let aclService; let aclService;
beforeEach(angular.mock.module('claim', $translateProvider => { beforeEach(ngModule('claim'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => { beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => {
$scope = $rootScope.$new(); $scope = $rootScope.$new();
@ -19,7 +17,7 @@ describe('claim', () => {
show: () => {} show: () => {}
}; };
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
$httpBackend.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({}); $httpBackend.when('GET', 'Claims/ClaimBeginnings').respond({});
$state = _$state_; $state = _$state_;
aclService = {hasAny: () => true}; aclService = {hasAny: () => true};
controller = $componentController('vnClaimDetail', {$state, aclService, $scope}); controller = $componentController('vnClaimDetail', {$state, aclService, $scope});
@ -47,7 +45,7 @@ describe('claim', () => {
describe('getClaimableFromTicket()', () => { describe('getClaimableFromTicket()', () => {
it('should make a query and set salesToClaim', () => { it('should make a query and set salesToClaim', () => {
$httpBackend.expectGET(`/api/Sales/getClaimableFromTicket?ticketFk=1`).respond(200, 1); $httpBackend.expectGET(`Sales/getClaimableFromTicket?ticketFk=1`).respond(200, 1);
controller.getClaimableFromTicket(); controller.getClaimableFromTicket();
$httpBackend.flush(); $httpBackend.flush();
@ -59,7 +57,7 @@ describe('claim', () => {
it('should make a post and call refresh, hide and showSuccess', () => { it('should make a post and call refresh, hide and showSuccess', () => {
spyOn(controller.$.addSales, 'hide'); spyOn(controller.$.addSales, 'hide');
spyOn(controller.$state, 'go'); spyOn(controller.$state, 'go');
$httpBackend.expectPOST(`claim/api/ClaimBeginnings/`).respond({}); $httpBackend.expectPOST(`ClaimBeginnings/`).respond({});
controller.addClaimedSale(1); controller.addClaimedSale(1);
$httpBackend.flush(); $httpBackend.flush();
@ -71,7 +69,7 @@ describe('claim', () => {
describe('deleteClaimedSale(index)', () => { describe('deleteClaimedSale(index)', () => {
it('should make a delete and call refresh and showSuccess', () => { it('should make a delete and call refresh and showSuccess', () => {
spyOn(controller.$.model, 'remove'); spyOn(controller.$.model, 'remove');
$httpBackend.expectDELETE(`claim/api/ClaimBeginnings/1`).respond({}); $httpBackend.expectDELETE(`ClaimBeginnings/1`).respond({});
controller.deleteClaimedSale(0); controller.deleteClaimedSale(0);
$httpBackend.flush(); $httpBackend.flush();
@ -82,7 +80,7 @@ describe('claim', () => {
describe('setClaimedQuantity(id, claimedQuantity)', () => { describe('setClaimedQuantity(id, claimedQuantity)', () => {
it('should make a patch and call refresh and showSuccess', () => { it('should make a patch and call refresh and showSuccess', () => {
spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.vnApp, 'showSuccess');
$httpBackend.expectPATCH(`claim/api/ClaimBeginnings/`).respond({}); $httpBackend.expectPATCH(`ClaimBeginnings/`).respond({});
controller.setClaimedQuantity(1, 1); controller.setClaimedQuantity(1, 1);
$httpBackend.flush(); $httpBackend.flush();
@ -115,7 +113,7 @@ describe('claim', () => {
spyOn(controller, 'clearDiscount'); spyOn(controller, 'clearDiscount');
spyOn(controller.$.model, 'refresh'); spyOn(controller.$.model, 'refresh');
$httpBackend.when('POST', '/api/Tickets/1/updateDiscount').respond({}); $httpBackend.when('POST', 'Tickets/1/updateDiscount').respond({});
controller.updateDiscount(); controller.updateDiscount();
$httpBackend.flush(); $httpBackend.flush();

View File

@ -1,6 +1,6 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="claim/api/ClaimDevelopments" url="ClaimDevelopments"
fields="['id', 'claimFk', 'claimReasonFk', 'claimResultFk', 'claimResponsibleFk', 'workerFk', 'claimRedeliveryFk']" fields="['id', 'claimFk', 'claimReasonFk', 'claimResultFk', 'claimResponsibleFk', 'workerFk', 'claimRedeliveryFk']"
link="{claimFk: $ctrl.$state.params.id}" link="{claimFk: $ctrl.$state.params.id}"
filter="$ctrl.filter" filter="$ctrl.filter"
@ -8,25 +8,25 @@
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-crud-model <vn-crud-model
url="claim/api/ClaimReasons" url="ClaimReasons"
data="claimReasons" data="claimReasons"
order="description" order="description"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-crud-model <vn-crud-model
url="claim/api/ClaimResults" url="ClaimResults"
data="claimResults" data="claimResults"
order="description" order="description"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-crud-model <vn-crud-model
url="claim/api/ClaimResponsibles" url="ClaimResponsibles"
data="claimResponsibles" data="claimResponsibles"
order="description" order="description"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-crud-model <vn-crud-model
url="claim/api/ClaimRedeliveries" url="ClaimRedeliveries"
data="claimRedeliveries" data="claimRedeliveries"
order="description" order="description"
auto-load="true"> auto-load="true">
@ -72,7 +72,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="claimDevelopment.workerFk" ng-model="claimDevelopment.workerFk"
url="/api/Clients/activeWorkersWithRole" url="Clients/activeWorkersWithRole"
show-field="nickname" show-field="nickname"
search-function="{firstName: $search}" search-function="{firstName: $search}"
value-field="id" value-field="id"

View File

@ -8,9 +8,7 @@ describe('Claim', () => {
let $scope; let $scope;
let aclService; let aclService;
beforeEach(angular.mock.module('claim', $translateProvider => { beforeEach(ngModule('claim'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope) => { beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new(); $scope = $rootScope.$new();

View File

@ -1,5 +1,5 @@
<vn-crud-model vn-id="model" auto-load="true" <vn-crud-model vn-id="model" auto-load="true"
url="/api/ClaimDms" url="ClaimDms"
link="{claimFk: $ctrl.$stateParams.id}" link="{claimFk: $ctrl.$stateParams.id}"
limit="20" limit="20"
data="$ctrl.photos"> data="$ctrl.photos">
@ -16,7 +16,7 @@
<section class="photo" ng-repeat="photo in $ctrl.photos"> <section class="photo" ng-repeat="photo in $ctrl.photos">
<section class="image vn-shadow" on-error-src <section class="image vn-shadow" on-error-src
ng-style="{'background': 'url(/api/dms/' + photo.dmsFk + '/downloadFile?access_token=' + $ctrl.accessToken + ')'}" ng-style="{'background': 'url(/api/dms/' + photo.dmsFk + '/downloadFile?access_token=' + $ctrl.accessToken + ')'}"
zoom-image="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}"> zoom-image="dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
</section> </section>
<section class="actions"> <section class="actions">
<vn-button <vn-button

View File

@ -28,7 +28,7 @@ class Controller {
deleteDms(response) { deleteDms(response) {
if (response === 'ACCEPT') { if (response === 'ACCEPT') {
const dmsFk = this.photos[this.dmsIndex].dmsFk; const dmsFk = this.photos[this.dmsIndex].dmsFk;
const query = `/api/claimDms/${dmsFk}/removeFile`; const query = `claimDms/${dmsFk}/removeFile`;
this.$http.post(query).then(() => { this.$http.post(query).then(() => {
this.$.model.remove(this.dmsIndex); this.$.model.remove(this.dmsIndex);
this.vnApp.showSuccess(this.$translate.instant('Photo deleted')); this.vnApp.showSuccess(this.$translate.instant('Photo deleted'));
@ -49,7 +49,7 @@ class Controller {
const params = {filter: { const params = {filter: {
where: {code: 'claim'} where: {code: 'claim'}
}}; }};
return this.$http.get('/api/DmsTypes/findOne', {params}).then(res => { return this.$http.get('DmsTypes/findOne', {params}).then(res => {
const dmsTypeId = res.data && res.data.id; const dmsTypeId = res.data && res.data.id;
const companyId = this.vnConfig.companyFk; const companyId = this.vnConfig.companyFk;
const warehouseId = this.vnConfig.warehouseFk; const warehouseId = this.vnConfig.warehouseFk;
@ -71,7 +71,7 @@ class Controller {
create() { create() {
const query = `/api/claims/${this.claim.id}/uploadFile`; const query = `claims/${this.claim.id}/uploadFile`;
const options = { const options = {
method: 'POST', method: 'POST',
url: query, url: query,

View File

@ -9,9 +9,7 @@ describe('Claim', () => {
let controller; let controller;
let $httpParamSerializer; let $httpParamSerializer;
beforeEach(angular.mock.module('claim', $translateProvider => { beforeEach(ngModule('claim'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
$componentController = _$componentController_; $componentController = _$componentController_;
@ -35,8 +33,8 @@ describe('Claim', () => {
controller.photos = [{dmsFk: 1}]; controller.photos = [{dmsFk: 1}];
controller.dmsIndex = dmsIndex; controller.dmsIndex = dmsIndex;
$httpBackend.when('POST', `/api/claimDms/${dmsId}/removeFile`).respond({}); $httpBackend.when('POST', `claimDms/${dmsId}/removeFile`).respond({});
$httpBackend.expect('POST', `/api/claimDms/${dmsId}/removeFile`); $httpBackend.expect('POST', `claimDms/${dmsId}/removeFile`);
controller.deleteDms('ACCEPT'); controller.deleteDms('ACCEPT');
$httpBackend.flush(); $httpBackend.flush();
@ -51,8 +49,8 @@ describe('Claim', () => {
where: {code: 'claim'} where: {code: 'claim'}
}}; }};
let serializedParams = $httpParamSerializer(params); let serializedParams = $httpParamSerializer(params);
$httpBackend.when('GET', `/api/DmsTypes/findOne?${serializedParams}`).respond({}); $httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({});
$httpBackend.expect('GET', `/api/DmsTypes/findOne?${serializedParams}`); $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`);
controller.setDefaultParams(); controller.setDefaultParams();
$httpBackend.flush(); $httpBackend.flush();
@ -70,8 +68,8 @@ describe('Claim', () => {
controller.dmsIndex = dmsIndex; controller.dmsIndex = dmsIndex;
controller.dms = {files: []}; controller.dms = {files: []};
$httpBackend.when('POST', `/api/claims/${claimId}/uploadFile`).respond({}); $httpBackend.when('POST', `claims/${claimId}/uploadFile`).respond({});
$httpBackend.expect('POST', `/api/claims/${claimId}/uploadFile`); $httpBackend.expect('POST', `claims/${claimId}/uploadFile`);
controller.create(); controller.create();
$httpBackend.flush(); $httpBackend.flush();

View File

@ -1,6 +1,6 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="/claim/api/Claims/filter" url="Claims/filter"
limit="20" limit="20"
data="claims" data="claims"
order="claimStateFk ASC, created DESC" order="claimStateFk ASC, created DESC"

View File

@ -32,7 +32,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="filter.salesPersonFk" ng-model="filter.salesPersonFk"
url="/client/api/Clients/activeWorkersWithRole" url="Clients/activeWorkersWithRole"
search-function="{firstName: $search}" search-function="{firstName: $search}"
value-field="id" value-field="id"
where="{role: 'employee'}" where="{role: 'employee'}"
@ -42,7 +42,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="filter.attenderFk" ng-model="filter.attenderFk"
url="/client/api/Clients/activeWorkersWithRole" url="Clients/activeWorkersWithRole"
search-function="{firstName: $search}" search-function="{firstName: $search}"
value-field="id" value-field="id"
where="{role: 'employee'}" where="{role: 'employee'}"
@ -54,7 +54,7 @@
<vn-autocomplete vn-one <vn-autocomplete vn-one
label="State" label="State"
ng-model="filter.claimStateFk" ng-model="filter.claimStateFk"
url="/claim/api/ClaimStates" url="ClaimStates"
show-field="description" show-field="description"
value-field="id"> value-field="id">
<tpl-item>{{description}}</tpl-item> <tpl-item>{{description}}</tpl-item>

View File

@ -1,5 +1,5 @@
<vn-crud-model vn-id="model" <vn-crud-model vn-id="model"
url="/api/ClaimDms" url="ClaimDms"
data="photos"> data="photos">
</vn-crud-model> </vn-crud-model>
<vn-card class="summary"> <vn-card class="summary">
@ -87,7 +87,7 @@
<section class="photo" ng-repeat="photo in photos"> <section class="photo" ng-repeat="photo in photos">
<section class="image" on-error-src <section class="image" on-error-src
ng-style="{'background': 'url(/api/dms/' + photo.dmsFk + '/downloadFile?access_token=' + $ctrl.accessToken + ')'}" ng-style="{'background': 'url(/api/dms/' + photo.dmsFk + '/downloadFile?access_token=' + $ctrl.accessToken + ')'}"
zoom-image="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}"> zoom-image="dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
</section> </section>
</section> </section>
</vn-horizontal> </vn-horizontal>

View File

@ -30,7 +30,7 @@ class Controller {
} }
getSummary() { getSummary() {
this.$http.get(`/claim/api/Claims/${this.claim.id}/getSummary`).then(response => { this.$http.get(`Claims/${this.claim.id}/getSummary`).then(response => {
this.summary = response.data; this.summary = response.data;
}); });
} }

View File

@ -6,9 +6,7 @@ describe('Claim', () => {
let controller; let controller;
let $httpBackend; let $httpBackend;
beforeEach(angular.mock.module('claim', $translateProvider => { beforeEach(ngModule('claim'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
@ -19,8 +17,8 @@ describe('Claim', () => {
describe('getSummary()', () => { describe('getSummary()', () => {
it('should perform a query to set summary', () => { it('should perform a query to set summary', () => {
$httpBackend.when('GET', `/claim/api/Claims/1/getSummary`).respond(200, 24); $httpBackend.when('GET', `Claims/1/getSummary`).respond(200, 24);
$httpBackend.expect('GET', `/claim/api/Claims/1/getSummary`); $httpBackend.expect('GET', `Claims/1/getSummary`);
controller.getSummary(); controller.getSummary();
$httpBackend.flush(); $httpBackend.flush();

View File

@ -1,6 +1,6 @@
<vn-watcher <vn-watcher
vn-id="watcher" vn-id="watcher"
url="/client/api/Addresses/createDefaultAddress" url="Addresses/createDefaultAddress"
id-field="id" id-field="id"
data="$ctrl.data" data="$ctrl.data"
save="post" save="post"
@ -8,7 +8,7 @@
</vn-watcher> </vn-watcher>
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="/client/api/AddressObservations" url="AddressObservations"
fields="['id', 'addressFk', 'observationTypeFk', 'description']" fields="['id', 'addressFk', 'observationTypeFk', 'description']"
link="{addressFk: $ctrl.$stateParams.addressId}" link="{addressFk: $ctrl.$stateParams.addressId}"
data="observations" data="observations"
@ -42,7 +42,7 @@
vn-one vn-one
vn-id="province" vn-id="province"
ng-model="$ctrl.address.provinceFk" ng-model="$ctrl.address.provinceFk"
url="/api/Provinces" url="Provinces"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Province"> label="Province">
@ -55,7 +55,7 @@
</vn-textfield> </vn-textfield>
<!-- <vn-autocomplete vn-id="town" vn-one <!-- <vn-autocomplete vn-id="town" vn-one
label="City" label="City"
url="/api/Towns" url="Towns"
fields="['id', 'name']" fields="['id', 'name']"
where="{provinceFk: province.selection.id}" where="{provinceFk: province.selection.id}"
show-field="name" show-field="name"
@ -63,7 +63,7 @@
ng-model="$ctrl.address.city"> ng-model="$ctrl.address.city">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="/api/Postcodes/location" url="Postcodes/location"
fields="['code', 'townFk']" fields="['code', 'townFk']"
ng-model="$ctrl.address.postalCode" ng-model="$ctrl.address.postalCode"
selection="$ctrl.postcodeSelection" selection="$ctrl.postcodeSelection"
@ -98,7 +98,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="$ctrl.address.agencyModeFk" ng-model="$ctrl.address.agencyModeFk"
url="/api/AgencyModes/isActive" url="AgencyModes/isActive"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Agency"> label="Agency">

View File

@ -7,9 +7,7 @@ describe('Client', () => {
let $componentController; let $componentController;
let $state; let $state;
beforeEach(angular.mock.module('client', $translateProvider => { beforeEach(ngModule('client'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject((_$componentController_, _$state_) => { beforeEach(angular.mock.inject((_$componentController_, _$state_) => {
$componentController = _$componentController_; $componentController = _$componentController_;

View File

@ -1,26 +1,26 @@
<mg-ajax <mg-ajax
path="/client/api/Addresses/{{edit.params.addressId}}" path="Addresses/{{edit.params.addressId}}"
actions="$ctrl.address = edit.model" actions="$ctrl.address = edit.model"
options="mgEdit"> options="mgEdit">
</mg-ajax> </mg-ajax>
<vn-watcher <vn-watcher
vn-id="watcher" vn-id="watcher"
data="$ctrl.address" data="$ctrl.address"
url="/client/api/Addresses" url="Addresses"
id-field="id" id-field="id"
form="form"> form="form">
</vn-watcher> </vn-watcher>
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="/client/api/AddressObservations" url="AddressObservations"
fields="['id', 'addressFk', 'observationTypeFk', 'description']" fields="['id', 'addressFk', 'observationTypeFk', 'description']"
link="{addressFk: $ctrl.$stateParams.addressId}" link="{addressFk: $ctrl.$stateParams.addressId}"
data="observations" data="observations"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-crud-model <vn-crud-model
url="/client/api/ObservationTypes" url="ObservationTypes"
fields="['id', 'description']" fields="['id', 'description']"
data="types" data="types"
auto-load="true"> auto-load="true">
@ -60,7 +60,7 @@
vn-one vn-one
vn-id="province" vn-id="province"
ng-model="$ctrl.address.provinceFk" ng-model="$ctrl.address.provinceFk"
url="/api/Provinces" url="Provinces"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Province"> label="Province">
@ -74,7 +74,7 @@
<!-- <!--
<vn-autocomplete vn-id="town" vn-one <vn-autocomplete vn-id="town" vn-one
label="City" label="City"
url="/api/Towns" url="Towns"
fields="['id', 'name']" fields="['id', 'name']"
where="{provinceFk: province.selection.id}" where="{provinceFk: province.selection.id}"
show-field="name" show-field="name"
@ -82,7 +82,7 @@
ng-model="$ctrl.address.city"> ng-model="$ctrl.address.city">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="/api/Postcodes/location" url="Postcodes/location"
fields="['code', 'townFk']" fields="['code', 'townFk']"
ng-model="$ctrl.address.postalCode" ng-model="$ctrl.address.postalCode"
where="{townFk: town.selection.id}" where="{townFk: town.selection.id}"
@ -113,7 +113,7 @@
<vn-autocomplete vn-one <vn-autocomplete vn-one
initial-data="$ctrl.address.agencyMode" initial-data="$ctrl.address.agencyMode"
ng-model="$ctrl.address.agencyModeFk" ng-model="$ctrl.address.agencyModeFk"
url="/client/api/AgencyModes/isActive" url="AgencyModes/isActive"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Agency"> label="Agency">

View File

@ -5,9 +5,7 @@ describe('Client', () => {
let $state; let $state;
let controller; let controller;
beforeEach(angular.mock.module('client', $translateProvider => { beforeEach(ngModule('client'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, _$state_) => { beforeEach(angular.mock.inject(($componentController, _$state_) => {
$state = _$state_; $state = _$state_;

View File

@ -1,6 +1,6 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="/api/Clients/{{$ctrl.$stateParams.id}}/addresses" url="Clients/{{$ctrl.$stateParams.id}}/addresses"
filter="$ctrl.filter" filter="$ctrl.filter"
limit="10" limit="10"
data="$ctrl.addresses" data="$ctrl.addresses"

View File

@ -45,7 +45,7 @@ class Controller {
} }
setDefault(address) { setDefault(address) {
let query = `/client/api/Clients/${this.$stateParams.id}`; let query = `Clients/${this.$stateParams.id}`;
let params = {defaultAddressFk: address.id}; let params = {defaultAddressFk: address.id};
this.$http.patch(query, params).then(res => { this.$http.patch(query, params).then(res => {
if (res.data) { if (res.data) {

View File

@ -8,9 +8,7 @@ describe('Client', () => {
let $stateParams; let $stateParams;
let $httpBackend; let $httpBackend;
beforeEach(angular.mock.module('client', $translateProvider => { beforeEach(ngModule('client'));
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => { beforeEach(angular.mock.inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => {
$stateParams = _$stateParams_; $stateParams = _$stateParams_;
@ -29,8 +27,8 @@ describe('Client', () => {
let data = {defaultAddressFk: address.id}; let data = {defaultAddressFk: address.id};
let expectedResult = {defaultAddressFk: address.id}; let expectedResult = {defaultAddressFk: address.id};
$httpBackend.when('PATCH', `/client/api/Clients/1`, data).respond(200, expectedResult); $httpBackend.when('PATCH', `Clients/1`, data).respond(200, expectedResult);
$httpBackend.expect('PATCH', `/client/api/Clients/1`, data); $httpBackend.expect('PATCH', `Clients/1`, data);
controller.setDefault(address); controller.setDefault(address);
$httpBackend.flush(); $httpBackend.flush();

View File

@ -2,7 +2,7 @@
vn-id="dialog" vn-id="dialog"
class="modal-form"> class="modal-form">
<tpl-body> <tpl-body>
<mg-ajax path="/client/api/receipts" options="vnPost"></mg-ajax> <mg-ajax path="receipts" options="vnPost"></mg-ajax>
<vn-horizontal class="header"> <vn-horizontal class="header">
<h5><span translate>New payment</span></h5> <h5><span translate>New payment</span></h5>
</vn-horizontal> </vn-horizontal>
@ -14,7 +14,7 @@
ng-model="$ctrl.receipt.payed"> ng-model="$ctrl.receipt.payed">
</vn-date-picker> </vn-date-picker>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="/api/Companies" url="Companies"
label="Company" label="Company"
show-field="code" show-field="code"
value-field="id" value-field="id"
@ -23,7 +23,7 @@
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="/api/Banks" url="Banks"
label="Bank" label="Bank"
show-field="bank" show-field="bank"
value-field="id" value-field="id"

View File

@ -62,7 +62,7 @@ class Controller {
} }
}; };
let query = `/client/api/ClientRisks?filter=${JSON.stringify(filter)}`; let query = `ClientRisks?filter=${JSON.stringify(filter)}`;
this.$http.get(query).then(res => { this.$http.get(query).then(res => {
this.receipt.amountPaid = (res.data.length && res.data[0].amount) || null; this.receipt.amountPaid = (res.data.length && res.data[0].amount) || null;
}); });
@ -77,7 +77,7 @@ class Controller {
} }
save() { save() {
let query = `/client/api/receipts`; let query = `receipts`;
this.$http.post(query, this.receipt).then(() => { this.$http.post(query, this.receipt).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.hide(); this.hide();

View File

@ -1,6 +1,6 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="/client/api/receipts/filter" url="receipts/filter"
params="$ctrl.params" params="$ctrl.params"
limit="20" limit="20"
data="$ctrl.balances" data="$ctrl.balances"
@ -8,7 +8,7 @@
</vn-crud-model> </vn-crud-model>
<vn-crud-model <vn-crud-model
vn-id="riskModel" vn-id="riskModel"
url="/client/api/ClientRisks" url="ClientRisks"
filter="$ctrl.filter" filter="$ctrl.filter"
data="$ctrl.clientRisks"> data="$ctrl.clientRisks">
</vn-crud-model> </vn-crud-model>
@ -23,7 +23,7 @@
class="dense" class="dense"
ng-model="$ctrl.companyFk" ng-model="$ctrl.companyFk"
on-change="$ctrl.setOrder(value)" on-change="$ctrl.setOrder(value)"
url="/client/api/Companies" url="Companies"
show-field="code" show-field="code"
value-field="id" value-field="id"
label="Company"> label="Company">
@ -100,7 +100,7 @@
<vn-td center shrink> <vn-td center shrink>
<a ng-show="balance.hasPdf" <a ng-show="balance.hasPdf"
target="_blank" target="_blank"
href="api/InvoiceOuts/{{::balance.id}}/download?access_token={{::$ctrl.accessToken}}"> href="InvoiceOuts/{{::balance.id}}/download?access_token={{::$ctrl.accessToken}}">
<vn-icon-button <vn-icon-button
icon="cloud_download" icon="cloud_download"
title="{{'Download PDF' | translate}}"> title="{{'Download PDF' | translate}}">

View File

@ -56,7 +56,7 @@ class Controller {
if (!value) return; if (!value) return;
const params = {filter: this.filter}; const params = {filter: this.filter};
this.$http.get(`/client/api/ClientRisks`, {params}).then(response => { this.$http.get(`ClientRisks`, {params}).then(response => {
if (response.data) { if (response.data) {
this.clientRisks = response.data; this.clientRisks = response.data;

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