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

36 lines
962 B
JavaScript
Raw Normal View History

2017-12-20 11:40:29 +00:00
import ngModule from '../module';
2020-03-17 13:43:46 +00:00
import Section from 'salix/components/section';
2017-12-20 11:40:29 +00:00
2020-03-17 13:43:46 +00:00
class Controller extends Section {
constructor($element, $) {
super($element, $);
this.fetchDefaultPriorityTag();
}
fetchDefaultPriorityTag() {
const filter = {fields: ['defaultPriority', 'defaultTag'], limit: 1};
this.$http.get(`ItemConfigs`, {filter})
.then(res => {
if (res.data) {
this.item = {
priority: res.data[0].defaultPriority,
tag: res.data[0].defaultTag
};
}
});
2017-12-20 11:40:29 +00:00
}
onSubmit() {
this.$.watcher.submit().then(
json => this.$state.go('item.card.basicData', {id: json.data.id})
2017-12-20 11:40:29 +00:00
);
}
}
2020-03-17 13:43:46 +00:00
Controller.$inject = ['$element', '$scope'];
2017-12-20 11:40:29 +00:00
ngModule.vnComponent('vnItemCreate', {
template: require('./index.html'),
controller: Controller
2017-12-20 11:40:29 +00:00
});