This commit is contained in:
parent
e380e4466c
commit
300dfc5772
|
@ -40,6 +40,11 @@
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-horizontal class="buttons">
|
<vn-horizontal class="buttons">
|
||||||
|
<vn-icon-button
|
||||||
|
ng-click="$ctrl.filterTickets(client, $event)"
|
||||||
|
vn-tooltip="Client tickets"
|
||||||
|
icon="icon-ticket">
|
||||||
|
</vn-icon-button>
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
ng-click="$ctrl.openSummary(client, $event)"
|
ng-click="$ctrl.openSummary(client, $event)"
|
||||||
vn-tooltip="Preview"
|
vn-tooltip="Preview"
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
|
||||||
export default class Controller {
|
export default class Controller {
|
||||||
constructor($scope, $stateParams) {
|
constructor($scope, $state) {
|
||||||
this.$ = $scope;
|
this.$ = $scope;
|
||||||
|
this.$state = $state;
|
||||||
this.clientSelected = null;
|
this.clientSelected = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +43,16 @@ export default class Controller {
|
||||||
this.clientSelected = client;
|
this.clientSelected = client;
|
||||||
this.$.dialogSummaryClient.show();
|
this.$.dialogSummaryClient.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterTickets(client, event) {
|
||||||
|
let state = `ticket.index`;
|
||||||
|
let params = {q: `{"clientFk": ${client.id}}`};
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
this.$state.go(state, params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Controller.$inject = ['$scope', '$stateParams'];
|
Controller.$inject = ['$scope', '$state'];
|
||||||
|
|
||||||
ngModule.component('vnClientIndex', {
|
ngModule.component('vnClientIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
import './index';
|
||||||
|
|
||||||
|
describe('Client index', () => {
|
||||||
|
let $scope;
|
||||||
|
let controller;
|
||||||
|
|
||||||
|
beforeEach(angular.mock.module('client', $translateProvider => {
|
||||||
|
$translateProvider.translations('en', {});
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(angular.mock.inject(($componentController, $rootScope, $state) => {
|
||||||
|
$scope = $rootScope.$new();
|
||||||
|
controller = $componentController('vnClientIndex', {$scope, $state});
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('x()', () => {
|
||||||
|
it('should request to patch the propagation of tax status', () => {
|
||||||
|
const client = {id: 101};
|
||||||
|
const event = {preventDefault: () => {}};
|
||||||
|
spyOn(event, 'preventDefault');
|
||||||
|
spyOn(controller.$state, 'go');
|
||||||
|
|
||||||
|
controller.filterTickets(client, event);
|
||||||
|
|
||||||
|
expect(event.preventDefault).toHaveBeenCalledWith();
|
||||||
|
expect(controller.$state.go).toHaveBeenCalledWith('ticket.index', jasmine.any(Object));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -2,4 +2,5 @@ Client id: Id cliente
|
||||||
Phone: Teléfono
|
Phone: Teléfono
|
||||||
Town/City: Ciudad
|
Town/City: Ciudad
|
||||||
Email: E-mail
|
Email: E-mail
|
||||||
View client: Ver cliente
|
View client: Ver cliente
|
||||||
|
Client tickets: Listado de tickets del cliente
|
Loading…
Reference in New Issue