49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
|
import ngModule from '../module';
|
||
|
|
||
|
export default class Controller {
|
||
|
constructor($stateParams, $http) {
|
||
|
this.$http = $http;
|
||
|
this.$stateParams = $stateParams;
|
||
|
this.travel = null;
|
||
|
this.filter = {
|
||
|
where: {id: $stateParams.id},
|
||
|
include: [
|
||
|
{
|
||
|
relation: 'warehouseIn',
|
||
|
scope: {
|
||
|
fields: ['id', 'name']
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
relation: 'warehouseOut',
|
||
|
scope: {
|
||
|
fields: ['id', 'name']
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
}
|
||
|
|
||
|
$onInit() {
|
||
|
this.getCard();
|
||
|
}
|
||
|
|
||
|
getCard() {
|
||
|
const params = {filter: this.filter};
|
||
|
this.$http.get(`/api/Travels/${this.$stateParams.id}`, {params}).then(response => {
|
||
|
this.travel = response.data;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
reload() {
|
||
|
this.getCard();
|
||
|
}
|
||
|
}
|
||
|
Controller.$inject = ['$stateParams', '$http'];
|
||
|
|
||
|
ngModule.component('vnTravelCard', {
|
||
|
template: require('./index.html'),
|
||
|
controller: Controller
|
||
|
});
|
||
|
|