salix/client/ticket/src/weekly/index.js

82 lines
2.4 KiB
JavaScript
Raw Normal View History

2018-10-30 13:57:22 +00:00
import ngModule from '../module';
import './style.scss';
export default class Controller {
constructor($scope, vnApp, $translate) {
2018-10-30 13:57:22 +00:00
this.$scope = $scope;
this.vnApp = vnApp;
this._ = $translate;
2018-10-30 13:57:22 +00:00
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']
2018-10-30 13:57:22 +00:00
}
}
}
},
{relation: 'warehouse'}
]
2018-10-30 13:57:22 +00:00
}
}
2018-10-30 13:57:22 +00:00
};
2018-10-30 13:57:22 +00:00
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!'));
2018-10-30 13:57:22 +00:00
}
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();
}
}
Controller.$inject = ['$scope', 'vnApp', '$translate'];
2018-10-30 13:57:22 +00:00
ngModule.component('vnTicketWeekly', {
template: require('./index.html'),
controller: Controller
});