33 lines
801 B
JavaScript
33 lines
801 B
JavaScript
import ngModule from '../module';
|
|
import Section from 'salix/components/section';
|
|
|
|
class Controller extends Section {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
this.botanical = {
|
|
itemFk: this.$params.id
|
|
};
|
|
}
|
|
|
|
_getBotanical() {
|
|
let filter = {
|
|
where: {itemFk: this.$params.id},
|
|
include: [{relation: 'genus'}, {relation: 'specie'}]
|
|
};
|
|
this.$http.get(`ItemBotanicals?filter=${JSON.stringify(filter)}`)
|
|
.then(res => {
|
|
if (res.data.length)
|
|
this.botanical = res.data[0];
|
|
});
|
|
}
|
|
|
|
$onInit() {
|
|
this._getBotanical();
|
|
}
|
|
}
|
|
|
|
ngModule.component('vnItemBotanical', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|