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

59 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2018-07-18 12:21:58 +00:00
import ngModule from '../module';
2019-11-10 10:08:44 +00:00
import ModuleCard from 'salix/components/module-card';
2018-07-18 12:21:58 +00:00
2019-11-10 10:08:44 +00:00
class Controller extends ModuleCard {
reload() {
let filter = {
2018-07-18 12:21:58 +00:00
include: [
{
2019-11-10 10:08:44 +00:00
relation: 'agencyMode',
scope: {
fields: ['name']
}
2019-11-10 10:08:44 +00:00
}, {
relation: 'address',
scope: {
fields: ['nickname']
}
2019-11-10 10:08:44 +00:00
}, {
relation: 'rows',
scope: {
fields: ['id']
}
2019-11-10 10:08:44 +00:00
}, {
2018-07-18 12:21:58 +00:00
relation: 'client',
scope: {
2019-11-10 10:08:44 +00:00
fields: [
'salesPersonFk',
'name',
'isActive',
'isFreezed',
'isTaxDataChecked'
],
2018-07-18 12:21:58 +00:00
include: {
relation: 'salesPersonUser',
scope: {
fields: ['id', 'name']
}
2018-07-18 12:21:58 +00:00
}
}
}
]
};
2020-03-24 16:01:11 +00:00
return this.$q.all([
2019-11-10 10:08:44 +00:00
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);
2018-07-20 14:32:34 +00:00
});
2018-07-18 12:21:58 +00:00
}
}
ngModule.vnComponent('vnOrderCard', {
2018-07-18 12:21:58 +00:00
template: require('./index.html'),
controller: Controller
});