50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
|
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
|
||
|
});
|