import ngModule from '../module';
import Section from 'salix/components/section';

export default class Controller extends Section {
    openSummary(client, event) {
        if (event.defaultPrevented) return;
        event.preventDefault();
        event.stopPropagation();

        this.clientSelected = client;
        this.$.dialogSummaryClient.show();
    }

    filterTickets(client, event) {
        if (event.defaultPrevented) return;
        event.preventDefault();
        event.stopPropagation();

        this.$state.go(`ticket.index`,
            {q: JSON.stringify({clientFk: client.id})});
    }
}

ngModule.vnComponent('vnClientIndex', {
    template: require('./index.html'),
    controller: Controller
});