Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Juan Ferrer 2019-09-30 13:02:21 +02:00
commit c72381f9c1
4 changed files with 47 additions and 3 deletions

View File

@ -40,6 +40,11 @@
</vn-label-value>
</vn-one>
<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
ng-click="$ctrl.openSummary(client, $event)"
vn-tooltip="Preview"

View File

@ -1,8 +1,9 @@
import ngModule from '../module';
export default class Controller {
constructor($scope, $stateParams) {
constructor($scope, $state) {
this.$ = $scope;
this.$state = $state;
this.clientSelected = null;
}
@ -42,8 +43,16 @@ export default class Controller {
this.clientSelected = client;
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', {
template: require('./index.html'),

View File

@ -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));
});
});
});

View File

@ -2,4 +2,5 @@ Client id: Id cliente
Phone: Teléfono
Town/City: Ciudad
Email: E-mail
View client: Ver cliente
View client: Ver cliente
Client tickets: Listado de tickets del cliente