Ticket 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
3cb98eaf5f
commit
f25c8bb644
|
@ -7,9 +7,9 @@ class Controller extends Section {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
this.receipt = {
|
this.receipt = {
|
||||||
payed: new Date(),
|
payed: new Date(),
|
||||||
clientFk: this.$state.params.id,
|
clientFk: this.$params.id,
|
||||||
companyFk: vnConfig.companyFk,
|
companyFk: this.vnConfig.companyFk,
|
||||||
bankFk: vnConfig.bankFk
|
bankFk: this.vnConfig.bankFk
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class Controller extends Section {
|
||||||
getAmountPaid() {
|
getAmountPaid() {
|
||||||
let filter = {
|
let filter = {
|
||||||
where: {
|
where: {
|
||||||
clientFk: this.$state.params.id,
|
clientFk: this.$params.id,
|
||||||
companyFk: this.receipt.companyFk
|
companyFk: this.receipt.companyFk
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -82,7 +82,6 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controller.$inject = ['$element', '$scope'];
|
|
||||||
|
|
||||||
ngModule.component('vnClientBalanceCreate', {
|
ngModule.component('vnClientBalanceCreate', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $state) {
|
|
||||||
this.$scope = $scope;
|
|
||||||
this.$state = $state;
|
|
||||||
}
|
|
||||||
|
|
||||||
set ticket(data) {
|
set ticket(data) {
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
|
||||||
|
@ -25,8 +21,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$state'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketBasicData', {
|
ngModule.component('vnTicketBasicData', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
bindings: {
|
bindings: {
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import Component from 'core/lib/component';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Component {
|
||||||
constructor($scope, $http, $translate, vnApp) {
|
|
||||||
this.$scope = $scope;
|
|
||||||
this.$http = $http;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
this.basicData.registerChild(this);
|
this.basicData.registerChild(this);
|
||||||
}
|
}
|
||||||
|
@ -247,8 +241,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$http', '$translate', 'vnApp'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketBasicDataStepOne', {
|
ngModule.component('vnTicketBasicDataStepOne', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -13,7 +13,8 @@ describe('Ticket', () => {
|
||||||
$state = _$state_;
|
$state = _$state_;
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$httpParamSerializer = _$httpParamSerializer_;
|
$httpParamSerializer = _$httpParamSerializer_;
|
||||||
controller = $componentController('vnTicketBasicDataStepOne', {$state});
|
const $element = angular.element('<vn-ticket-basic-data-step-one></vn-ticket-basic-data-step-one>');
|
||||||
|
controller = $componentController('vnTicketBasicDataStepOne', {$element});
|
||||||
controller.ticket = {
|
controller.ticket = {
|
||||||
addressFk: 121,
|
addressFk: 121,
|
||||||
agencyModeFk: 7,
|
agencyModeFk: 7,
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import Component from 'core/lib/component';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Component {
|
||||||
constructor($http, $state, $translate, vnApp) {
|
|
||||||
this.$http = $http;
|
|
||||||
this.$state = $state;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
this.data.registerChild(this);
|
this.data.registerChild(this);
|
||||||
}
|
}
|
||||||
|
@ -92,13 +86,11 @@ class Controller {
|
||||||
this.$translate.instant(`The ticket has been unrouted`)
|
this.$translate.instant(`The ticket has been unrouted`)
|
||||||
);
|
);
|
||||||
this.card.reload();
|
this.card.reload();
|
||||||
this.$state.go('ticket.card.summary', {id: this.$state.params.id});
|
this.$state.go('ticket.card.summary', {id: this.$params.id});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$http', '$state', '$translate', 'vnApp'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketBasicDataStepTwo', {
|
ngModule.component('vnTicketBasicDataStepTwo', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -7,7 +7,8 @@ describe('Ticket', () => {
|
||||||
beforeEach(ngModule('ticket'));
|
beforeEach(ngModule('ticket'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject($componentController => {
|
beforeEach(angular.mock.inject($componentController => {
|
||||||
controller = $componentController('vnTicketBasicDataStepTwo');
|
const $element = angular.element('<vn-ticket-basic-data-step-two><vn-ticket-basic-data-step-two>');
|
||||||
|
controller = $componentController('vnTicketBasicDataStepTwo', {$element});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('getTotalPrice()', () => {
|
describe('getTotalPrice()', () => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="Sales"
|
url="Sales"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
data="components"
|
data="components"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $stateParams) {
|
constructor($element, $) {
|
||||||
this.$stateParams = $stateParams;
|
super($element, $);
|
||||||
this.$scope = $scope;
|
|
||||||
this.filter = {
|
this.filter = {
|
||||||
order: 'concept ASC',
|
order: 'concept ASC',
|
||||||
include: [{
|
include: [{
|
||||||
|
@ -32,7 +32,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
base() {
|
base() {
|
||||||
let sales = this.$scope.model.data;
|
let sales = this.$.model.data;
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
|
|
||||||
if (!sales) return;
|
if (!sales) return;
|
||||||
|
@ -59,18 +59,16 @@ class Controller {
|
||||||
tooltip: 'Item diary'
|
tooltip: 'Item diary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$scope.descriptor.itemFk = itemFk;
|
this.$.descriptor.itemFk = itemFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.descriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.descriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
onDescriptorLoad() {
|
||||||
this.$scope.popover.relocate();
|
this.$.popover.relocate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$stateParams'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketComponents', {
|
ngModule.component('vnTicketComponents', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -75,7 +75,8 @@ describe('ticket', () => {
|
||||||
],
|
],
|
||||||
quantity: 5
|
quantity: 5
|
||||||
}];
|
}];
|
||||||
controller = $componentController('vnTicketComponents', {$scope});
|
const $element = angular.element('<vn-ticket-components></vn-ticket-components>');
|
||||||
|
controller = $componentController('vnTicketComponents', {$element, $scope});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('base()', () => {
|
describe('base()', () => {
|
||||||
|
|
|
@ -1,20 +1,16 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Component from 'core/lib/component';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Component {
|
||||||
constructor($http, vnApp, $translate, $state, $stateParams, vnConfig) {
|
constructor($element, $) {
|
||||||
this.$stateParams = $stateParams;
|
super($element, $);
|
||||||
this.$http = $http;
|
|
||||||
this.translate = $translate;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.vnConfig = vnConfig;
|
|
||||||
this.ticket = {};
|
this.ticket = {};
|
||||||
this.$state = $state;
|
this.clientFk = this.$params.clientFk;
|
||||||
this.clientFk = $stateParams.clientFk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
if (this.$stateParams && this.$stateParams.clientFk)
|
if (this.$params && this.$params.clientFk)
|
||||||
this.clientId = parseInt(this.$stateParams.clientFk);
|
this.clientId = parseInt(this.$params.clientFk);
|
||||||
|
|
||||||
this.warehouseId = this.vnConfig.warehouseFk;
|
this.warehouseId = this.vnConfig.warehouseFk;
|
||||||
}
|
}
|
||||||
|
@ -130,8 +126,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$http', 'vnApp', '$translate', '$state', '$stateParams', 'vnConfig'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketCreateCard', {
|
ngModule.component('vnTicketCreateCard', {
|
||||||
template: require('./card.html'),
|
template: require('./card.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $http, $state) {
|
|
||||||
this.$ = $scope;
|
|
||||||
this.$http = $http;
|
|
||||||
this.$state = $state;
|
|
||||||
}
|
|
||||||
|
|
||||||
async onSubmit() {
|
async onSubmit() {
|
||||||
let newTicketID = await this.$.card.createTicket();
|
let newTicketID = await this.$.card.createTicket();
|
||||||
this.$state.go('ticket.card.summary', {id: newTicketID});
|
this.$state.go('ticket.card.summary', {id: newTicketID});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controller.$inject = ['$scope', '$http', '$state'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketCreate', {
|
ngModule.component('vnTicketCreate', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -3,11 +3,8 @@ import Component from 'core/lib/component';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller extends Component {
|
class Controller extends Component {
|
||||||
constructor($element, $scope, $http, $timeout, $q) {
|
constructor($element, $scope) {
|
||||||
super($element, $scope);
|
super($element, $scope);
|
||||||
this.$timeout = $timeout;
|
|
||||||
this.$http = $http;
|
|
||||||
this.$q = $q;
|
|
||||||
this.ticket = null;
|
this.ticket = null;
|
||||||
this._quicklinks = {};
|
this._quicklinks = {};
|
||||||
}
|
}
|
||||||
|
@ -106,7 +103,6 @@ class Controller extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controller.$inject = ['$element', '$scope', '$http', '$timeout', '$q'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketDescriptorPopover', {
|
ngModule.component('vnTicketDescriptorPopover', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<vn-crud-model vn-id="model"
|
<vn-crud-model vn-id="model"
|
||||||
url="Tickets/{{$ctrl.$stateParams.id}}/getPossibleStowaways"
|
url="Tickets/{{$ctrl.$params.id}}/getPossibleStowaways"
|
||||||
data="possibleStowaways">
|
data="possibleStowaways">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Component from 'core/lib/component';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Component {
|
||||||
constructor($stateParams, $, $http, vnApp, $translate) {
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.$ = $;
|
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
this.$http = $http;
|
|
||||||
}
|
|
||||||
|
|
||||||
addStowaway(stowaway) {
|
addStowaway(stowaway) {
|
||||||
let params = {id: stowaway.id, shipFk: this.ticket.id};
|
let params = {id: stowaway.id, shipFk: this.ticket.id};
|
||||||
this.$http.post(`Stowaways/`, params)
|
this.$http.post(`Stowaways/`, params)
|
||||||
|
@ -29,8 +22,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$stateParams', '$scope', '$http', 'vnApp', '$translate'];
|
|
||||||
|
|
||||||
ngModule.component('vnAddStowaway', {
|
ngModule.component('vnAddStowaway', {
|
||||||
template: require('./addStowaway.html'),
|
template: require('./addStowaway.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -235,8 +235,7 @@ class Controller extends Component {
|
||||||
clientId: this.ticket.client.id,
|
clientId: this.ticket.client.id,
|
||||||
ticketId: this.ticket.id
|
ticketId: this.ticket.id
|
||||||
};
|
};
|
||||||
const serializedParams = this.$httpParamSerializer(params);
|
this.$http.get(`email/delivery-note`, {params}).then(
|
||||||
this.$http.get(`email/delivery-note?${serializedParams}`).then(
|
|
||||||
() => this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
|
() => this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $http, $state, $translate, vnApp, vnConfig) {
|
constructor($element, $) {
|
||||||
this.$ = $scope;
|
super($element, $);
|
||||||
this.$http = $http;
|
|
||||||
this.$state = $state;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.vnConfig = vnConfig;
|
|
||||||
this.dms = {
|
this.dms = {
|
||||||
files: [],
|
files: [],
|
||||||
hasFile: false,
|
hasFile: false,
|
||||||
|
@ -103,8 +99,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$http', '$state', '$translate', 'vnApp', 'vnConfig'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketDmsCreate', {
|
ngModule.component('vnTicketDmsCreate', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -13,7 +13,8 @@ describe('Ticket', () => {
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$httpParamSerializer = _$httpParamSerializer_;
|
$httpParamSerializer = _$httpParamSerializer_;
|
||||||
controller = $componentController('vnTicketDmsCreate', {$scope});
|
const $element = angular.element('<vn-ticket-dms-create></vn-ticket-dms-create>');
|
||||||
|
controller = $componentController('vnTicketDmsCreate', {$element});
|
||||||
controller._ticket = {
|
controller._ticket = {
|
||||||
id: 15,
|
id: 15,
|
||||||
client: {id: 101, name: 'Bruce wayne'},
|
client: {id: 101, name: 'Bruce wayne'},
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $http, $state, $translate, vnApp) {
|
|
||||||
this.$ = $scope;
|
|
||||||
this.$http = $http;
|
|
||||||
this.$state = $state;
|
|
||||||
this.$stateParams = $state.params;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
get ticket() {
|
get ticket() {
|
||||||
return this._ticket;
|
return this._ticket;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +29,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
setDefaultParams() {
|
setDefaultParams() {
|
||||||
const path = `Dms/${this.$stateParams.dmsId}`;
|
const path = `Dms/${this.$params.dmsId}`;
|
||||||
this.$http.get(path).then(res => {
|
this.$http.get(path).then(res => {
|
||||||
const dms = res.data && res.data;
|
const dms = res.data && res.data;
|
||||||
this.dms = {
|
this.dms = {
|
||||||
|
@ -54,7 +46,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
const query = `dms/${this.$stateParams.dmsId}/updateFile`;
|
const query = `dms/${this.$params.dmsId}/updateFile`;
|
||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: query,
|
url: query,
|
||||||
|
@ -92,8 +84,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$http', '$state', '$translate', 'vnApp'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketDmsEdit', {
|
ngModule.component('vnTicketDmsEdit', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -5,16 +5,16 @@ describe('Ticket', () => {
|
||||||
let controller;
|
let controller;
|
||||||
let $scope;
|
let $scope;
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
let $state;
|
|
||||||
|
|
||||||
beforeEach(ngModule('ticket'));
|
beforeEach(ngModule('ticket'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$state = {params: {dmsId: 1}};
|
const $element = angular.element('<vn-ticket-dms-edit></vn-ticket-dms-edit>');
|
||||||
controller = $componentController('vnTicketDmsEdit', {$scope, $state});
|
controller = $componentController('vnTicketDmsEdit', {$element});
|
||||||
controller._ticket = {id: 1, ticketFk: 16};
|
controller._ticket = {id: 1, ticketFk: 16};
|
||||||
|
controller.$params = {dmsId: 1};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('ticket() setter', () => {
|
describe('ticket() setter', () => {
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
title="{{'Download file' | translate}}"
|
title="{{'Download file' | translate}}"
|
||||||
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.vnToken.token}}">
|
||||||
{{::document.dms.file}}
|
{{::document.dms.file}}
|
||||||
</a>
|
</a>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.vnToken.token}}">
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
icon="cloud_download"
|
icon="cloud_download"
|
||||||
title="{{'Download file' | translate}}">
|
title="{{'Download file' | translate}}">
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($stateParams, $scope, $http, $translate, vnToken, vnApp) {
|
constructor($element, $) {
|
||||||
this.$stateParams = $stateParams;
|
super($element, $);
|
||||||
this.$ = $scope;
|
|
||||||
this.$http = $http;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.accessToken = vnToken.token;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.filter = {
|
this.filter = {
|
||||||
include: {
|
include: {
|
||||||
relation: 'dms',
|
relation: 'dms',
|
||||||
|
@ -71,8 +67,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnToken', 'vnApp'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketDmsIndex', {
|
ngModule.component('vnTicketDmsIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -4,17 +4,16 @@ import crudModel from 'core/mocks/crud-model';
|
||||||
describe('Ticket', () => {
|
describe('Ticket', () => {
|
||||||
describe('Component vnTicketDmsIndex', () => {
|
describe('Component vnTicketDmsIndex', () => {
|
||||||
let $componentController;
|
let $componentController;
|
||||||
let $scope;
|
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
let controller;
|
let controller;
|
||||||
|
|
||||||
beforeEach(ngModule('ticket'));
|
beforeEach(ngModule('ticket'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_) => {
|
beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_) => {
|
||||||
$componentController = _$componentController_;
|
$componentController = _$componentController_;
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$scope = $rootScope.$new();
|
const $element = angular.element('<vn-ticket-dms-index></vn-ticket-dms-index>');
|
||||||
controller = $componentController('vnTicketDmsIndex', {$: $scope});
|
controller = $componentController('vnTicketDmsIndex', {$element});
|
||||||
controller.$.model = crudModel;
|
controller.$.model = crudModel;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="Expeditions/filter"
|
url="Expeditions/filter"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="expeditions"
|
data="expeditions"
|
||||||
order="created DESC"
|
order="created DESC"
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $stateParams, $http) {
|
|
||||||
this.$ = $scope;
|
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
this.$http = $http;
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteExpedition(expedition) {
|
deleteExpedition(expedition) {
|
||||||
this.expeditionId = expedition.id;
|
this.expeditionId = expedition.id;
|
||||||
this.$.deleteExpedition.show();
|
this.$.deleteExpedition.show();
|
||||||
|
@ -51,8 +46,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$stateParams', '$http'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketExpedition', {
|
ngModule.component('vnTicketExpedition', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -4,19 +4,18 @@ describe('Ticket', () => {
|
||||||
describe('Component vnTicketExpedition', () => {
|
describe('Component vnTicketExpedition', () => {
|
||||||
let controller;
|
let controller;
|
||||||
let $scope;
|
let $scope;
|
||||||
let $state;
|
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
|
|
||||||
beforeEach(ngModule('ticket'));
|
beforeEach(ngModule('ticket'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||||
$state = _$state_;
|
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
$scope.model = {
|
$scope.model = {
|
||||||
refresh: () => {}
|
refresh: () => {}
|
||||||
};
|
};
|
||||||
controller = $componentController('vnTicketExpedition', {$state, $scope});
|
const $element = angular.element('<vn-ticket-expedition></vn-ticket-expedition>');
|
||||||
|
controller = $componentController('vnTicketExpedition', {$element, $scope});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('returnDialog()', () => {
|
describe('returnDialog()', () => {
|
||||||
|
|
|
@ -1,17 +1,9 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
import UserError from 'core/lib/user-error';
|
import UserError from 'core/lib/user-error';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
export default class Controller {
|
export default class Controller extends Section {
|
||||||
constructor($scope, $state, $stateParams, $translate, $http) {
|
|
||||||
this.$ = $scope;
|
|
||||||
this.$http = $http;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
this.$state = $state;
|
|
||||||
this.selectedTicket = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
openBalanceDialog() {
|
openBalanceDialog() {
|
||||||
const checkedTickets = this.checked;
|
const checkedTickets = this.checked;
|
||||||
const description = [];
|
const description = [];
|
||||||
|
@ -147,8 +139,6 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$state', '$stateParams', '$translate', '$http'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketIndex', {
|
ngModule.component('vnTicketIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
|
|
|
@ -23,7 +23,8 @@ describe('Component vnTicketIndex', () => {
|
||||||
|
|
||||||
beforeEach(inject(($componentController, _$window_) => {
|
beforeEach(inject(($componentController, _$window_) => {
|
||||||
$window = _$window_;
|
$window = _$window_;
|
||||||
controller = $componentController('vnTicketIndex');
|
const $element = angular.element('<vn-ticket-index></vn-ticket-index>');
|
||||||
|
controller = $componentController('vnTicketIndex', {$element});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('compareDate()', () => {
|
describe('compareDate()', () => {
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
class Controller {
|
|
||||||
constructor($scope, $stateParams) {
|
|
||||||
this.$scope = $scope;
|
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$stateParams'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketLog', {
|
ngModule.component('vnTicketLog', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Section,
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="TicketObservations"
|
url="TicketObservations"
|
||||||
fields="['id', 'ticketFk', 'observationTypeFk', 'description']"
|
fields="['id', 'ticketFk', 'observationTypeFk', 'description']"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
data="observations"
|
data="observations"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
|
|
|
@ -1,22 +1,15 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($stateParams, $scope) {
|
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
this.$scope = $scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.$scope.watcher.check();
|
this.$.watcher.check();
|
||||||
this.$scope.model.save().then(() => {
|
this.$.model.save().then(() =>
|
||||||
this.$scope.watcher.notifySaved();
|
this.$.watcher.notifySaved()
|
||||||
this.$scope.model.refresh();
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$stateParams', '$scope'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketObservation', {
|
ngModule.component('vnTicketObservation', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="TicketPackagings"
|
url="TicketPackagings"
|
||||||
fields="['id', 'ticketFk', 'packagingFk', 'quantity', 'created']"
|
fields="['id', 'ticketFk', 'packagingFk', 'quantity', 'created']"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
data="packages"
|
data="packages"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $stateParams) {
|
|
||||||
this.$scope = $scope;
|
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
add() {
|
add() {
|
||||||
this.$scope.model.insert({
|
this.$.model.insert({
|
||||||
packagingFk: null,
|
packagingFk: null,
|
||||||
quantity: null,
|
quantity: null,
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
|
@ -16,16 +12,13 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.$scope.watcher.check();
|
this.$.watcher.check();
|
||||||
this.$scope.model.save().then(() => {
|
this.$.model.save().then(() =>
|
||||||
this.$scope.watcher.notifySaved();
|
this.$.watcher.notifySaved()
|
||||||
this.$scope.model.refresh();
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$stateParams'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketPackage', {
|
ngModule.component('vnTicketPackage', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="sales"
|
url="sales"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="sales"
|
data="sales"
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $stateParams, $http) {
|
constructor($element, $) {
|
||||||
this.$scope = $scope;
|
super($element, $);
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
this.$http = $http;
|
|
||||||
this.filter = {
|
this.filter = {
|
||||||
include: {
|
include: {
|
||||||
relation: 'item',
|
relation: 'item',
|
||||||
|
@ -16,18 +15,16 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, itemFk) {
|
showDescriptor(event, itemFk) {
|
||||||
this.$scope.descriptor.itemFk = itemFk;
|
this.$.descriptor.itemFk = itemFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.descriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.descriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
onDescriptorLoad() {
|
||||||
this.$scope.popover.relocate();
|
this.$.popover.relocate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$stateParams', '$http'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketPicture', {
|
ngModule.component('vnTicketPicture', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
|
|
|
@ -1,24 +1,22 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($state, $scope) {
|
constructor($element, $) {
|
||||||
this.$ = $scope;
|
super($element, $);
|
||||||
this.$state = $state;
|
|
||||||
this.ticketRequest = {
|
this.ticketRequest = {
|
||||||
ticketFk: $state.params.id
|
ticketFk: this.$params.id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.$.watcher.submit().then(
|
this.$.watcher.submit().then(() =>
|
||||||
json => this.$state.go('ticket.card.request.index', {id: this.$state.params.id})
|
this.$state.go('ticket.card.request.index', {id: this.$params.id})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$state', '$scope'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketRequestCreate', {
|
ngModule.component('vnTicketRequestCreate', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
url="TicketRequests"
|
url="TicketRequests"
|
||||||
fields="['id', 'description', 'created', 'requesterFk', 'attenderFk', 'quantity', 'price', 'saleFk', 'isOk']"
|
fields="['id', 'description', 'created', 'requesterFk', 'attenderFk', 'quantity', 'price', 'saleFk', 'isOk']"
|
||||||
order="created ASC"
|
order="created ASC"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
data="purchaseRequests"
|
data="purchaseRequests"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $stateParams) {
|
constructor($element, $) {
|
||||||
this.$stateParams = $stateParams;
|
super($element, $);
|
||||||
this.$ = $scope;
|
|
||||||
this.filter = {
|
this.filter = {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ class Controller {
|
||||||
icon: 'icon-transaction',
|
icon: 'icon-transaction',
|
||||||
state: `item.card.diary({
|
state: `item.card.diary({
|
||||||
id: ${itemFk},
|
id: ${itemFk},
|
||||||
ticketFk: ${this.$stateParams.id}
|
ticketFk: ${this.$params.id}
|
||||||
})`,
|
})`,
|
||||||
tooltip: 'Item diary'
|
tooltip: 'Item diary'
|
||||||
}
|
}
|
||||||
|
@ -94,8 +94,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$stateParams'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketRequestIndex', {
|
ngModule.component('vnTicketRequestIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
|
|
|
@ -3,14 +3,12 @@ import './index';
|
||||||
describe('Ticket', () => {
|
describe('Ticket', () => {
|
||||||
describe('Component vnTicketRequestIndex', () => {
|
describe('Component vnTicketRequestIndex', () => {
|
||||||
let controller;
|
let controller;
|
||||||
let $scope;
|
|
||||||
|
|
||||||
beforeEach(ngModule('ticket'));
|
beforeEach(ngModule('ticket'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
beforeEach(angular.mock.inject($componentController => {
|
||||||
$scope = $rootScope.$new();
|
const $element = angular.element('<vn-ticket-request-index></vn-ticket-request-index>');
|
||||||
|
controller = $componentController('vnTicketRequestIndex', {$element});
|
||||||
controller = $componentController('vnTicketRequestIndex', {$scope});
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('getRequestState()', () => {
|
describe('getRequestState()', () => {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="sales"
|
url="sales"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="sales"
|
data="sales"
|
||||||
order="concept ASC"
|
order="concept ASC"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $stateParams) {
|
constructor($element, $) {
|
||||||
this.$scope = $scope;
|
super($element, $);
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
this.filter = {
|
this.filter = {
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'item'
|
relation: 'item'
|
||||||
|
@ -29,18 +29,16 @@ class Controller {
|
||||||
tooltip: 'Item diary'
|
tooltip: 'Item diary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$scope.descriptor.itemFk = itemFk;
|
this.$.descriptor.itemFk = itemFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.descriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.descriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
onDescriptorLoad() {
|
||||||
this.$scope.popover.relocate();
|
this.$.popover.relocate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$stateParams'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketSaleChecked', {
|
ngModule.component('vnTicketSaleChecked', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="SaleTrackings/listSaleTracking"
|
url="SaleTrackings/listSaleTracking"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="sales"
|
data="sales"
|
||||||
order="itemFk DESC"
|
order="itemFk DESC"
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $stateParams) {
|
|
||||||
this.$ = $scope;
|
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
showItemDescriptor(event, itemFk) {
|
showItemDescriptor(event, itemFk) {
|
||||||
this.quicklinks = {
|
this.quicklinks = {
|
||||||
btnThree: {
|
btnThree: {
|
||||||
|
@ -36,8 +32,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$stateParams'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketSaleTracking', {
|
ngModule.component('vnTicketSaleTracking', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Component from 'core/lib/component';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Component {
|
||||||
constructor($scope, $http, $state, vnApp, $translate) {
|
|
||||||
this.$scope = $scope;
|
|
||||||
this.$http = $http;
|
|
||||||
this.$state = $state;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.$translate = $translate;
|
|
||||||
}
|
|
||||||
|
|
||||||
set edit(value) {
|
set edit(value) {
|
||||||
this._edit = value;
|
this._edit = value;
|
||||||
this.clearDiscount();
|
this.clearDiscount();
|
||||||
|
@ -59,7 +52,7 @@ class Controller {
|
||||||
|
|
||||||
if (modified) {
|
if (modified) {
|
||||||
const params = {salesIds: salesIds, newDiscount: this.newDiscount};
|
const params = {salesIds: salesIds, newDiscount: this.newDiscount};
|
||||||
const query = `Tickets/${this.$state.params.id}/updateDiscount`;
|
const query = `Tickets/${this.$params.id}/updateDiscount`;
|
||||||
this.$http.post(query, params).then(() => {
|
this.$http.post(query, params).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
this.clearDiscount();
|
this.clearDiscount();
|
||||||
|
@ -79,8 +72,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$http', '$state', 'vnApp', '$translate'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketSaleEditDiscount', {
|
ngModule.component('vnTicketSaleEditDiscount', {
|
||||||
template: require('./editDiscount.html'),
|
template: require('./editDiscount.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<vn-crud-model auto-load="false"
|
<vn-crud-model auto-load="false"
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="Tickets/{{$ctrl.$stateParams.id}}/getSales"
|
url="Tickets/{{$ctrl.$params.id}}/getSales"
|
||||||
data="$ctrl.sales">
|
data="$ctrl.sales">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-watcher
|
<vn-watcher
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $state, $http, vnApp, $translate) {
|
constructor($element, $) {
|
||||||
this.$scope = $scope;
|
super($element, $);
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.$state = $state;
|
|
||||||
this.$stateParams = $state.params;
|
|
||||||
this.$http = $http;
|
|
||||||
this.edit = {};
|
this.edit = {};
|
||||||
this.moreOptions = [
|
this.moreOptions = [
|
||||||
{
|
{
|
||||||
|
@ -73,8 +69,8 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSubTotal() {
|
loadSubTotal() {
|
||||||
if (!this.$stateParams.id || !this.sales) return;
|
if (!this.$params.id || !this.sales) return;
|
||||||
this.$http.get(`Tickets/${this.$stateParams.id}/subtotal`).then(res => {
|
this.$http.get(`Tickets/${this.$params.id}/subtotal`).then(res => {
|
||||||
this.subtotal = res.data || 0.0;
|
this.subtotal = res.data || 0.0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -88,8 +84,8 @@ class Controller {
|
||||||
|
|
||||||
loadVAT() {
|
loadVAT() {
|
||||||
this.VAT = 0.0;
|
this.VAT = 0.0;
|
||||||
if (!this.$stateParams.id || !this.sales) return;
|
if (!this.$params.id || !this.sales) return;
|
||||||
this.$http.get(`Tickets/${this.$stateParams.id}/getVAT`).then(res => {
|
this.$http.get(`Tickets/${this.$params.id}/getVAT`).then(res => {
|
||||||
this.VAT = res.data || 0.0;
|
this.VAT = res.data || 0.0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -106,7 +102,7 @@ class Controller {
|
||||||
|
|
||||||
return (shouldShow && (option.always || this.isChecked));
|
return (shouldShow && (option.always || this.isChecked));
|
||||||
});
|
});
|
||||||
this.$scope.moreButton.data = options;
|
this.$.moreButton.data = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMoreChange(callback) {
|
onMoreChange(callback) {
|
||||||
|
@ -191,7 +187,7 @@ class Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.newInstances().length === 0)
|
if (this.newInstances().length === 0)
|
||||||
this.$scope.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
|
|
||||||
this.refreshTotal();
|
this.refreshTotal();
|
||||||
}
|
}
|
||||||
|
@ -211,7 +207,7 @@ class Controller {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
if (this.newInstances().length === 0)
|
if (this.newInstances().length === 0)
|
||||||
this.$scope.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,13 +230,13 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
showRemoveLinesDialog() {
|
showRemoveLinesDialog() {
|
||||||
this.$scope.deleteLines.show();
|
this.$.deleteLines.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
showTransferPopover(event) {
|
showTransferPopover(event) {
|
||||||
this.setTransferParams();
|
this.setTransferParams();
|
||||||
this.$scope.transfer.parent = event.target;
|
this.$.transfer.parent = event.target;
|
||||||
this.$scope.transfer.show();
|
this.$.transfer.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
setTransferParams() {
|
setTransferParams() {
|
||||||
|
@ -264,7 +260,7 @@ class Controller {
|
||||||
sales: this.transfer.sales
|
sales: this.transfer.sales
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$scope.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
|
|
||||||
const query = `tickets/${this.ticket.id}/transferSales`;
|
const query = `tickets/${this.ticket.id}/transferSales`;
|
||||||
this.$http.post(query, params).then(res => {
|
this.$http.post(query, params).then(res => {
|
||||||
|
@ -281,7 +277,7 @@ class Controller {
|
||||||
const sales = this.checkedLines();
|
const sales = this.checkedLines();
|
||||||
|
|
||||||
if (this.newInstances().length === 0)
|
if (this.newInstances().length === 0)
|
||||||
this.$scope.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
|
|
||||||
this.$http.post(`Claims/createFromSales`, {claim: claim, sales: sales}).then(res => {
|
this.$http.post(`Claims/createFromSales`, {claim: claim, sales: sales}).then(res => {
|
||||||
this.$state.go('claim.card.basicData', {id: res.data.id});
|
this.$state.go('claim.card.basicData', {id: res.data.id});
|
||||||
|
@ -312,13 +308,13 @@ class Controller {
|
||||||
tooltip: 'Item diary'
|
tooltip: 'Item diary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$scope.descriptor.itemFk = itemFk;
|
this.$.descriptor.itemFk = itemFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.descriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.descriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
onDescriptorLoad() {
|
||||||
this.$scope.popover.relocate();
|
this.$.popover.relocate();
|
||||||
}
|
}
|
||||||
|
|
||||||
showEditPricePopover(event, sale) {
|
showEditPricePopover(event, sale) {
|
||||||
|
@ -330,8 +326,8 @@ class Controller {
|
||||||
id: sale.id,
|
id: sale.id,
|
||||||
quantity: sale.quantity
|
quantity: sale.quantity
|
||||||
};
|
};
|
||||||
this.$scope.editPricePopover.parent = event.target;
|
this.$.editPricePopover.parent = event.target;
|
||||||
this.$scope.editPricePopover.show();
|
this.$.editPricePopover.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePrice() {
|
updatePrice() {
|
||||||
|
@ -342,11 +338,11 @@ class Controller {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
if (this.newInstances().length === 0)
|
if (this.newInstances().length === 0)
|
||||||
this.$scope.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$scope.editPricePopover.hide();
|
this.$.editPricePopover.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNewPrice() {
|
updateNewPrice() {
|
||||||
|
@ -364,23 +360,23 @@ class Controller {
|
||||||
price: sale.price,
|
price: sale.price,
|
||||||
discount: sale.discount
|
discount: sale.discount
|
||||||
}];
|
}];
|
||||||
this.$scope.editPopover.parent = event.target;
|
this.$.editPopover.parent = event.target;
|
||||||
this.$scope.editPopover.show();
|
this.$.editPopover.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
showEditDialog() {
|
showEditDialog() {
|
||||||
this.edit = this.checkedLines();
|
this.edit = this.checkedLines();
|
||||||
this.$scope.editDialog.show();
|
this.$.editDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
hideEditDialog() {
|
hideEditDialog() {
|
||||||
this.$scope.model.refresh();
|
this.$.model.refresh();
|
||||||
this.$scope.editDialog.hide();
|
this.$.editDialog.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
hideEditPopover() {
|
hideEditPopover() {
|
||||||
this.$scope.model.refresh();
|
this.$.model.refresh();
|
||||||
this.$scope.editPopover.hide();
|
this.$.editPopover.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -416,7 +412,7 @@ class Controller {
|
||||||
});
|
});
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
if (this.newInstances().length === 0)
|
if (this.newInstances().length === 0)
|
||||||
this.$scope.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,14 +445,14 @@ class Controller {
|
||||||
destination: phone,
|
destination: phone,
|
||||||
message: this.$translate.instant('Product not available', params)
|
message: this.$translate.instant('Product not available', params)
|
||||||
};
|
};
|
||||||
this.$scope.sms.open();
|
this.$.sms.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inserts a new instance
|
* Inserts a new instance
|
||||||
*/
|
*/
|
||||||
add() {
|
add() {
|
||||||
this.$scope.model.insert({});
|
this.$.model.insert({});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -481,11 +477,11 @@ class Controller {
|
||||||
this.$http.post(query, data).then(() => {
|
this.$http.post(query, data).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
this.$scope.model.refresh();
|
this.$.model.refresh();
|
||||||
throw e;
|
throw e;
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
if (this.newInstances().length === 0)
|
if (this.newInstances().length === 0)
|
||||||
this.$scope.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,11 +494,11 @@ class Controller {
|
||||||
this.$http.post(query, data).then(() => {
|
this.$http.post(query, data).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
this.$scope.model.refresh();
|
this.$.model.refresh();
|
||||||
throw e;
|
throw e;
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
if (this.newInstances().length === 0)
|
if (this.newInstances().length === 0)
|
||||||
this.$scope.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +528,7 @@ class Controller {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
if (this.newInstances().length === 0)
|
if (this.newInstances().length === 0)
|
||||||
this.$scope.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +555,7 @@ class Controller {
|
||||||
const query = `Sales/${sale.id}/recalculatePrice`;
|
const query = `Sales/${sale.id}/recalculatePrice`;
|
||||||
this.$http.post(query).then(res => {
|
this.$http.post(query).then(res => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
this.$scope.model.refresh();
|
this.$.model.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,8 +566,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketSale', {
|
ngModule.component('vnTicketSale', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -19,7 +19,8 @@ describe('Ticket', () => {
|
||||||
}};
|
}};
|
||||||
$state = _$state_;
|
$state = _$state_;
|
||||||
$state.params.id = 11;
|
$state.params.id = 11;
|
||||||
controller = $componentController('vnTicketSaleEditDiscount', {$scope, $state});
|
const $element = angular.element('<vn-ticket-sale-edit-discount></vn-ticket-sale-edit-discount>');
|
||||||
|
controller = $componentController('vnTicketSaleEditDiscount', {$element, $scope});
|
||||||
controller._edit = [{id: 3}];
|
controller._edit = [{id: 3}];
|
||||||
controller.onHide = () => {};
|
controller.onHide = () => {};
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -53,7 +53,8 @@ describe('Ticket', () => {
|
||||||
writable: false
|
writable: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
controller = $componentController('vnTicketSale', {$scope, $state});
|
const $element = angular.element('<vn-ticket-sale></vn-ticket-sale>');
|
||||||
|
controller = $componentController('vnTicketSale', {$element, $scope});
|
||||||
controller.card = {reload: () => {}};
|
controller.card = {reload: () => {}};
|
||||||
controller.ticket = ticket;
|
controller.ticket = ticket;
|
||||||
controller.sales = sales;
|
controller.sales = sales;
|
||||||
|
@ -196,12 +197,12 @@ describe('Ticket', () => {
|
||||||
|
|
||||||
describe('showSMSDialog()', () => {
|
describe('showSMSDialog()', () => {
|
||||||
it('should open an SMS dialog with specified data', () => {
|
it('should open an SMS dialog with specified data', () => {
|
||||||
jest.spyOn(controller.$scope.sms, 'open');
|
jest.spyOn(controller.$.sms, 'open');
|
||||||
|
|
||||||
controller.sales[0].checked = true;
|
controller.sales[0].checked = true;
|
||||||
controller.showSMSDialog();
|
controller.showSMSDialog();
|
||||||
|
|
||||||
expect(controller.$scope.sms.open).toHaveBeenCalledWith();
|
expect(controller.$.sms.open).toHaveBeenCalledWith();
|
||||||
expect(controller.newSMS.destination).toEqual(111111111);
|
expect(controller.newSMS.destination).toEqual(111111111);
|
||||||
expect(controller.newSMS.message).not.toEqual('');
|
expect(controller.newSMS.message).not.toEqual('');
|
||||||
});
|
});
|
||||||
|
@ -242,7 +243,7 @@ describe('Ticket', () => {
|
||||||
|
|
||||||
describe('updateQuantity()', () => {
|
describe('updateQuantity()', () => {
|
||||||
it('should make a POST query saving sale quantity', () => {
|
it('should make a POST query saving sale quantity', () => {
|
||||||
jest.spyOn(controller.$scope.watcher, 'updateOriginalData');
|
jest.spyOn(controller.$.watcher, 'updateOriginalData');
|
||||||
const data = {quantity: 10};
|
const data = {quantity: 10};
|
||||||
const sale = sales[0];
|
const sale = sales[0];
|
||||||
sale.quantity = 10;
|
sale.quantity = 10;
|
||||||
|
@ -256,13 +257,13 @@ describe('Ticket', () => {
|
||||||
controller.updateQuantity(sale);
|
controller.updateQuantity(sale);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$scope.watcher.updateOriginalData).toHaveBeenCalledWith();
|
expect(controller.$.watcher.updateOriginalData).toHaveBeenCalledWith();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('updateConcept()', () => {
|
describe('updateConcept()', () => {
|
||||||
it('should make a POST query saving sale concept', () => {
|
it('should make a POST query saving sale concept', () => {
|
||||||
jest.spyOn(controller.$scope.watcher, 'updateOriginalData');
|
jest.spyOn(controller.$.watcher, 'updateOriginalData');
|
||||||
const data = {newConcept: 'My new weapon'};
|
const data = {newConcept: 'My new weapon'};
|
||||||
const sale = sales[0];
|
const sale = sales[0];
|
||||||
sale.concept = 'My new weapon';
|
sale.concept = 'My new weapon';
|
||||||
|
@ -276,13 +277,13 @@ describe('Ticket', () => {
|
||||||
controller.updateConcept(sale);
|
controller.updateConcept(sale);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$scope.watcher.updateOriginalData).toHaveBeenCalledWith();
|
expect(controller.$.watcher.updateOriginalData).toHaveBeenCalledWith();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addSale()', () => {
|
describe('addSale()', () => {
|
||||||
it('should make a POST query adding a new sale', () => {
|
it('should make a POST query adding a new sale', () => {
|
||||||
jest.spyOn(controller.$scope.watcher, 'updateOriginalData');
|
jest.spyOn(controller.$.watcher, 'updateOriginalData');
|
||||||
const newSale = {itemFk: 4, quantity: 10};
|
const newSale = {itemFk: 4, quantity: 10};
|
||||||
const params = {itemId: 4, quantity: 10};
|
const params = {itemId: 4, quantity: 10};
|
||||||
|
|
||||||
|
@ -307,7 +308,7 @@ describe('Ticket', () => {
|
||||||
controller.addSale(newSale);
|
controller.addSale(newSale);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$scope.watcher.updateOriginalData).toHaveBeenCalledWith();
|
expect(controller.$.watcher.updateOriginalData).toHaveBeenCalledWith();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="TicketServices"
|
url="TicketServices"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
data="$ctrl.services"
|
data="$ctrl.services"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
import UserError from 'core/lib/user-error';
|
import UserError from 'core/lib/user-error';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($http, $scope, $stateParams, vnApp, $translate, $element) {
|
|
||||||
this.$http = $http;
|
|
||||||
this.$scope = $scope;
|
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.$element = $element;
|
|
||||||
this.services = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
|
this.services = [];
|
||||||
this.getDefaultTaxClass();
|
this.getDefaultTaxClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,10 +18,10 @@ class Controller {
|
||||||
|
|
||||||
add() {
|
add() {
|
||||||
if (this.defaultTaxClass) {
|
if (this.defaultTaxClass) {
|
||||||
this.$scope.model.insert({
|
this.$.model.insert({
|
||||||
taxClassFk: this.defaultTaxClass.id,
|
taxClassFk: this.defaultTaxClass.id,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
ticketFk: this.$stateParams.id
|
ticketFk: this.$params.id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +32,7 @@ class Controller {
|
||||||
|
|
||||||
newServiceTypeDialog(elementIndex, event) {
|
newServiceTypeDialog(elementIndex, event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.$scope.createServiceTypeDialog.show();
|
this.$.createServiceTypeDialog.show();
|
||||||
this.currentServiceIndex = elementIndex;
|
this.currentServiceIndex = elementIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,17 +48,15 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.$scope.watcher.check();
|
this.$.watcher.check();
|
||||||
|
|
||||||
this.$scope.model.save().then(() => {
|
this.$.model.save().then(() => {
|
||||||
this.$scope.watcher.notifySaved();
|
this.$.watcher.notifySaved();
|
||||||
this.$scope.model.refresh();
|
this.$.model.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$http', '$scope', '$stateParams', 'vnApp', '$translate', '$element'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketService', {
|
ngModule.component('vnTicketService', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
|
|
|
@ -3,21 +3,12 @@ import Component from 'core/lib/component';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller extends Component {
|
class Controller extends Component {
|
||||||
constructor($element, $scope, $http, $translate, vnApp) {
|
|
||||||
super($element, $scope);
|
|
||||||
|
|
||||||
this.$scope = $scope;
|
|
||||||
this.$http = $http;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
open() {
|
open() {
|
||||||
this.$scope.SMSDialog.show();
|
this.$.SMSDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
charactersRemaining() {
|
charactersRemaining() {
|
||||||
const element = this.$scope.message;
|
const element = this.$.message;
|
||||||
const value = element.input.value;
|
const value = element.input.value;
|
||||||
|
|
||||||
const maxLength = 160;
|
const maxLength = 160;
|
||||||
|
@ -49,8 +40,6 @@ class Controller extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$element', '$scope', '$http', '$translate', 'vnApp'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketSms', {
|
ngModule.component('vnTicketSms', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -4,17 +4,16 @@ describe('Ticket', () => {
|
||||||
describe('Component vnTicketSms', () => {
|
describe('Component vnTicketSms', () => {
|
||||||
let controller;
|
let controller;
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
let $element;
|
|
||||||
|
|
||||||
beforeEach(ngModule('ticket'));
|
beforeEach(ngModule('ticket'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
let $scope = $rootScope.$new();
|
let $scope = $rootScope.$new();
|
||||||
$element = angular.element('<vn-dialog></vn-dialog>');
|
const $element = angular.element('<vn-dialog></vn-dialog>');
|
||||||
controller = $componentController('vnTicketSms', {$element, $scope});
|
controller = $componentController('vnTicketSms', {$element, $scope});
|
||||||
controller.$params = {id: 11};
|
controller.$params = {id: 11};
|
||||||
controller.$scope.message = {
|
controller.$.message = {
|
||||||
input: {
|
input: {
|
||||||
value: 'My SMS'
|
value: 'My SMS'
|
||||||
}
|
}
|
||||||
|
@ -58,7 +57,7 @@ describe('Ticket', () => {
|
||||||
|
|
||||||
describe('charactersRemaining()', () => {
|
describe('charactersRemaining()', () => {
|
||||||
it('should return the characters remaining in a element', () => {
|
it('should return the characters remaining in a element', () => {
|
||||||
controller.$scope.message = {
|
controller.$.message = {
|
||||||
input: {
|
input: {
|
||||||
value: 'My message 0€'
|
value: 'My message 0€'
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $state, $http, vnApp, $translate) {
|
|
||||||
this.$scope = $scope;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.$http = $http;
|
|
||||||
this.$state = $state;
|
|
||||||
}
|
|
||||||
|
|
||||||
get ticket() {
|
get ticket() {
|
||||||
return this._ticket;
|
return this._ticket;
|
||||||
}
|
}
|
||||||
|
@ -46,9 +39,9 @@ class Controller {
|
||||||
tooltip: 'Route summary'
|
tooltip: 'Route summary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$scope.routeDescriptor.routeFk = this.summary.routeFk;
|
this.$.routeDescriptor.routeFk = this.summary.routeFk;
|
||||||
this.$scope.routeDescriptor.parent = event.target;
|
this.$.routeDescriptor.parent = event.target;
|
||||||
this.$scope.routeDescriptor.show();
|
this.$.routeDescriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, itemFk) {
|
showDescriptor(event, itemFk) {
|
||||||
|
@ -63,13 +56,13 @@ class Controller {
|
||||||
tooltip: 'Item diary'
|
tooltip: 'Item diary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$scope.descriptor.itemFk = itemFk;
|
this.$.descriptor.itemFk = itemFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.descriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.descriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
onDescriptorLoad() {
|
||||||
this.$scope.popover.relocate();
|
this.$.popover.relocate();
|
||||||
}
|
}
|
||||||
|
|
||||||
get isEditable() {
|
get isEditable() {
|
||||||
|
@ -83,10 +76,10 @@ class Controller {
|
||||||
setOkState() {
|
setOkState() {
|
||||||
let params = {};
|
let params = {};
|
||||||
|
|
||||||
if (this.$state.params.id)
|
if (this.$params.id)
|
||||||
params = {ticketFk: this.$state.params.id};
|
params = {ticketFk: this.$params.id};
|
||||||
|
|
||||||
if (!this.$state.params.id)
|
if (!this.$params.id)
|
||||||
params = {ticketFk: this.ticket.id};
|
params = {ticketFk: this.ticket.id};
|
||||||
|
|
||||||
params.code = 'OK';
|
params.code = 'OK';
|
||||||
|
@ -112,8 +105,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketSummary', {
|
ngModule.component('vnTicketSummary', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -9,7 +9,8 @@ describe('Ticket', () => {
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
controller = $componentController('vnTicketSummary');
|
const $element = angular.element('<vn-ticket-summary></vn-ticket-summary>');
|
||||||
|
controller = $componentController('vnTicketSummary', {$element});
|
||||||
controller.ticket = {id: 1};
|
controller.ticket = {id: 1};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $state, vnApp, $translate, $http) {
|
constructor($element, $) {
|
||||||
this.$http = $http;
|
super($element, $);
|
||||||
this.$ = $scope;
|
|
||||||
this.$state = $state;
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.ticket = {
|
this.ticket = {
|
||||||
ticketFk: $state.params.id
|
ticketFk: this.$params.id
|
||||||
};
|
};
|
||||||
this.params = {ticketFk: $state.params.id};
|
this.params = {ticketFk: this.$params.id};
|
||||||
}
|
}
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
|
@ -64,7 +61,6 @@ class Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controller.$inject = ['$scope', '$state', 'vnApp', '$translate', '$http'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketTrackingEdit', {
|
ngModule.component('vnTicketTrackingEdit', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -9,7 +9,8 @@ describe('Ticket', () => {
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $translate, vnApp) => {
|
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $translate, vnApp) => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
controller = $componentController('vnTicketTrackingEdit');
|
const $element = angular.element('<vn-ticket-tracking-edit></vn-ticket-tracking-edit>');
|
||||||
|
controller = $componentController('vnTicketTrackingEdit', {$element});
|
||||||
controller.ticket = {id: 1};
|
controller.ticket = {id: 1};
|
||||||
controller.$ = {watcher: {updateOriginalData: () => {}}};
|
controller.$ = {watcher: {updateOriginalData: () => {}}};
|
||||||
controller.card = {reload: () => {}};
|
controller.card = {reload: () => {}};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="TicketTrackings"
|
url="TicketTrackings"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="trackings"
|
data="trackings"
|
||||||
order="created DESC"
|
order="created DESC"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $stateParams) {
|
constructor($element, $) {
|
||||||
this.$ = $scope;
|
super($element, $);
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
this.filter = {
|
this.filter = {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -37,8 +37,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$stateParams'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketTrackingIndex', {
|
ngModule.component('vnTicketTrackingIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="sales"
|
url="sales"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
link="{ticketFk: $ctrl.$stateParams.id}"
|
link="{ticketFk: $ctrl.$params.id}"
|
||||||
data="$ctrl.sales"
|
data="$ctrl.sales"
|
||||||
limit="20">
|
limit="20">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-crud-model auto-load="true"
|
<vn-crud-model auto-load="true"
|
||||||
url="tickets/{{$ctrl.$stateParams.id}}/getVolume"
|
url="tickets/{{$ctrl.$params.id}}/getVolume"
|
||||||
data="$ctrl.volumes">
|
data="$ctrl.volumes">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<mg-ajax path="tickets/{{$ctrl.$stateParams.id}}/getTotalVolume" options="mgEdit"></mg-ajax>
|
<mg-ajax path="tickets/{{$ctrl.$params.id}}/getTotalVolume" options="mgEdit"></mg-ajax>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-card class="vn-pa-lg">
|
<vn-card class="vn-pa-lg">
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Section {
|
||||||
constructor($scope, $http, $stateParams) {
|
constructor($element, $) {
|
||||||
this.$scope = $scope;
|
super($element, $);
|
||||||
this.$http = $http;
|
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
this.filter = {
|
this.filter = {
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'item'
|
relation: 'item'
|
||||||
|
@ -34,7 +33,6 @@ class Controller {
|
||||||
if (value) this.applyVolumes();
|
if (value) this.applyVolumes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
applyVolumes() {
|
applyVolumes() {
|
||||||
if (!this.sales || !this.volumes) return;
|
if (!this.sales || !this.volumes) return;
|
||||||
|
|
||||||
|
@ -58,18 +56,16 @@ class Controller {
|
||||||
tooltip: 'Item diary'
|
tooltip: 'Item diary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$scope.descriptor.itemFk = itemFk;
|
this.$.descriptor.itemFk = itemFk;
|
||||||
this.$scope.descriptor.parent = event.target;
|
this.$.descriptor.parent = event.target;
|
||||||
this.$scope.descriptor.show();
|
this.$.descriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
onDescriptorLoad() {
|
||||||
this.$scope.popover.relocate();
|
this.$.popover.relocate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$http', '$stateParams'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketVolume', {
|
ngModule.component('vnTicketVolume', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
|
|
|
@ -19,7 +19,8 @@ describe('ticket', () => {
|
||||||
}};
|
}};
|
||||||
$state = _$state_;
|
$state = _$state_;
|
||||||
$state.params.id = 101;
|
$state.params.id = 101;
|
||||||
controller = $componentController('vnTicketVolume', {$scope, $httpBackend, $state});
|
const $element = angular.element('<vn-ticket-volume></vn-ticket-volume>');
|
||||||
|
controller = $componentController('vnTicketVolume', {$element, $scope});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('sales() setter', () => {
|
describe('sales() setter', () => {
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
export default class Controller {
|
export default class Controller extends Section {
|
||||||
constructor($scope, vnApp, $translate, $http) {
|
constructor($element, $) {
|
||||||
this.$ = $scope;
|
super($element, $);
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.$http = $http;
|
|
||||||
|
|
||||||
this.ticketSelected = null;
|
this.ticketSelected = null;
|
||||||
|
|
||||||
this.weekdays = [
|
this.weekdays = [
|
||||||
{id: 0, name: 'Monday'},
|
{id: 0, name: 'Monday'},
|
||||||
{id: 1, name: 'Tuesday'},
|
{id: 1, name: 'Tuesday'},
|
||||||
|
@ -40,7 +37,6 @@ export default class Controller {
|
||||||
this.$.model.clear();
|
this.$.model.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
showClientDescriptor(event, clientFk) {
|
showClientDescriptor(event, clientFk) {
|
||||||
this.$.clientDescriptor.clientFk = clientFk;
|
this.$.clientDescriptor.clientFk = clientFk;
|
||||||
this.$.clientDescriptor.parent = event.target;
|
this.$.clientDescriptor.parent = event.target;
|
||||||
|
@ -85,9 +81,6 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Controller.$inject = ['$scope', 'vnApp', '$translate', '$http'];
|
|
||||||
|
|
||||||
ngModule.component('vnTicketWeeklyIndex', {
|
ngModule.component('vnTicketWeeklyIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
|
|
Loading…
Reference in New Issue