salix/modules/order/front/card/index.js

65 lines
2.0 KiB
JavaScript

import ngModule from '../module';
import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard {
reload() {
let filter = {
include: [
{
relation: 'agencyMode',
scope: {
fields: ['name']
}
}, {
relation: 'address',
scope: {
fields: ['nickname']
}
}, {
relation: 'rows',
scope: {
fields: ['id']
}
}, {
relation: 'client',
scope: {
fields: [
'salesPersonFk',
'name',
'isActive',
'isFreezed',
'isTaxDataChecked'
],
include: {
relation: 'salesPerson',
scope: {
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
}
}
}
]
};
return this.$q.all([
this.$http.get(`Orders/${this.$params.id}`, {filter})
.then(res => this.order = res.data),
this.$http.get(`Orders/${this.$params.id}/getTotal`)
.then(res => ({total: res.data}))
]).then(res => {
this.order = Object.assign.apply(null, res);
});
}
}
ngModule.component('vnOrderCard', {
template: require('./index.html'),
controller: Controller
});