33 lines
743 B
JavaScript
33 lines
743 B
JavaScript
import ngModule from '../module';
|
|
|
|
class Controller {
|
|
constructor($scope, $stateParams) {
|
|
this.$scope = $scope;
|
|
this.$stateParams = $stateParams;
|
|
}
|
|
|
|
add() {
|
|
this.$scope.model.insert({
|
|
packagingFk: null,
|
|
quantity: null,
|
|
created: new Date(),
|
|
ticketFk: this.$stateParams.id
|
|
});
|
|
}
|
|
|
|
onSubmit() {
|
|
this.$scope.watcher.check();
|
|
this.$scope.model.save().then(() => {
|
|
this.$scope.watcher.notifySaved();
|
|
this.$scope.model.refresh();
|
|
});
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$scope', '$stateParams'];
|
|
|
|
ngModule.component('vnTicketPackage', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|