salix/modules/travel/front/create/index.js

38 lines
879 B
JavaScript
Raw Normal View History

2019-12-09 11:15:19 +00:00
import ngModule from '../module';
import Section from 'salix/components/section';
class Controller extends Section {
2020-03-10 13:09:26 +00:00
constructor($element, $, $stateParams) {
super($element, $);
this.$stateParams = $stateParams;
this.travel = {};
}
$onChanges() {
if (this.$stateParams && this.$stateParams.q)
this._travel = JSON.parse(this.$stateParams.q);
}
get travel() {
return this._travel;
}
set travel(value) {
this._travel = value;
if (!value) return;
}
2019-12-09 11:15:19 +00:00
onSubmit() {
return this.$.watcher.submit().then(
res => this.$state.go('travel.card.summary', {id: res.data.id})
);
}
}
2020-03-10 13:09:26 +00:00
Controller.$inject = ['$element', '$scope', '$stateParams'];
2019-12-09 11:15:19 +00:00
ngModule.component('vnTravelCreate', {
template: require('./index.html'),
controller: Controller
});