Refactor
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
934e057a67
commit
a9c622377e
|
@ -1 +1 @@
|
|||
<vn-log url="RouteLogs" origin-id="$ctrl.$stateParams.id"></vn-log>
|
||||
<vn-log url="RouteLogs" origin-id="$ctrl.$params.id"></vn-log>
|
|
@ -1 +1 @@
|
|||
<vn-log url="TicketLogs" origin-id="$ctrl.$stateParams.id"></vn-log>
|
||||
<vn-log url="TicketLogs" origin-id="$ctrl.$params.id"></vn-log>
|
|
@ -1,17 +1,13 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller {
|
||||
constructor($scope) {
|
||||
this.$ = $scope;
|
||||
}
|
||||
|
||||
class Controller extends Section {
|
||||
onSubmit() {
|
||||
return this.$.watcher.submit().then(() => {
|
||||
this.card.reload();
|
||||
});
|
||||
return this.$.watcher.submit().then(() =>
|
||||
this.card.reload()
|
||||
);
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope'];
|
||||
|
||||
ngModule.component('vnTravelBasicData', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -2,14 +2,14 @@ import './index.js';
|
|||
|
||||
describe('Travel Component vnTravelBasicData', () => {
|
||||
let controller;
|
||||
let $scope;
|
||||
|
||||
beforeEach(angular.mock.module('travel', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
controller = $componentController('vnTravelBasicData', $scope);
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
const $element = angular.element('<vn-travel-basic-data></vn-travel-basic-data>');
|
||||
controller = $componentController('vnTravelBasicData', {$element});
|
||||
controller.card = {reload: () => {}};
|
||||
controller.$.watcher = {submit: () => {}};
|
||||
}));
|
||||
|
|
|
@ -2,14 +2,9 @@ import ngModule from '../module';
|
|||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller extends Section {
|
||||
constructor($element, $, $stateParams) {
|
||||
super($element, $);
|
||||
this.$stateParams = $stateParams;
|
||||
}
|
||||
|
||||
$onChanges() {
|
||||
if (this.$stateParams && this.$stateParams.q)
|
||||
this.travel = JSON.parse(this.$stateParams.q);
|
||||
if (this.$params && this.$params.q)
|
||||
this.travel = JSON.parse(this.$params.q);
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
@ -19,8 +14,6 @@ class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$stateParams'];
|
||||
|
||||
ngModule.component('vnTravelCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
|
|
|
@ -2,7 +2,6 @@ import './index';
|
|||
import watcher from 'core/mocks/watcher';
|
||||
|
||||
describe('Travel Component vnTravelCreate', () => {
|
||||
let $element;
|
||||
let $scope;
|
||||
let $state;
|
||||
let controller;
|
||||
|
@ -13,7 +12,7 @@ describe('Travel Component vnTravelCreate', () => {
|
|||
$scope = $rootScope.$new();
|
||||
$state = _$state_;
|
||||
$scope.watcher = watcher;
|
||||
$element = angular.element('<div></div>');
|
||||
const $element = angular.element('<vn-travel-create></vn-travel-create>');
|
||||
controller = $componentController('vnTravelCreate', {$element, $scope});
|
||||
}));
|
||||
|
||||
|
@ -28,8 +27,8 @@ describe('Travel Component vnTravelCreate', () => {
|
|||
});
|
||||
|
||||
describe('$onChanges()', () => {
|
||||
it('should update the travel data when stateParams.q is defined', () => {
|
||||
controller.$stateParams = {q: '{"ref": 1,"agencyModeFk": 1}'};
|
||||
it('should update the travel data when $params.q is defined', () => {
|
||||
controller.$params = {q: '{"ref": 1,"agencyModeFk": 1}'};
|
||||
|
||||
const params = {q: '{"ref": 1, "agencyModeFk": 1}'};
|
||||
const json = JSON.parse(params.q);
|
||||
|
|
|
@ -2,11 +2,8 @@ import ngModule from '../module';
|
|||
import Component from 'core/lib/component';
|
||||
|
||||
class Controller extends Component {
|
||||
constructor($element, $scope, $http, $timeout, $q) {
|
||||
super($element, $scope);
|
||||
this.$timeout = $timeout;
|
||||
this.$http = $http;
|
||||
this.$q = $q;
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.travel = null;
|
||||
this._quicklinks = {};
|
||||
}
|
||||
|
@ -76,7 +73,6 @@ class Controller extends Component {
|
|||
});
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$element', '$scope', '$http', '$timeout', '$q'];
|
||||
|
||||
ngModule.component('vnTravelDescriptorPopover', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class Controller {
|
||||
constructor($scope) {
|
||||
this.$ = $scope;
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope'];
|
||||
import Component from 'core/lib/component';
|
||||
|
||||
ngModule.component('vnTravelDescriptor', {
|
||||
template: require('./index.html'),
|
||||
controller: Component,
|
||||
bindings: {
|
||||
travel: '<'
|
||||
},
|
||||
require: {
|
||||
card: '^?vnTravelCard'
|
||||
},
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
export default class Controller {
|
||||
constructor($scope, $state) {
|
||||
this.$ = $scope;
|
||||
this.ticketSelected = null;
|
||||
this.$state = $state;
|
||||
}
|
||||
|
||||
export default class Controller extends Section {
|
||||
getScopeDates(days) {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
@ -66,8 +61,6 @@ export default class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$state'];
|
||||
|
||||
ngModule.component('vnTravelIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
|
|
|
@ -25,10 +25,10 @@ describe('Travel Component vnTravelIndex', () => {
|
|||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject((_$componentController_, $rootScope) => {
|
||||
beforeEach(angular.mock.inject(_$componentController_ => {
|
||||
$componentController = _$componentController_;
|
||||
let $scope = $rootScope.$new();
|
||||
controller = $componentController('vnTravelIndex', $scope);
|
||||
const $element = angular.element('<vn-travel-index></vn-travel-index>');
|
||||
controller = $componentController('vnTravelIndex', {$element});
|
||||
controller.$.summary = {show: jasmine.createSpy('show')};
|
||||
}));
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
<vn-log url="TravelLogs" origin-id="$ctrl.$stateParams.id"></vn-log>
|
||||
<vn-log url="TravelLogs" origin-id="$ctrl.$params.id"></vn-log>
|
|
@ -1,15 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class Controller {
|
||||
constructor($scope, $stateParams) {
|
||||
this.$scope = $scope;
|
||||
this.$stateParams = $stateParams;
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$stateParams'];
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
ngModule.component('vnTravelLog', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
controller: Section,
|
||||
});
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
import Component from 'core/lib/component';
|
||||
|
||||
class Controller extends Component {
|
||||
constructor($element, $, $httpParamSerializer) {
|
||||
super($element, $);
|
||||
class Controller extends Section {
|
||||
$onInit() {
|
||||
this.entries = [];
|
||||
this.$httpParamSerializer = $httpParamSerializer;
|
||||
}
|
||||
|
||||
get travel() {
|
||||
|
@ -50,8 +48,7 @@ class Controller extends Component {
|
|||
}
|
||||
};
|
||||
|
||||
const serializedParams = this.$httpParamSerializer(params);
|
||||
return this.$http.get(`TravelThermographs?${serializedParams}`).then(res => {
|
||||
return this.$http.get(`TravelThermographs`, {params}).then(res => {
|
||||
this.travelThermographs = res.data;
|
||||
});
|
||||
}
|
||||
|
@ -66,8 +63,6 @@ class Controller extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$httpParamSerializer'];
|
||||
|
||||
ngModule.component('vnTravelSummary', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -4,7 +4,6 @@ describe('component vnTravelSummary', () => {
|
|||
let controller;
|
||||
let $httpBackend;
|
||||
let $scope;
|
||||
let $element;
|
||||
let $httpParamSerializer;
|
||||
|
||||
beforeEach(angular.mock.module('travel', $translateProvider => {
|
||||
|
@ -15,7 +14,7 @@ describe('component vnTravelSummary', () => {
|
|||
$httpBackend = _$httpBackend_;
|
||||
$httpParamSerializer = _$httpParamSerializer_;
|
||||
$scope = $rootScope.$new();
|
||||
$element = angular.element(`<vn-travel-summary></vn-travel-summary>`);
|
||||
const $element = angular.element(`<vn-travel-summary></vn-travel-summary>`);
|
||||
controller = $componentController('vnTravelSummary', {$element, $scope});
|
||||
}));
|
||||
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller {
|
||||
constructor($scope, $http, $state, $translate, vnApp, vnConfig) {
|
||||
this.$ = $scope;
|
||||
this.$http = $http;
|
||||
this.$state = $state;
|
||||
this.$translate = $translate;
|
||||
this.vnApp = vnApp;
|
||||
this.vnConfig = vnConfig;
|
||||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.dms = {files: [], state: 'Ok'};
|
||||
}
|
||||
|
||||
|
@ -86,8 +82,6 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$http', '$state', '$translate', 'vnApp', 'vnConfig'];
|
||||
|
||||
ngModule.component('vnTravelThermographCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -3,7 +3,6 @@ import './index';
|
|||
describe('Ticket', () => {
|
||||
describe('Component vnTravelThermographCreate', () => {
|
||||
let controller;
|
||||
let $scope;
|
||||
let $httpBackend;
|
||||
let $httpParamSerializer;
|
||||
const travelId = 3;
|
||||
|
@ -11,11 +10,11 @@ describe('Ticket', () => {
|
|||
|
||||
beforeEach(ngModule('travel'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
|
||||
$scope = $rootScope.$new();
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$httpParamSerializer = _$httpParamSerializer_;
|
||||
controller = $componentController('vnTravelThermographCreate', {$scope});
|
||||
const $element = angular.element('<vn-travel-thermograph-create></vn-travel-thermograph-create>');
|
||||
controller = $componentController('vnTravelThermographCreate', {$element});
|
||||
controller._travel = {
|
||||
id: travelId
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import ngModule from '../../module';
|
||||
import Component from 'core/lib/component';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Component {
|
||||
class Controller extends Section {
|
||||
get travel() {
|
||||
return this._travel;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ describe('Worker', () => {
|
|||
describe('Component vnTravelThermographEdit', () => {
|
||||
let controller;
|
||||
let $scope;
|
||||
let $element;
|
||||
let $httpBackend;
|
||||
let $httpParamSerializer;
|
||||
|
||||
|
@ -15,7 +14,7 @@ describe('Worker', () => {
|
|||
$scope = $rootScope.$new();
|
||||
$httpBackend = _$httpBackend_;
|
||||
$httpParamSerializer = _$httpParamSerializer_;
|
||||
$element = angular.element(`<vn-travel-thermograph-edit></vn-travel-thermograph-edit`);
|
||||
const $element = angular.element(`<vn-travel-thermograph-edit></vn-travel-thermograph-edit`);
|
||||
controller = $componentController('vnTravelThermographEdit', {$element, $scope});
|
||||
controller._travel = {id: 3};
|
||||
controller.$params = {id: 3, thermographId: 6};
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
import Component from 'core/lib/component';
|
||||
|
||||
class Controller extends Component {
|
||||
constructor($element, $, vnToken) {
|
||||
super($element, $);
|
||||
this.accessToken = vnToken.token;
|
||||
class Controller extends Section {
|
||||
$onInit() {
|
||||
this.filter = {
|
||||
include:
|
||||
{relation: 'warehouse',
|
||||
|
@ -33,8 +31,6 @@ class Controller extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', 'vnToken'];
|
||||
|
||||
ngModule.component('vnTravelThermographIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller {
|
||||
constructor($) {
|
||||
Object.assign(this, {$});
|
||||
}
|
||||
|
||||
class Controller extends Section {
|
||||
onSubmit() {
|
||||
this.$.watcher.submit()
|
||||
.then(() => this.card.reload());
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope'];
|
||||
|
||||
ngModule.component('vnWorkerBasicData', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller {
|
||||
constructor($element, $http) {
|
||||
this.element = $element[0];
|
||||
this.$http = $http;
|
||||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.date = new Date();
|
||||
this.events = {};
|
||||
}
|
||||
|
@ -103,7 +103,6 @@ class Controller {
|
|||
dayNumber.style.color = 'rgba(0, 0, 0, 0.7)';
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$element', '$http'];
|
||||
|
||||
ngModule.component('vnWorkerCalendar', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -4,7 +4,6 @@ describe('Worker', () => {
|
|||
describe('Component vnWorkerCalendar', () => {
|
||||
let $httpBackend;
|
||||
let $scope;
|
||||
let $element;
|
||||
let controller;
|
||||
let year = new Date().getFullYear();
|
||||
|
||||
|
@ -13,15 +12,10 @@ describe('Worker', () => {
|
|||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||
$scope = $rootScope.$new();
|
||||
$httpBackend = _$httpBackend_;
|
||||
$element = angular.element('<div></div>');
|
||||
const $element = angular.element('<vn-worker-calencar></vn-worker-calencar>');
|
||||
controller = $componentController('vnWorkerCalendar', {$element, $scope});
|
||||
}));
|
||||
|
||||
afterEach(() => {
|
||||
$element.remove();
|
||||
$scope.$destroy();
|
||||
});
|
||||
|
||||
describe('started property', () => {
|
||||
it(`should return first day and month of current year`, () => {
|
||||
let started = new Date(year, 0, 1);
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller {
|
||||
constructor($scope, $http, vnApp, $translate) {
|
||||
this.$ = $scope;
|
||||
this.$http = $http;
|
||||
this.vnApp = vnApp;
|
||||
this.$translate = $translate;
|
||||
}
|
||||
|
||||
class Controller extends Section {
|
||||
$postLink() {
|
||||
this.$.treeview.fetch();
|
||||
}
|
||||
|
@ -87,8 +81,6 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$http', 'vnApp', '$translate'];
|
||||
|
||||
ngModule.component('vnWorkerDepartment', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
|
|
|
@ -2,11 +2,8 @@ import ngModule from '../module';
|
|||
import Component from 'core/lib/component';
|
||||
|
||||
class Controller extends Component {
|
||||
constructor($element, $scope, $http, $timeout, $q) {
|
||||
super($element, $scope);
|
||||
this.$timeout = $timeout;
|
||||
this.$http = $http;
|
||||
this.$q = $q;
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.worker = null;
|
||||
this._quicklinks = {};
|
||||
}
|
||||
|
@ -84,7 +81,6 @@ class Controller extends Component {
|
|||
});
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$element', '$scope', '$http', '$timeout', '$q'];
|
||||
|
||||
ngModule.component('vnWorkerDescriptorPopover', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -5,17 +5,16 @@ describe('worker Component vnWorkerDescriptorPopover', () => {
|
|||
let $httpParamSerializer;
|
||||
let $scope;
|
||||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(ngModule('worker'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$httpParamSerializer = _$httpParamSerializer_;
|
||||
$element = angular.element(`<div></div>`);
|
||||
$scope = $rootScope.$new();
|
||||
$scope.popover = {relocate: () => {}, show: () => {}};
|
||||
controller = $componentController('vnWorkerDescriptorPopover', {$scope, $element});
|
||||
const $element = angular.element(`<vn-worker-descriptor-popover></vn-worker-descriptor-popover>`);
|
||||
controller = $componentController('vnWorkerDescriptorPopover', {$element, $scope});
|
||||
}));
|
||||
|
||||
describe('workerFk()', () => {
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Component from 'core/lib/component';
|
||||
|
||||
class Controller {
|
||||
constructor($http, $state) {
|
||||
this.$state = $state;
|
||||
this.$http = $http;
|
||||
}
|
||||
|
||||
class Controller extends Component {
|
||||
get worker() {
|
||||
return this._worker;
|
||||
}
|
||||
|
@ -33,9 +29,6 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$http', '$state'];
|
||||
|
||||
|
||||
ngModule.component('vnWorkerDescriptor', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import ngModule from '../../module';
|
||||
import Component from 'core/lib/component';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Component {
|
||||
constructor($element, $, vnConfig) {
|
||||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.vnConfig = vnConfig;
|
||||
this.dms = {
|
||||
files: [],
|
||||
hasFile: false,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import ngModule from '../../module';
|
||||
import Component from 'core/lib/component';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Component {
|
||||
class Controller extends Section {
|
||||
get worker() {
|
||||
return this._worker;
|
||||
}
|
||||
|
|
|
@ -3,9 +3,8 @@ import Component from 'core/lib/component';
|
|||
import './style.scss';
|
||||
|
||||
class Controller extends Component {
|
||||
constructor($element, $, vnToken) {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.accessToken = vnToken.token;
|
||||
this.filter = {
|
||||
include: {
|
||||
relation: 'dms',
|
||||
|
@ -68,8 +67,6 @@ class Controller extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', 'vnToken'];
|
||||
|
||||
ngModule.component('vnWorkerDmsIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
export default class Controller {
|
||||
constructor($, $state) {
|
||||
this.$state = $state;
|
||||
Object.assign(this, {
|
||||
$,
|
||||
selectedWorker: null,
|
||||
});
|
||||
}
|
||||
|
||||
export default class Controller extends Section {
|
||||
onSearch(params) {
|
||||
if (params)
|
||||
this.$.model.applyFilter(null, params);
|
||||
|
@ -26,7 +19,6 @@ export default class Controller {
|
|||
this.$.preview.show();
|
||||
}
|
||||
|
||||
|
||||
goToTimeControl(event, workerId) {
|
||||
if (event.defaultPrevented) return;
|
||||
|
||||
|
@ -34,11 +26,11 @@ export default class Controller {
|
|||
event.stopPropagation();
|
||||
this.$state.go('worker.card.timeControl', {id: workerId}, {absolute: true});
|
||||
}
|
||||
|
||||
onMoreChange(callback) {
|
||||
callback.call(this);
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope', '$state'];
|
||||
|
||||
ngModule.component('vnWorkerIndex', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
|
||||
export default class Controller {
|
||||
constructor($scope) {
|
||||
this.$ = $scope;
|
||||
export default class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.actionsText = {
|
||||
'insert': 'Creates',
|
||||
'update': 'Updates',
|
||||
|
@ -70,8 +71,6 @@ export default class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope'];
|
||||
|
||||
ngModule.component('vnLog', {
|
||||
controller: Controller,
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Component from 'core/lib/component';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller extends Component {
|
||||
class Controller extends Section {
|
||||
onSubmit() {
|
||||
const sip = this.worker.sip;
|
||||
const params = {
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller {
|
||||
constructor($, $http) {
|
||||
Object.assign(this, {
|
||||
$,
|
||||
$http
|
||||
});
|
||||
}
|
||||
|
||||
class Controller extends Section {
|
||||
get worker() {
|
||||
return this._worker;
|
||||
}
|
||||
|
@ -60,8 +54,6 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$http'];
|
||||
|
||||
ngModule.component('vnWorkerSummary', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import Component from 'core/lib/component';
|
||||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
class Controller extends Component {
|
||||
|
||||
class Controller extends Section {
|
||||
constructor($element, $, vnWeekDays) {
|
||||
super($element, $);
|
||||
this.weekDays = [];
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller {
|
||||
constructor($scope, $state) {
|
||||
this.$scope = $scope;
|
||||
this.$state = $state;
|
||||
}
|
||||
|
||||
class Controller extends Section {
|
||||
onSubmit() {
|
||||
this.$scope.watcher.submit().then(() => {
|
||||
this.card.reload();
|
||||
});
|
||||
this.$.watcher.submit().then(() =>
|
||||
this.card.reload()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$state'];
|
||||
|
||||
ngModule.component('vnZoneBasicData', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
export default class Controller {
|
||||
constructor($scope, $state) {
|
||||
this.$scope = $scope;
|
||||
this.$state = $state;
|
||||
export default class Controller extends Section {
|
||||
$onInit() {
|
||||
this.zone = {
|
||||
travelingDays: 0,
|
||||
price: 0.20,
|
||||
|
@ -13,12 +12,11 @@ export default class Controller {
|
|||
}
|
||||
|
||||
onSubmit() {
|
||||
return this.$scope.watcher.submit().then(res => {
|
||||
this.$state.go('zone.card.location', {id: res.data.id});
|
||||
});
|
||||
return this.$.watcher.submit().then(res =>
|
||||
this.$state.go('zone.card.location', {id: res.data.id})
|
||||
);
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope', '$state'];
|
||||
|
||||
ngModule.component('vnZoneCreate', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -19,7 +19,8 @@ describe('Zone Component vnZoneCreate', () => {
|
|||
}
|
||||
};
|
||||
};
|
||||
controller = $componentController('vnZoneCreate', {$scope});
|
||||
const $element = angular.element('<vn-zone-create></vn-zone-create>');
|
||||
controller = $componentController('vnZoneCreate', {$element, $scope});
|
||||
}));
|
||||
|
||||
describe('onSubmit()', () => {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import ngModule from '../module';
|
||||
import Component from 'core/lib/component';
|
||||
|
||||
class Controller {
|
||||
constructor($scope, $state, $http) {
|
||||
this.$scope = $scope;
|
||||
this.$state = $state;
|
||||
this.$http = $http;
|
||||
class Controller extends Component {
|
||||
$onInit() {
|
||||
this.moreOptions = [
|
||||
{callback: this.deleteZone, name: 'Delete'}
|
||||
];
|
||||
|
@ -15,7 +13,7 @@ class Controller {
|
|||
}
|
||||
|
||||
deleteZone() {
|
||||
this.$scope.deleteZone.show();
|
||||
this.$.deleteZone.show();
|
||||
}
|
||||
|
||||
returnDialog(response) {
|
||||
|
@ -27,8 +25,6 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$state', '$http'];
|
||||
|
||||
ngModule.component('vnZoneDescriptor', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
export default class Controller {
|
||||
constructor($scope, $http, $state) {
|
||||
this.$scope = $scope;
|
||||
this.$http = $http;
|
||||
this.$state = $state;
|
||||
export default class Controller extends Section {
|
||||
$onInit() {
|
||||
this.filter = {
|
||||
include: {
|
||||
relation: 'agencyMode',
|
||||
|
@ -73,8 +71,6 @@ export default class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$http', '$state'];
|
||||
|
||||
ngModule.component('vnZoneIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
|
|
|
@ -8,7 +8,8 @@ describe('Zone Component vnZoneIndex', () => {
|
|||
|
||||
beforeEach(angular.mock.inject(_$componentController_ => {
|
||||
$componentController = _$componentController_;
|
||||
controller = $componentController('vnZoneIndex');
|
||||
const $element = angular.element('<vn-zone-index></vn-zone-index>');
|
||||
controller = $componentController('vnZoneIndex', {$element});
|
||||
}));
|
||||
|
||||
describe('exprBuilder()', () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import ngModule from '../module';
|
||||
import Component from 'core/lib/component';
|
||||
import Section from 'salix/component/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Component {
|
||||
class Controller extends Section {
|
||||
$postLink() {
|
||||
this.onSearch();
|
||||
}
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Component from 'core/lib/component';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller extends Component {
|
||||
constructor($element, $, $httpParamSerializer) {
|
||||
super($element, $);
|
||||
|
||||
this.$httpParamSerializer = $httpParamSerializer;
|
||||
}
|
||||
class Controller extends Section {
|
||||
get zone() {
|
||||
return this._zone;
|
||||
}
|
||||
|
@ -32,8 +27,7 @@ class Controller extends Component {
|
|||
}
|
||||
}
|
||||
};
|
||||
const serializedParams = this.$httpParamSerializer(params);
|
||||
this.$http.get(`Zones/findOne?${serializedParams}`).then(res => {
|
||||
this.$http.get(`Zones/findOne`, {params}).then(res => {
|
||||
this.summary = res.data;
|
||||
});
|
||||
}
|
||||
|
@ -47,15 +41,12 @@ class Controller extends Component {
|
|||
}
|
||||
}
|
||||
};
|
||||
const serializedParams = this.$httpParamSerializer(params);
|
||||
this.$http.get(`Zones/${this.zone.id}/warehouses?${serializedParams}`).then(res => {
|
||||
this.$http.get(`Zones/${this.zone.id}/warehouses`, {params}).then(res => {
|
||||
this.zoneWarehouses = res.data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$httpParamSerializer'];
|
||||
|
||||
ngModule.component('vnZoneSummary', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import './index';
|
||||
|
||||
describe('component vnZoneSummary', () => {
|
||||
let $element;
|
||||
let $scope;
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
|
@ -13,7 +12,7 @@ describe('component vnZoneSummary', () => {
|
|||
$httpBackend = _$httpBackend_;
|
||||
$httpParamSerializer = _$httpParamSerializer_;
|
||||
$scope = $rootScope.$new();
|
||||
$element = angular.element(`<vn-zone-summary></vn-zone-summary>`);
|
||||
const $element = angular.element(`<vn-zone-summary></vn-zone-summary>`);
|
||||
controller = $componentController('vnZoneSummary', {$element, $scope});
|
||||
}));
|
||||
|
||||
|
@ -52,17 +51,4 @@ describe('component vnZoneSummary', () => {
|
|||
expect(controller.summary).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
xdescribe('getEntries()', () => {
|
||||
it('should call the getEntries method to get the entries data', () => {
|
||||
controller._travel = {id: 999};
|
||||
|
||||
const query = `/api/Travels/${controller._travel.id}/getEntries`;
|
||||
$httpBackend.expectGET(query).respond('I am the entries');
|
||||
controller.getEntries();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.entries).toEqual('I am the entries');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Component from 'core/lib/component';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller extends Component {
|
||||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
|
||||
|
|
Loading…
Reference in New Issue