40 lines
999 B
JavaScript
40 lines
999 B
JavaScript
|
import ngModule from '../../module';
|
||
|
import Section from 'salix/components/section';
|
||
|
|
||
|
export default class Controller extends Section {
|
||
|
add() {
|
||
|
const filter = {
|
||
|
fields: ['etd']
|
||
|
};
|
||
|
this.$http.get(`Roadmaps/${this.$params.id}`, {filter})
|
||
|
.then(res => {
|
||
|
this.roadmap = res.data;
|
||
|
|
||
|
const eta = new Date(this.roadmap.etd);
|
||
|
eta.setDate(eta.getDate() + 1);
|
||
|
|
||
|
this.$.model.insert({
|
||
|
roadmapFk: this.$params.id,
|
||
|
eta: eta
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
onSubmit() {
|
||
|
this.$.watcher.check();
|
||
|
this.$.model.save().then(() => {
|
||
|
this.$.watcher.notifySaved();
|
||
|
this.$.watcher.updateOriginalData();
|
||
|
this.$.model.refresh();
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ngModule.component('vnRoadmapStops', {
|
||
|
template: require('./index.html'),
|
||
|
controller: Controller,
|
||
|
bindings: {
|
||
|
roadmap: '<'
|
||
|
}
|
||
|
});
|