import ngModule from '../module'; import './style.scss'; export default class Controller { constructor($scope, vnApp, $translate) { this.$scope = $scope; this.vnApp = vnApp; this._ = $translate; this.ticketSelected = null; this.filter = { include: { relation: 'ticket', scope: { fields: ['id', 'clientFk', 'companyFk', 'warehouseFk'], include: [ { relation: 'client', scope: { fields: ['salesPersonFk', 'name'], include: { relation: 'salesPerson', scope: { fields: ['id', 'firstName', 'name'] } } } }, {relation: 'warehouse'} ] } } }; this.weekdays = [ {id: 0, name: 'Monday'}, {id: 1, name: 'Tuesday'}, {id: 2, name: 'Wednesday'}, {id: 3, name: 'Thursday'}, {id: 4, name: 'Friday'}, {id: 5, name: 'Saturday'}, {id: 6, name: 'Sunday'} ]; } onSave() { this.vnApp.showSuccess(this._.instant('Data saved!')); } showClientDescriptor(event, clientFk) { this.$scope.clientDescriptor.clientFk = clientFk; this.$scope.clientDescriptor.parent = event.target; this.$scope.clientDescriptor.show(); event.preventDefault(); event.stopImmediatePropagation(); } showTicketDescriptor(event, ticketFk) { this.$scope.ticketDescriptor.ticketFk = ticketFk; this.$scope.ticketDescriptor.parent = event.target; this.$scope.ticketDescriptor.show(); event.preventDefault(); event.stopImmediatePropagation(); } onDescriptorLoad() { this.$scope.popover.relocate(); } preventNavigation(event) { event.preventDefault(); event.stopImmediatePropagation(); } deleteWeekly(expedition) { this.expeditionId = expedition.id; this.$scope.deleteWeekly.show(); } } Controller.$inject = ['$scope', 'vnApp', '$translate']; ngModule.component('vnTicketWeekly', { template: require('./index.html'), controller: Controller });