salix/modules/ticket/front/weekly/create/index.js

50 lines
1.3 KiB
JavaScript
Raw Normal View History

2019-07-29 11:12:36 +00:00
import ngModule from '../../module';
export default class Controller {
constructor($scope, $state, $http, $translate, vnApp) {
this.$ = $scope;
this.$state = $state;
this.$http = $http;
this.$translate = $translate;
this.vnApp = vnApp;
this.ticketWeekly = {};
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'}
];
}
onChangeTicket(ticket) {
this.ticketWeekly.clientFk = ticket.clientFk;
this.ticketWeekly.warehouseFk = ticket.warehouseFk;
}
get clientSelection() {
return this._clientSelection;
}
set clientSelection(value) {
this._clientSelection = value;
if (value)
this.ticketWeekly.salesPersonFk = value.salesPersonFk;
}
onSubmit() {
return this.$.watcher.submit().then(
json => this.$state.go('ticket.weekly.index')
);
}
}
Controller.$inject = ['$scope', '$state', '$http', '$translate', 'vnApp'];
ngModule.component('vnTicketWeeklyCreate', {
template: require('./index.html'),
controller: Controller
});