salix/modules/entry/front/summary/index.js

39 lines
842 B
JavaScript
Raw Normal View History

2020-02-04 08:34:31 +00:00
import ngModule from '../module';
import './style.scss';
2020-11-23 12:41:51 +00:00
import Summary from 'salix/components/summary';
2020-02-04 08:34:31 +00:00
2020-11-23 12:41:51 +00:00
class Controller extends Summary {
2020-02-04 08:34:31 +00:00
get entry() {
return this._entry;
}
set entry(value) {
this._entry = value;
2020-09-09 09:39:18 +00:00
if (value && value.id) {
2020-02-25 09:39:21 +00:00
this.getEntryData();
2020-09-09 09:39:18 +00:00
this.getBuys();
}
2020-02-04 08:34:31 +00:00
}
2020-02-25 09:39:21 +00:00
getEntryData() {
2020-09-09 09:39:18 +00:00
return this.$http.get(`Entries/${this.entry.id}/getEntry`).then(response => {
2020-02-21 11:48:34 +00:00
this.entryData = response.data;
});
}
2020-09-09 09:39:18 +00:00
getBuys() {
return this.$http.get(`Entries/${this.entry.id}/getBuys`).then(response => {
this.buys = response.data;
});
}
2020-02-04 08:34:31 +00:00
}
ngModule.vnComponent('vnEntrySummary', {
2020-02-04 08:34:31 +00:00
template: require('./index.html'),
controller: Controller,
bindings: {
entry: '<'
}
});