API path prefix, repeated code removed from tests
This commit is contained in:
parent
ee196df2ff
commit
c7384bb3ac
|
@ -3,9 +3,7 @@ describe('Component vnAutocomplete', () => {
|
|||
let controller;
|
||||
let data = {id: 1, name: 'Bruce Wayne'};
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-autocomplete></vn-autocomplete>`)($rootScope);
|
||||
|
|
|
@ -2,9 +2,7 @@ describe('Component vnButtonMenu', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-icon-menu></vn-icon-menu>`)($rootScope);
|
||||
|
|
|
@ -6,9 +6,7 @@ describe('Component vnCalendar', () => {
|
|||
date.setHours(0, 0, 0, 0);
|
||||
date.setDate(1);
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-calendar></vn-calendar`)($rootScope);
|
||||
|
|
|
@ -3,9 +3,7 @@ describe('Component vnCheck', () => {
|
|||
let $ctrl;
|
||||
let element;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-check></vn-check>`)($rootScope);
|
||||
|
|
|
@ -6,9 +6,7 @@ describe('Component vnChip', () => {
|
|||
let $scope;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -3,9 +3,7 @@ describe('Component vnDatePicker', () => {
|
|||
let $element;
|
||||
let $ctrl;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
|
||||
$filter = _$filter_;
|
||||
|
|
|
@ -2,9 +2,7 @@ describe('Component vnDialog', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
$element = angular.element('<vn-dialog></vn-dialog>');
|
||||
|
|
|
@ -2,9 +2,7 @@ describe('Component vnDropDown', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope, $document) => {
|
||||
$element = $compile(`<vn-drop-down></vn-drop-down>`)($rootScope);
|
||||
|
|
|
@ -7,9 +7,7 @@ describe('Component vnInputFile', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Component vnInputNumber', () => {
|
|||
let $element;
|
||||
let $ctrl;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-input-number></vn-input-number>`)($rootScope);
|
||||
|
|
|
@ -5,9 +5,7 @@ describe('Component vnInputTime', () => {
|
|||
let $element;
|
||||
let $ctrl;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
|
||||
$filter = _$filter_;
|
||||
|
|
|
@ -5,9 +5,7 @@ describe('Component vnInputTime', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
const $attrs = {};
|
||||
|
|
|
@ -5,9 +5,7 @@ describe('Component vnMultiCheck', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
$element = angular.element(`<div class="shown"></div>`);
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Component vnPopover', () => {
|
|||
let $parent;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope, $document) => {
|
||||
$element = $compile(`<vn-popover>test</vn-popover>`)($rootScope);
|
||||
|
|
|
@ -3,9 +3,7 @@ describe('Component vnRadio', () => {
|
|||
let $ctrl;
|
||||
let element;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-radio val="myVal"></vn-radio`)($rootScope);
|
||||
|
|
|
@ -6,9 +6,7 @@ describe('Component vnSearchbar', () => {
|
|||
let $state;
|
||||
let $scope;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_, $rootScope, $compile) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Component vnSpinner', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-spinner></vn-spinner>`)($rootScope);
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Component vnStepControl', () => {
|
|||
let controller;
|
||||
let $state;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_) => {
|
||||
$state = _$state_;
|
||||
|
|
|
@ -5,9 +5,7 @@ describe('Component vnTable', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Component vnTextarea', () => {
|
|||
let $element;
|
||||
let $ctrl;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-textarea></vn-textarea>`)($rootScope);
|
||||
|
|
|
@ -5,9 +5,7 @@ describe('Component vnTh', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
$element = angular.element(`<div>${template}</div>`);
|
||||
|
|
|
@ -8,9 +8,7 @@ xdescribe('Component vnTooltip', () => {
|
|||
let element;
|
||||
let window;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(($componentController, $compile, $templateRequest, $document) => {
|
||||
$element = angular.element(`<vn-tooltip class="text">test</span></vn-tooltip>`);
|
||||
|
|
|
@ -2,9 +2,7 @@ describe('Component vnTreeview', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-treeview></vn-treeview>`)($rootScope);
|
||||
|
|
|
@ -10,9 +10,7 @@ describe('Component vnWatcher', () => {
|
|||
let $attrs;
|
||||
let $q;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -4,12 +4,10 @@ describe('Directive acl', () => {
|
|||
let element;
|
||||
let compile;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(($httpBackend, aclService) => {
|
||||
$httpBackend.whenGET('/api/Accounts/acl')
|
||||
$httpBackend.whenGET('Accounts/acl')
|
||||
.respond({
|
||||
user: {id: 1, name: 'myUser'},
|
||||
roles: [
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
describe('Directive bind', () => {
|
||||
let compile;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
compile = html => {
|
||||
inject(($compile, $rootScope) => {
|
||||
|
|
|
@ -5,9 +5,7 @@ describe('Directive dialog', () => {
|
|||
let compile;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
compile = _element => {
|
||||
inject(($compile, $rootScope) => {
|
||||
|
|
|
@ -3,9 +3,7 @@ describe('Directive focus', () => {
|
|||
let $element;
|
||||
let compile;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
compile = (_element, _childElement) => {
|
||||
inject(($compile, $rootScope) => {
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Directive vnId', () => {
|
|||
let $element;
|
||||
let compile;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
compile = _element => {
|
||||
inject(($compile, $rootScope) => {
|
||||
|
|
|
@ -3,9 +3,7 @@ describe('Directive rule', () => {
|
|||
let $element;
|
||||
let element;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
function compile(html, value) {
|
||||
inject(($compile, $rootScope, $window) => {
|
||||
|
|
|
@ -5,9 +5,7 @@ describe('Directive zoomImage', () => {
|
|||
let srcZoom = 'http://zoom.img.jpg/';
|
||||
let findContainer;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope) => {
|
||||
compile = $compile;
|
||||
|
|
|
@ -23,7 +23,7 @@ export function directive($http, $compile, vnApp, $translate) {
|
|||
}
|
||||
|
||||
function getTableConfig(tableCode) {
|
||||
return $http.get(`/api/UserConfigViews/getConfig?tableCode=${tableCode}`);
|
||||
return $http.get(`UserConfigViews/getConfig?tableCode=${tableCode}`);
|
||||
}
|
||||
|
||||
function createViewConfig(config, fields) {
|
||||
|
@ -73,7 +73,7 @@ export function directive($http, $compile, vnApp, $translate) {
|
|||
|
||||
function saveConfiguration(tableConfiguration) {
|
||||
tableConfiguration.configuration = JSON.parse(JSON.stringify(tableConfiguration.configuration));
|
||||
return $http.post(`/api/UserConfigViews/save`, tableConfiguration);
|
||||
return $http.post(`UserConfigViews/save`, tableConfiguration);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -2,9 +2,7 @@ describe('Currency filter', () => {
|
|||
let compile;
|
||||
let $element;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
compile = html => {
|
||||
inject(($compile, $rootScope) => {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
describe('Service acl', () => {
|
||||
let aclService;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject((_aclService_, $httpBackend) => {
|
||||
$httpBackend.when('GET', `/api/Accounts/acl`).respond({
|
||||
$httpBackend.when('GET', `Accounts/acl`).respond({
|
||||
roles: [
|
||||
{role: {name: 'foo'}},
|
||||
{role: {name: 'bar'}},
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
describe('factory vnModuleLoader', () => {
|
||||
let vnModuleLoader;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject((_vnModuleLoader_, $rootScope, $window) => {
|
||||
vnModuleLoader = _vnModuleLoader_;
|
||||
|
|
|
@ -3,9 +3,7 @@ import {validate} from '../validator.js';
|
|||
describe('Validator', () => {
|
||||
let $translate;
|
||||
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(_$translate_ => {
|
||||
$translate = _$translate_;
|
||||
|
|
|
@ -9,8 +9,8 @@ export default ngModule;
|
|||
* to the component controller class with the merged component options. To
|
||||
* 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
|
||||
* same function. If any of the options (template, transclude, bindings ...) is
|
||||
* redeclared in the child component, it has preference.
|
||||
* same function. If any of the options (template, transclude, bindings...) is
|
||||
* redeclared in the child component, the last has preference.
|
||||
*
|
||||
* @param {String} name Coponent name in camelCase
|
||||
* @param {Object} options The component options
|
||||
|
@ -32,6 +32,10 @@ ngModule.vnComponent = function(name, options) {
|
|||
bindings: Object.assign({},
|
||||
parentOptions.bindings,
|
||||
options.bindings
|
||||
),
|
||||
require: Object.assign({},
|
||||
parentOptions.require,
|
||||
options.require
|
||||
)
|
||||
}
|
||||
);
|
||||
|
|
|
@ -11,7 +11,7 @@ class AclService {
|
|||
}
|
||||
|
||||
load() {
|
||||
return this.$http.get('/api/Accounts/acl').then(res => {
|
||||
return this.$http.get('Accounts/acl').then(res => {
|
||||
this.user = res.data.user;
|
||||
this.roles = {};
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ export default class Auth {
|
|||
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));
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ export default class Auth {
|
|||
}
|
||||
|
||||
logout() {
|
||||
let promise = this.$http.post('/api/Accounts/logout', null, {
|
||||
let promise = this.$http.post('Accounts/logout', null, {
|
||||
headers: {Authorization: this.vnToken.token}
|
||||
}).catch(() => {});
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ export default class Config {
|
|||
for (let param of this.params)
|
||||
this.local[param] = this.getItem(param);
|
||||
|
||||
return this.$http.get('api/UserConfigs/getUserConfig')
|
||||
return this.$http.get('UserConfigs/getUserConfig')
|
||||
.then(res => {
|
||||
for (let param of this.params)
|
||||
this.user[param] = res.data[param];
|
||||
|
@ -47,7 +47,7 @@ export default class Config {
|
|||
this.mergeParams();
|
||||
|
||||
let params = {[param]: value};
|
||||
return this.$http.post('api/UserConfigs/setUserConfig', params)
|
||||
return this.$http.post('UserConfigs/setUserConfig', params)
|
||||
.then(() => this.showSaved());
|
||||
}
|
||||
|
||||
|
|
|
@ -3,10 +3,17 @@ import HttpError from 'core/lib/http-error';
|
|||
|
||||
interceptor.$inject = ['$q', 'vnApp', 'vnToken', '$translate'];
|
||||
function interceptor($q, vnApp, vnToken, $translate) {
|
||||
let apiPath = 'api/';
|
||||
|
||||
return {
|
||||
request: function(config) {
|
||||
setApiPath(path) {
|
||||
apiPath = path;
|
||||
},
|
||||
request(config) {
|
||||
vnApp.pushLoader();
|
||||
|
||||
if (config.url.charAt(0) !== '/' && apiPath)
|
||||
config.url = `${apiPath}/${config.url}`;
|
||||
if (vnToken.token)
|
||||
config.headers.Authorization = vnToken.token;
|
||||
if ($translate.use())
|
||||
|
@ -14,14 +21,14 @@ function interceptor($q, vnApp, vnToken, $translate) {
|
|||
|
||||
return config;
|
||||
},
|
||||
requestError: function(rejection) {
|
||||
requestError(rejection) {
|
||||
return $q.reject(rejection);
|
||||
},
|
||||
response: function(response) {
|
||||
response(response) {
|
||||
vnApp.popLoader();
|
||||
return response;
|
||||
},
|
||||
responseError: function(rejection) {
|
||||
responseError(rejection) {
|
||||
vnApp.popLoader();
|
||||
let err = new HttpError(rejection.statusText);
|
||||
Object.assign(err, rejection);
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Component vnLeftMenu', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(angular.mock.module('salix', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('salix'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $state, $window) => {
|
||||
$element = angular.element('<div></div>');
|
||||
|
|
|
@ -16,7 +16,7 @@ export default class MainMenu {
|
|||
}
|
||||
|
||||
getCurrentUserName() {
|
||||
this.$http.get('/api/Accounts/getCurrentUserData').then(json => {
|
||||
this.$http.get('Accounts/getCurrentUserData').then(json => {
|
||||
this.$.$root.user = json.data;
|
||||
window.localStorage.currentUserWorkerId = json.data.workerId;
|
||||
});
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Component vnMainMenu', () => {
|
|||
let $httpBackend;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('salix', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('salix'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
||||
let vnModules = {get: () => {}};
|
||||
|
@ -16,8 +14,8 @@ describe('Component vnMainMenu', () => {
|
|||
|
||||
describe('getCurrentUserName()', () => {
|
||||
it(`should set the user name property in the controller`, () => {
|
||||
$httpBackend.when('GET', `/api/Accounts/getCurrentUserData`).respond({name: 'batman'});
|
||||
$httpBackend.expect('GET', `/api/Accounts/getCurrentUserData`);
|
||||
$httpBackend.when('GET', `Accounts/getCurrentUserData`).respond({name: 'batman'});
|
||||
$httpBackend.expect('GET', `Accounts/getCurrentUserData`);
|
||||
controller.getCurrentUserName();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<vn-crud-model
|
||||
url="/api/Warehouses"
|
||||
url="Warehouses"
|
||||
vn-id="warehouses"
|
||||
data="warehousesData"
|
||||
order="name">
|
||||
</vn-crud-model>
|
||||
<vn-crud-model
|
||||
url="/api/Companies"
|
||||
url="Companies"
|
||||
vn-id="companies"
|
||||
data="companiesData"
|
||||
order="code">
|
||||
|
@ -41,7 +41,7 @@
|
|||
label="Local bank"
|
||||
id="localBank"
|
||||
ng-model="$ctrl.localBankFk"
|
||||
url="/api/Banks"
|
||||
url="Banks"
|
||||
select-fields="['id','bank']"
|
||||
show-field="bank"
|
||||
order="id"
|
||||
|
|
|
@ -5,12 +5,10 @@ describe('Salix', () => {
|
|||
let controller;
|
||||
let $scope;
|
||||
|
||||
beforeEach(angular.mock.module('salix', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('salix'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, $httpBackend) => {
|
||||
$httpBackend.expectGET('api/UserConfigs/getUserConfig');
|
||||
$httpBackend.expectGET('UserConfigs/getUserConfig');
|
||||
|
||||
$scope = $rootScope.$new();
|
||||
controller = $componentController('vnUserPopover', {$scope});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'angular';
|
||||
import 'angular-mocks';
|
||||
import './front/core/module.js';
|
||||
import core from './front/core/module.js';
|
||||
import './front/salix/components/app/app.js';
|
||||
import './modules/agency/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/travel/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');
|
||||
});
|
||||
};
|
||||
|
|
|
@ -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-id="watcher"
|
||||
data="$ctrl.zone"
|
||||
|
@ -22,7 +22,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.zone.agencyModeFk"
|
||||
url="/agency/api/AgencyModes"
|
||||
url="AgencyModes"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Agency"
|
||||
|
|
|
@ -18,7 +18,7 @@ class Controller {
|
|||
}
|
||||
};
|
||||
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 => {
|
||||
if (res.data)
|
||||
this.zone = res.data;
|
||||
|
|
|
@ -6,9 +6,7 @@ describe('Agency Component vnZoneCard', () => {
|
|||
let $httpBackend;
|
||||
let $stateParams;
|
||||
|
||||
beforeEach(angular.mock.module('agency', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('agency'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
|
@ -26,7 +24,7 @@ describe('Agency Component vnZoneCard', () => {
|
|||
}
|
||||
};
|
||||
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();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -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-id="watcher"
|
||||
data="$ctrl.zone"
|
||||
|
@ -21,7 +21,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.zone.warehouseFk"
|
||||
url="/agency/api/Warehouses"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Warehouse"
|
||||
|
@ -30,7 +30,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.zone.agencyModeFk"
|
||||
url="/agency/api/AgencyModes/isActive"
|
||||
url="AgencyModes/isActive"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Agency"
|
||||
|
|
|
@ -6,9 +6,7 @@ describe('Agency Component vnZoneCreate', () => {
|
|||
let $state;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('agency', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('agency'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
vn-one
|
||||
label="Agency"
|
||||
ng-model="$ctrl.params.agencyModeFk"
|
||||
url="/api/AgencyModes/isActive">
|
||||
url="AgencyModes/isActive">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
@ -14,7 +14,7 @@
|
|||
vn-one
|
||||
label="Province"
|
||||
ng-model="$ctrl.params.provinceFk"
|
||||
url="/api/Provinces"
|
||||
url="Provinces"
|
||||
fields="['countryFk']"
|
||||
include="'country'"
|
||||
style="margin-right: .5em;">
|
||||
|
|
|
@ -10,7 +10,7 @@ class Controller {
|
|||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$http.get(`/api/Zones/getEvents`, {params: this.params})
|
||||
this.$http.get(`Zones/getEvents`, {params: this.params})
|
||||
.then(res => this.$.data = res.data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class Controller {
|
|||
|
||||
returnDialog(response) {
|
||||
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');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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-id="watcher"
|
||||
data="$ctrl.zone"
|
||||
|
@ -22,7 +22,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.zone.warehouseFk"
|
||||
url="/agency/api/Warehouses"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Warehouse"
|
||||
|
@ -31,7 +31,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.zone.agencyModeFk"
|
||||
url="/agency/api/AgencyModes/isActive"
|
||||
url="AgencyModes/isActive"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Agency"
|
||||
|
|
|
@ -7,8 +7,8 @@ class Controller extends Component {
|
|||
this.vnWeekDays = vnWeekDays;
|
||||
this.editMode = 'include';
|
||||
|
||||
this.path = `api/Zones/${this.$params.id}/events`;
|
||||
this.exclusionsPath = `api/Zones/${this.$params.id}/exclusions`;
|
||||
this.path = `Zones/${this.$params.id}/events`;
|
||||
this.exclusionsPath = `Zones/${this.$params.id}/exclusions`;
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="/api/Zones"
|
||||
url="Zones"
|
||||
filter="::$ctrl.filter"
|
||||
limit="20"
|
||||
data="zones"
|
||||
|
|
|
@ -43,7 +43,7 @@ export default class Controller {
|
|||
*/
|
||||
onCloneAccept(response) {
|
||||
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 => {
|
||||
if (res && res.data)
|
||||
this.$state.go('zone.card.basicData', {id: res.data.id});
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Agency Component vnZoneIndex', () => {
|
|||
let $componentController;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('agency', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('agency'));
|
||||
|
||||
beforeEach(angular.mock.inject(_$componentController_ => {
|
||||
$componentController = _$componentController_;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
vn-one
|
||||
label="Agency"
|
||||
ng-model="filter.agencyModeFk"
|
||||
url="/agency/api/AgencyModes/isActive"
|
||||
url="AgencyModes/isActive"
|
||||
show-field="name"
|
||||
value-field="id">
|
||||
</vn-autocomplete>
|
||||
|
@ -28,7 +28,7 @@
|
|||
vn-one
|
||||
label="Warehouse"
|
||||
ng-model="filter.warehouseFk"
|
||||
url="/agency/api/Warehouses"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id">
|
||||
</vn-autocomplete>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="/api/Zones/{{$ctrl.$params.id}}/getLeaves"
|
||||
url="Zones/{{$ctrl.$params.id}}/getLeaves"
|
||||
filter="::$ctrl.filter">
|
||||
</vn-crud-model>
|
||||
<div class="vn-w-md">
|
||||
|
|
|
@ -40,7 +40,7 @@ class Controller extends Component {
|
|||
if (value == null)
|
||||
value = undefined;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
vn-one
|
||||
label="Agency"
|
||||
ng-model="filter.agencyModeFk"
|
||||
url="/api/AgencyModes/isActive"
|
||||
url="AgencyModes/isActive"
|
||||
show-field="name"
|
||||
value-field="id">
|
||||
</vn-autocomplete>
|
||||
|
|
|
@ -23,7 +23,7 @@ class Controller {
|
|||
where: {id: this.zone.id}
|
||||
};
|
||||
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)
|
||||
this.summary = res.data;
|
||||
});
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<vn-vertical>
|
||||
<vn-autocomplete
|
||||
ng-model="$ctrl.selected.warehouseFk"
|
||||
url="/api/Warehouses"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Warehouse">
|
||||
|
|
|
@ -5,7 +5,7 @@ class Controller extends Component {
|
|||
constructor($element, $) {
|
||||
super($element, $);
|
||||
|
||||
this.path = `/api/Zones/${this.$params.id}/warehouses`;
|
||||
this.path = `Zones/${this.$params.id}/warehouses`;
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<vn-crud-model vn-id="model" auto-load="true" auto-save="true"
|
||||
url="claim/api/ClaimEnds"
|
||||
url="ClaimEnds"
|
||||
filter="$ctrl.filter"
|
||||
data="$ctrl.salesClaimed">
|
||||
</vn-crud-model>
|
||||
|
||||
<vn-crud-model auto-load="true"
|
||||
url="/claim/api/ClaimDestinations"
|
||||
url="ClaimDestinations"
|
||||
data="claimDestinations">
|
||||
</vn-crud-model>
|
||||
|
||||
|
@ -161,7 +161,7 @@
|
|||
</vn-dialog>
|
||||
<vn-crud-model
|
||||
vn-id="lastTicketsModel"
|
||||
url="/claim/api/Tickets"
|
||||
url="Tickets"
|
||||
limit="20"
|
||||
data="lastTickets" auto-load="false">
|
||||
</vn-crud-model>
|
||||
|
|
|
@ -35,7 +35,7 @@ class Controller {
|
|||
getClaimedSales() {
|
||||
let json = encodeURIComponent(JSON.stringify(this.claim.id));
|
||||
|
||||
let query = `/claim/api/ClaimBeginnings/${json}`;
|
||||
let query = `ClaimBeginnings/${json}`;
|
||||
this.$http.get(query).then(res => {
|
||||
if (res.data)
|
||||
this.claimedSales = res.data;
|
||||
|
@ -44,7 +44,7 @@ class Controller {
|
|||
|
||||
addClaimedSale(saleFk) {
|
||||
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.$.model.refresh();
|
||||
this.$.addSales.hide();
|
||||
|
@ -54,7 +54,7 @@ class Controller {
|
|||
|
||||
deleteClaimedSale(id) {
|
||||
let json = encodeURIComponent(JSON.stringify(id));
|
||||
let query = `claim/api/ClaimEnds/${json}`;
|
||||
let query = `ClaimEnds/${json}`;
|
||||
this.$http.delete(query).then(() => {
|
||||
this.$.model.refresh();
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
|
@ -62,7 +62,7 @@ class Controller {
|
|||
}
|
||||
|
||||
importToNewRefundTicket() {
|
||||
let query = `claim/api/ClaimBeginnings/${this.$stateParams.id}/importToNewRefundTicket`;
|
||||
let query = `ClaimBeginnings/${this.$stateParams.id}/importToNewRefundTicket`;
|
||||
return this.$http.post(query).then(() => {
|
||||
this.$.model.refresh();
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
|
@ -113,7 +113,7 @@ class Controller {
|
|||
importTicketLines(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.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.$.lastTicketsPopover.hide();
|
||||
|
@ -123,7 +123,7 @@ class Controller {
|
|||
|
||||
regularize() {
|
||||
let data = {claimFk: this.$stateParams.id};
|
||||
let query = `/claim/api/Claims/regularizeClaim`;
|
||||
let query = `Claims/regularizeClaim`;
|
||||
return this.$http.post(query, data).then(() => {
|
||||
this.card.reload();
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
|
@ -136,7 +136,7 @@ class Controller {
|
|||
if (response !== 'ACCEPT')
|
||||
return;
|
||||
let greugeTypeFreight = 7;
|
||||
let query = `claim/api/Greuges/`;
|
||||
let query = `Greuges/`;
|
||||
let data = {
|
||||
clientFk: this.claim.clientFk,
|
||||
description: `claim: ${this.claim.id}`,
|
||||
|
@ -158,14 +158,14 @@ class Controller {
|
|||
}
|
||||
|
||||
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.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
});
|
||||
}
|
||||
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.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
|
|
|
@ -7,9 +7,7 @@ describe('claim', () => {
|
|||
let $httpBackend;
|
||||
let $state;
|
||||
|
||||
beforeEach(angular.mock.module('claim', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
|
@ -46,7 +44,7 @@ describe('claim', () => {
|
|||
describe('getClaimedSales()', () => {
|
||||
it('should make a query and set salesToClaim', () => {
|
||||
controller.claim.id = 1;
|
||||
$httpBackend.expectGET(`/claim/api/ClaimBeginnings/1`).respond(200, 1);
|
||||
$httpBackend.expectGET(`ClaimBeginnings/1`).respond(200, 1);
|
||||
controller.getClaimedSales();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -59,7 +57,7 @@ describe('claim', () => {
|
|||
spyOn(controller.$.model, 'refresh');
|
||||
spyOn(controller.$.addSales, 'hide');
|
||||
spyOn(controller.vnApp, 'showSuccess');
|
||||
$httpBackend.expectPOST(`claim/api/ClaimEnds/`).respond({});
|
||||
$httpBackend.expectPOST(`ClaimEnds/`).respond({});
|
||||
controller.addClaimedSale(1);
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -73,7 +71,7 @@ describe('claim', () => {
|
|||
it('should make a delete and call refresh and showSuccess', () => {
|
||||
spyOn(controller.$.model, 'refresh');
|
||||
spyOn(controller.vnApp, 'showSuccess');
|
||||
$httpBackend.expectDELETE(`claim/api/ClaimEnds/1`).respond({});
|
||||
$httpBackend.expectDELETE(`ClaimEnds/1`).respond({});
|
||||
controller.deleteClaimedSale(1);
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -99,7 +97,7 @@ describe('claim', () => {
|
|||
it('should perform a post query and add lines from a new ticket', () => {
|
||||
spyOn(controller.$.model, 'refresh');
|
||||
spyOn(controller.vnApp, 'showSuccess');
|
||||
$httpBackend.expect('POST', `claim/api/ClaimBeginnings/1/importToNewRefundTicket`).respond({});
|
||||
$httpBackend.expect('POST', `ClaimBeginnings/1/importToNewRefundTicket`).respond({});
|
||||
controller.importToNewRefundTicket();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -125,7 +123,7 @@ describe('claim', () => {
|
|||
spyOn(controller.vnApp, 'showSuccess');
|
||||
spyOn(controller.$.lastTicketsPopover, 'hide');
|
||||
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);
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -141,7 +139,7 @@ describe('claim', () => {
|
|||
spyOn(controller.vnApp, 'showSuccess');
|
||||
|
||||
let data = {claimFk: $state.params.id};
|
||||
$httpBackend.expect('POST', `/claim/api/Claims/regularizeClaim`, data).respond({});
|
||||
$httpBackend.expect('POST', `Claims/regularizeClaim`, data).respond({});
|
||||
controller.regularize();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -175,7 +173,7 @@ describe('claim', () => {
|
|||
greugeTypeFk: 7,
|
||||
ticketFk: controller.claim.ticketFk
|
||||
};
|
||||
$httpBackend.expect('POST', `claim/api/Greuges/`, data).respond();
|
||||
$httpBackend.expect('POST', `Greuges/`, data).respond();
|
||||
controller.onUpdateGreugeResponse('ACCEPT');
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
vn-id="watcher"
|
||||
data="$ctrl.claim"
|
||||
form="form"
|
||||
url="/api/Claims/{{$ctrl.$stateParams.id}}/updateClaim"
|
||||
url="Claims/{{$ctrl.$stateParams.id}}/updateClaim"
|
||||
save="post">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" compact>
|
||||
|
@ -26,7 +26,7 @@
|
|||
vn-one
|
||||
disabled="false"
|
||||
ng-model="$ctrl.claim.workerFk"
|
||||
url="/api/Clients/activeWorkersWithRole"
|
||||
url="Clients/activeWorkersWithRole"
|
||||
show-field="nickname"
|
||||
search-function="{firstName: $search}"
|
||||
value-field="id"
|
||||
|
@ -36,7 +36,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.claim.claimStateFk"
|
||||
url="/claim/api/ClaimStates"
|
||||
url="ClaimStates"
|
||||
show-field="description"
|
||||
value-field="id"
|
||||
label="Claim state"
|
||||
|
|
|
@ -6,9 +6,7 @@ describe('Claim', () => {
|
|||
let controller;
|
||||
let $scope;
|
||||
|
||||
beforeEach(angular.mock.module('claim', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -61,7 +61,7 @@ class Controller {
|
|||
|
||||
getCard() {
|
||||
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 => {
|
||||
if (res.data)
|
||||
this.claim = res.data;
|
||||
|
|
|
@ -7,9 +7,7 @@ describe('Claim', () => {
|
|||
let $httpBackend;
|
||||
let $state;
|
||||
|
||||
beforeEach(angular.mock.module('claim', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
|
@ -21,7 +19,7 @@ describe('Claim', () => {
|
|||
describe('getCard()', () => {
|
||||
it(`should make a query and save the data in claim`, () => {
|
||||
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();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class Controller {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Controller {
|
|||
|
||||
sendPickupOrder(response) {
|
||||
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!'))
|
||||
);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class Controller {
|
|||
|
||||
deleteClaim(response) {
|
||||
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.$state.go('claim.index');
|
||||
});
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Item Component vnClaimDescriptor', () => {
|
|||
let $httpBackend;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('claim', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
|
@ -16,7 +14,7 @@ describe('Item Component vnClaimDescriptor', () => {
|
|||
|
||||
describe('showPickupOrder()', () => {
|
||||
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');
|
||||
controller.showPickupOrder();
|
||||
|
||||
|
@ -40,8 +38,8 @@ describe('Item Component vnClaimDescriptor', () => {
|
|||
it('should make a query and call vnApp.showMessage() if the response is ACCEPT', () => {
|
||||
spyOn(controller.vnApp, 'showMessage');
|
||||
|
||||
$httpBackend.when('POST', `/api/email/claim-pickup-order`, {claimFk: 2}).respond();
|
||||
$httpBackend.expect('POST', `/api/email/claim-pickup-order`, {claimFk: 2}).respond();
|
||||
$httpBackend.when('POST', `email/claim-pickup-order`, {claimFk: 2}).respond();
|
||||
$httpBackend.expect('POST', `email/claim-pickup-order`, {claimFk: 2}).respond();
|
||||
controller.sendPickupOrder('ACCEPT');
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -68,8 +66,8 @@ describe('Item Component vnClaimDescriptor', () => {
|
|||
|
||||
spyOn(controller.vnApp, 'showSuccess');
|
||||
spyOn(controller.$state, 'go');
|
||||
$httpBackend.when('DELETE', `/claim/api/Claims/2`).respond(200);
|
||||
$httpBackend.expect('DELETE', `/claim/api/Claims/2`);
|
||||
$httpBackend.when('DELETE', `Claims/2`).respond(200);
|
||||
$httpBackend.expect('DELETE', `Claims/2`);
|
||||
controller.deleteClaim(response);
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
auto-load="true"
|
||||
url="claim/api/ClaimBeginnings"
|
||||
url="ClaimBeginnings"
|
||||
filter="$ctrl.filter"
|
||||
data="$ctrl.salesClaimed"
|
||||
on-data-change="$ctrl.calculateTotals()">
|
||||
|
|
|
@ -53,7 +53,7 @@ class Controller {
|
|||
|
||||
getClaimableFromTicket() {
|
||||
let config = {params: {ticketFk: this.claim.ticketFk}};
|
||||
let query = `/api/Sales/getClaimableFromTicket`;
|
||||
let query = `Sales/getClaimableFromTicket`;
|
||||
this.$http.get(query, config).then(res => {
|
||||
if (res.data)
|
||||
this.salesToClaim = res.data;
|
||||
|
@ -63,7 +63,7 @@ class Controller {
|
|||
addClaimedSale(index) {
|
||||
let sale = this.salesToClaim[index];
|
||||
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.$.addSales.hide();
|
||||
this.$.model.refresh();
|
||||
|
@ -76,7 +76,7 @@ class Controller {
|
|||
|
||||
deleteClaimedSale(index) {
|
||||
let sale = this.salesClaimed[index];
|
||||
let query = `claim/api/ClaimBeginnings/${sale.id}`;
|
||||
let query = `ClaimBeginnings/${sale.id}`;
|
||||
this.$http.delete(query).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.$.model.remove(index);
|
||||
|
@ -86,7 +86,7 @@ class Controller {
|
|||
|
||||
setClaimedQuantity(id, claimedQuantity) {
|
||||
let params = {id: id, quantity: claimedQuantity};
|
||||
let query = `claim/api/ClaimBeginnings/`;
|
||||
let query = `ClaimBeginnings/`;
|
||||
this.$http.patch(query, params).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.calculateTotals();
|
||||
|
@ -129,7 +129,7 @@ class Controller {
|
|||
}
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class Controller {
|
|||
updateDiscount() {
|
||||
if (this.newDiscount != this.saleClaimed.sale.discount) {
|
||||
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.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
|
|
|
@ -9,9 +9,7 @@ describe('claim', () => {
|
|||
let $state;
|
||||
let aclService;
|
||||
|
||||
beforeEach(angular.mock.module('claim', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
@ -19,7 +17,7 @@ describe('claim', () => {
|
|||
show: () => {}
|
||||
};
|
||||
$httpBackend = _$httpBackend_;
|
||||
$httpBackend.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({});
|
||||
$httpBackend.when('GET', 'Claims/ClaimBeginnings').respond({});
|
||||
$state = _$state_;
|
||||
aclService = {hasAny: () => true};
|
||||
controller = $componentController('vnClaimDetail', {$state, aclService, $scope});
|
||||
|
@ -47,7 +45,7 @@ describe('claim', () => {
|
|||
|
||||
describe('getClaimableFromTicket()', () => {
|
||||
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();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -59,7 +57,7 @@ describe('claim', () => {
|
|||
it('should make a post and call refresh, hide and showSuccess', () => {
|
||||
spyOn(controller.$.addSales, 'hide');
|
||||
spyOn(controller.$state, 'go');
|
||||
$httpBackend.expectPOST(`claim/api/ClaimBeginnings/`).respond({});
|
||||
$httpBackend.expectPOST(`ClaimBeginnings/`).respond({});
|
||||
controller.addClaimedSale(1);
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -71,7 +69,7 @@ describe('claim', () => {
|
|||
describe('deleteClaimedSale(index)', () => {
|
||||
it('should make a delete and call refresh and showSuccess', () => {
|
||||
spyOn(controller.$.model, 'remove');
|
||||
$httpBackend.expectDELETE(`claim/api/ClaimBeginnings/1`).respond({});
|
||||
$httpBackend.expectDELETE(`ClaimBeginnings/1`).respond({});
|
||||
controller.deleteClaimedSale(0);
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -82,7 +80,7 @@ describe('claim', () => {
|
|||
describe('setClaimedQuantity(id, claimedQuantity)', () => {
|
||||
it('should make a patch and call refresh and showSuccess', () => {
|
||||
spyOn(controller.vnApp, 'showSuccess');
|
||||
$httpBackend.expectPATCH(`claim/api/ClaimBeginnings/`).respond({});
|
||||
$httpBackend.expectPATCH(`ClaimBeginnings/`).respond({});
|
||||
controller.setClaimedQuantity(1, 1);
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -115,7 +113,7 @@ describe('claim', () => {
|
|||
spyOn(controller, 'clearDiscount');
|
||||
spyOn(controller.$.model, 'refresh');
|
||||
|
||||
$httpBackend.when('POST', '/api/Tickets/1/updateDiscount').respond({});
|
||||
$httpBackend.when('POST', 'Tickets/1/updateDiscount').respond({});
|
||||
controller.updateDiscount();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="claim/api/ClaimDevelopments"
|
||||
url="ClaimDevelopments"
|
||||
fields="['id', 'claimFk', 'claimReasonFk', 'claimResultFk', 'claimResponsibleFk', 'workerFk', 'claimRedeliveryFk']"
|
||||
link="{claimFk: $ctrl.$state.params.id}"
|
||||
filter="$ctrl.filter"
|
||||
|
@ -8,25 +8,25 @@
|
|||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-crud-model
|
||||
url="claim/api/ClaimReasons"
|
||||
url="ClaimReasons"
|
||||
data="claimReasons"
|
||||
order="description"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-crud-model
|
||||
url="claim/api/ClaimResults"
|
||||
url="ClaimResults"
|
||||
data="claimResults"
|
||||
order="description"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-crud-model
|
||||
url="claim/api/ClaimResponsibles"
|
||||
url="ClaimResponsibles"
|
||||
data="claimResponsibles"
|
||||
order="description"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-crud-model
|
||||
url="claim/api/ClaimRedeliveries"
|
||||
url="ClaimRedeliveries"
|
||||
data="claimRedeliveries"
|
||||
order="description"
|
||||
auto-load="true">
|
||||
|
@ -72,7 +72,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="claimDevelopment.workerFk"
|
||||
url="/api/Clients/activeWorkersWithRole"
|
||||
url="Clients/activeWorkersWithRole"
|
||||
show-field="nickname"
|
||||
search-function="{firstName: $search}"
|
||||
value-field="id"
|
||||
|
|
|
@ -8,9 +8,7 @@ describe('Claim', () => {
|
|||
let $scope;
|
||||
let aclService;
|
||||
|
||||
beforeEach(angular.mock.module('claim', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<vn-crud-model vn-id="model" auto-load="true"
|
||||
url="/api/ClaimDms"
|
||||
url="ClaimDms"
|
||||
link="{claimFk: $ctrl.$stateParams.id}"
|
||||
limit="20"
|
||||
data="$ctrl.photos">
|
||||
|
@ -16,7 +16,7 @@
|
|||
<section class="photo" ng-repeat="photo in $ctrl.photos">
|
||||
<section class="image vn-shadow" on-error-src
|
||||
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 class="actions">
|
||||
<vn-button
|
||||
|
|
|
@ -28,7 +28,7 @@ class Controller {
|
|||
deleteDms(response) {
|
||||
if (response === 'ACCEPT') {
|
||||
const dmsFk = this.photos[this.dmsIndex].dmsFk;
|
||||
const query = `/api/claimDms/${dmsFk}/removeFile`;
|
||||
const query = `claimDms/${dmsFk}/removeFile`;
|
||||
this.$http.post(query).then(() => {
|
||||
this.$.model.remove(this.dmsIndex);
|
||||
this.vnApp.showSuccess(this.$translate.instant('Photo deleted'));
|
||||
|
@ -49,7 +49,7 @@ class Controller {
|
|||
const params = {filter: {
|
||||
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 companyId = this.vnConfig.companyFk;
|
||||
const warehouseId = this.vnConfig.warehouseFk;
|
||||
|
@ -71,7 +71,7 @@ class Controller {
|
|||
|
||||
|
||||
create() {
|
||||
const query = `/api/claims/${this.claim.id}/uploadFile`;
|
||||
const query = `claims/${this.claim.id}/uploadFile`;
|
||||
const options = {
|
||||
method: 'POST',
|
||||
url: query,
|
||||
|
|
|
@ -9,9 +9,7 @@ describe('Claim', () => {
|
|||
let controller;
|
||||
let $httpParamSerializer;
|
||||
|
||||
beforeEach(angular.mock.module('claim', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
|
||||
$componentController = _$componentController_;
|
||||
|
@ -35,8 +33,8 @@ describe('Claim', () => {
|
|||
controller.photos = [{dmsFk: 1}];
|
||||
controller.dmsIndex = dmsIndex;
|
||||
|
||||
$httpBackend.when('POST', `/api/claimDms/${dmsId}/removeFile`).respond({});
|
||||
$httpBackend.expect('POST', `/api/claimDms/${dmsId}/removeFile`);
|
||||
$httpBackend.when('POST', `claimDms/${dmsId}/removeFile`).respond({});
|
||||
$httpBackend.expect('POST', `claimDms/${dmsId}/removeFile`);
|
||||
controller.deleteDms('ACCEPT');
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -51,8 +49,8 @@ describe('Claim', () => {
|
|||
where: {code: 'claim'}
|
||||
}};
|
||||
let serializedParams = $httpParamSerializer(params);
|
||||
$httpBackend.when('GET', `/api/DmsTypes/findOne?${serializedParams}`).respond({});
|
||||
$httpBackend.expect('GET', `/api/DmsTypes/findOne?${serializedParams}`);
|
||||
$httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({});
|
||||
$httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`);
|
||||
controller.setDefaultParams();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -70,8 +68,8 @@ describe('Claim', () => {
|
|||
controller.dmsIndex = dmsIndex;
|
||||
controller.dms = {files: []};
|
||||
|
||||
$httpBackend.when('POST', `/api/claims/${claimId}/uploadFile`).respond({});
|
||||
$httpBackend.expect('POST', `/api/claims/${claimId}/uploadFile`);
|
||||
$httpBackend.when('POST', `claims/${claimId}/uploadFile`).respond({});
|
||||
$httpBackend.expect('POST', `claims/${claimId}/uploadFile`);
|
||||
controller.create();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="/claim/api/Claims/filter"
|
||||
url="Claims/filter"
|
||||
limit="20"
|
||||
data="claims"
|
||||
order="claimStateFk ASC, created DESC"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="filter.salesPersonFk"
|
||||
url="/client/api/Clients/activeWorkersWithRole"
|
||||
url="Clients/activeWorkersWithRole"
|
||||
search-function="{firstName: $search}"
|
||||
value-field="id"
|
||||
where="{role: 'employee'}"
|
||||
|
@ -42,7 +42,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="filter.attenderFk"
|
||||
url="/client/api/Clients/activeWorkersWithRole"
|
||||
url="Clients/activeWorkersWithRole"
|
||||
search-function="{firstName: $search}"
|
||||
value-field="id"
|
||||
where="{role: 'employee'}"
|
||||
|
@ -54,7 +54,7 @@
|
|||
<vn-autocomplete vn-one
|
||||
label="State"
|
||||
ng-model="filter.claimStateFk"
|
||||
url="/claim/api/ClaimStates"
|
||||
url="ClaimStates"
|
||||
show-field="description"
|
||||
value-field="id">
|
||||
<tpl-item>{{description}}</tpl-item>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<vn-crud-model vn-id="model"
|
||||
url="/api/ClaimDms"
|
||||
url="ClaimDms"
|
||||
data="photos">
|
||||
</vn-crud-model>
|
||||
<vn-card class="summary">
|
||||
|
@ -87,7 +87,7 @@
|
|||
<section class="photo" ng-repeat="photo in photos">
|
||||
<section class="image" on-error-src
|
||||
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>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -30,7 +30,7 @@ class Controller {
|
|||
}
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,9 +6,7 @@ describe('Claim', () => {
|
|||
let controller;
|
||||
let $httpBackend;
|
||||
|
||||
beforeEach(angular.mock.module('claim', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
|
@ -19,8 +17,8 @@ describe('Claim', () => {
|
|||
|
||||
describe('getSummary()', () => {
|
||||
it('should perform a query to set summary', () => {
|
||||
$httpBackend.when('GET', `/claim/api/Claims/1/getSummary`).respond(200, 24);
|
||||
$httpBackend.expect('GET', `/claim/api/Claims/1/getSummary`);
|
||||
$httpBackend.when('GET', `Claims/1/getSummary`).respond(200, 24);
|
||||
$httpBackend.expect('GET', `Claims/1/getSummary`);
|
||||
controller.getSummary();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
url="/client/api/Addresses/createDefaultAddress"
|
||||
url="Addresses/createDefaultAddress"
|
||||
id-field="id"
|
||||
data="$ctrl.data"
|
||||
save="post"
|
||||
|
@ -8,7 +8,7 @@
|
|||
</vn-watcher>
|
||||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="/client/api/AddressObservations"
|
||||
url="AddressObservations"
|
||||
fields="['id', 'addressFk', 'observationTypeFk', 'description']"
|
||||
link="{addressFk: $ctrl.$stateParams.addressId}"
|
||||
data="observations"
|
||||
|
@ -42,7 +42,7 @@
|
|||
vn-one
|
||||
vn-id="province"
|
||||
ng-model="$ctrl.address.provinceFk"
|
||||
url="/api/Provinces"
|
||||
url="Provinces"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Province">
|
||||
|
@ -55,7 +55,7 @@
|
|||
</vn-textfield>
|
||||
<!-- <vn-autocomplete vn-id="town" vn-one
|
||||
label="City"
|
||||
url="/api/Towns"
|
||||
url="Towns"
|
||||
fields="['id', 'name']"
|
||||
where="{provinceFk: province.selection.id}"
|
||||
show-field="name"
|
||||
|
@ -63,7 +63,7 @@
|
|||
ng-model="$ctrl.address.city">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete vn-one
|
||||
url="/api/Postcodes/location"
|
||||
url="Postcodes/location"
|
||||
fields="['code', 'townFk']"
|
||||
ng-model="$ctrl.address.postalCode"
|
||||
selection="$ctrl.postcodeSelection"
|
||||
|
@ -98,7 +98,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.address.agencyModeFk"
|
||||
url="/api/AgencyModes/isActive"
|
||||
url="AgencyModes/isActive"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Agency">
|
||||
|
|
|
@ -7,9 +7,7 @@ describe('Client', () => {
|
|||
let $componentController;
|
||||
let $state;
|
||||
|
||||
beforeEach(angular.mock.module('client', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject((_$componentController_, _$state_) => {
|
||||
$componentController = _$componentController_;
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
|
||||
<mg-ajax
|
||||
path="/client/api/Addresses/{{edit.params.addressId}}"
|
||||
path="Addresses/{{edit.params.addressId}}"
|
||||
actions="$ctrl.address = edit.model"
|
||||
options="mgEdit">
|
||||
</mg-ajax>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.address"
|
||||
url="/client/api/Addresses"
|
||||
url="Addresses"
|
||||
id-field="id"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="/client/api/AddressObservations"
|
||||
url="AddressObservations"
|
||||
fields="['id', 'addressFk', 'observationTypeFk', 'description']"
|
||||
link="{addressFk: $ctrl.$stateParams.addressId}"
|
||||
data="observations"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-crud-model
|
||||
url="/client/api/ObservationTypes"
|
||||
url="ObservationTypes"
|
||||
fields="['id', 'description']"
|
||||
data="types"
|
||||
auto-load="true">
|
||||
|
@ -60,7 +60,7 @@
|
|||
vn-one
|
||||
vn-id="province"
|
||||
ng-model="$ctrl.address.provinceFk"
|
||||
url="/api/Provinces"
|
||||
url="Provinces"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Province">
|
||||
|
@ -74,7 +74,7 @@
|
|||
<!--
|
||||
<vn-autocomplete vn-id="town" vn-one
|
||||
label="City"
|
||||
url="/api/Towns"
|
||||
url="Towns"
|
||||
fields="['id', 'name']"
|
||||
where="{provinceFk: province.selection.id}"
|
||||
show-field="name"
|
||||
|
@ -82,7 +82,7 @@
|
|||
ng-model="$ctrl.address.city">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete vn-one
|
||||
url="/api/Postcodes/location"
|
||||
url="Postcodes/location"
|
||||
fields="['code', 'townFk']"
|
||||
ng-model="$ctrl.address.postalCode"
|
||||
where="{townFk: town.selection.id}"
|
||||
|
@ -113,7 +113,7 @@
|
|||
<vn-autocomplete vn-one
|
||||
initial-data="$ctrl.address.agencyMode"
|
||||
ng-model="$ctrl.address.agencyModeFk"
|
||||
url="/client/api/AgencyModes/isActive"
|
||||
url="AgencyModes/isActive"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Agency">
|
||||
|
|
|
@ -5,9 +5,7 @@ describe('Client', () => {
|
|||
let $state;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('client', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_) => {
|
||||
$state = _$state_;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="/api/Clients/{{$ctrl.$stateParams.id}}/addresses"
|
||||
url="Clients/{{$ctrl.$stateParams.id}}/addresses"
|
||||
filter="$ctrl.filter"
|
||||
limit="10"
|
||||
data="$ctrl.addresses"
|
||||
|
|
|
@ -45,7 +45,7 @@ class Controller {
|
|||
}
|
||||
|
||||
setDefault(address) {
|
||||
let query = `/client/api/Clients/${this.$stateParams.id}`;
|
||||
let query = `Clients/${this.$stateParams.id}`;
|
||||
let params = {defaultAddressFk: address.id};
|
||||
this.$http.patch(query, params).then(res => {
|
||||
if (res.data) {
|
||||
|
|
|
@ -8,9 +8,7 @@ describe('Client', () => {
|
|||
let $stateParams;
|
||||
let $httpBackend;
|
||||
|
||||
beforeEach(angular.mock.module('client', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => {
|
||||
$stateParams = _$stateParams_;
|
||||
|
@ -29,8 +27,8 @@ describe('Client', () => {
|
|||
let data = {defaultAddressFk: address.id};
|
||||
let expectedResult = {defaultAddressFk: address.id};
|
||||
|
||||
$httpBackend.when('PATCH', `/client/api/Clients/1`, data).respond(200, expectedResult);
|
||||
$httpBackend.expect('PATCH', `/client/api/Clients/1`, data);
|
||||
$httpBackend.when('PATCH', `Clients/1`, data).respond(200, expectedResult);
|
||||
$httpBackend.expect('PATCH', `Clients/1`, data);
|
||||
controller.setDefault(address);
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
vn-id="dialog"
|
||||
class="modal-form">
|
||||
<tpl-body>
|
||||
<mg-ajax path="/client/api/receipts" options="vnPost"></mg-ajax>
|
||||
<mg-ajax path="receipts" options="vnPost"></mg-ajax>
|
||||
<vn-horizontal class="header">
|
||||
<h5><span translate>New payment</span></h5>
|
||||
</vn-horizontal>
|
||||
|
@ -14,7 +14,7 @@
|
|||
ng-model="$ctrl.receipt.payed">
|
||||
</vn-date-picker>
|
||||
<vn-autocomplete vn-one
|
||||
url="/api/Companies"
|
||||
url="Companies"
|
||||
label="Company"
|
||||
show-field="code"
|
||||
value-field="id"
|
||||
|
@ -23,7 +23,7 @@
|
|||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete vn-one
|
||||
url="/api/Banks"
|
||||
url="Banks"
|
||||
label="Bank"
|
||||
show-field="bank"
|
||||
value-field="id"
|
||||
|
|
|
@ -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.receipt.amountPaid = (res.data.length && res.data[0].amount) || null;
|
||||
});
|
||||
|
@ -77,7 +77,7 @@ class Controller {
|
|||
}
|
||||
|
||||
save() {
|
||||
let query = `/client/api/receipts`;
|
||||
let query = `receipts`;
|
||||
this.$http.post(query, this.receipt).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.hide();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="/client/api/receipts/filter"
|
||||
url="receipts/filter"
|
||||
params="$ctrl.params"
|
||||
limit="20"
|
||||
data="$ctrl.balances"
|
||||
|
@ -8,7 +8,7 @@
|
|||
</vn-crud-model>
|
||||
<vn-crud-model
|
||||
vn-id="riskModel"
|
||||
url="/client/api/ClientRisks"
|
||||
url="ClientRisks"
|
||||
filter="$ctrl.filter"
|
||||
data="$ctrl.clientRisks">
|
||||
</vn-crud-model>
|
||||
|
@ -23,7 +23,7 @@
|
|||
class="dense"
|
||||
ng-model="$ctrl.companyFk"
|
||||
on-change="$ctrl.setOrder(value)"
|
||||
url="/client/api/Companies"
|
||||
url="Companies"
|
||||
show-field="code"
|
||||
value-field="id"
|
||||
label="Company">
|
||||
|
@ -100,7 +100,7 @@
|
|||
<vn-td center shrink>
|
||||
<a ng-show="balance.hasPdf"
|
||||
target="_blank"
|
||||
href="api/InvoiceOuts/{{::balance.id}}/download?access_token={{::$ctrl.accessToken}}">
|
||||
href="InvoiceOuts/{{::balance.id}}/download?access_token={{::$ctrl.accessToken}}">
|
||||
<vn-icon-button
|
||||
icon="cloud_download"
|
||||
title="{{'Download PDF' | translate}}">
|
||||
|
|
|
@ -56,7 +56,7 @@ class Controller {
|
|||
|
||||
if (!value) return;
|
||||
const params = {filter: this.filter};
|
||||
this.$http.get(`/client/api/ClientRisks`, {params}).then(response => {
|
||||
this.$http.get(`ClientRisks`, {params}).then(response => {
|
||||
if (response.data) {
|
||||
this.clientRisks = response.data;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue