import ngModule from '../module'; import './style.scss'; export default class Controller { constructor($scope) { this.$scope = $scope; this.ticketSelected = null; this.filter = { include: [ {relation: 'ticket', scope: { fields: ['id', 'clientFk', 'companyFk', 'warehouseFk'], include: [ {relation: 'client', scope: { fields: ['salesPersonFk', 'name'], include: { relation: 'salesPerson', fields: ['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.$scope.watcher.notifySaved(); } 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(); } deleteWeekly(expedition) { this.expeditionId = expedition.id; this.$scope.deleteWeekly.show(); } onSubmit() { this.$scope.watcher.check(); this.$scope.model.save().then(() => { this.$scope.watcher.notifySaved(); this.$scope.model.refresh(); }); } } Controller.$inject = ['$scope']; ngModule.component('vnTicketWeekly', { template: require('./index.html'), controller: Controller });