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

48 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-02-10 14:03:11 +00:00
import ngModule from '../module';
import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard {
reload() {
2021-04-12 10:43:17 +00:00
const filter = {
2021-04-12 14:32:13 +00:00
include: [
{
relation: 'supplier',
2022-10-24 13:15:23 +00:00
scope: {
include: {
relation: 'contacts',
scope: {
where: {
email: {neq: null},
}
}
2022-10-24 13:15:23 +00:00
}
}
},
2021-04-12 14:32:13 +00:00
{
relation: 'invoiceInDueDay'
},
{
relation: 'company'
2021-06-15 07:02:00 +00:00
},
{
relation: 'currency'
2021-04-12 14:32:13 +00:00
}
]};
2021-02-10 14:03:11 +00:00
2021-03-02 13:59:02 +00:00
this.$http.get(`InvoiceIns/${this.$params.id}`, {filter})
2021-04-12 14:32:13 +00:00
.then(res => {
this.invoiceIn = res.data;
this.invoiceIn.amount = res.data.invoiceInDueDay.reduce(
(accumulator, currentValue) => {
return accumulator + (currentValue['amount'] || 0);
}, 0);
});
2021-02-10 14:03:11 +00:00
}
}
2021-02-12 11:19:42 +00:00
ngModule.vnComponent('vnInvoiceInCard', {
2021-02-10 14:03:11 +00:00
template: require('./index.html'),
controller: Controller
});