38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
import ngModule from '../module';
|
|
import ModuleCard from 'salix/components/module-card';
|
|
|
|
class Controller extends ModuleCard {
|
|
reload() {
|
|
const filter = {
|
|
include: [
|
|
{
|
|
relation: 'supplier'
|
|
},
|
|
{
|
|
relation: 'invoiceInDueDay'
|
|
},
|
|
{
|
|
relation: 'company'
|
|
},
|
|
{
|
|
relation: 'currency'
|
|
}
|
|
]};
|
|
|
|
this.$http.get(`InvoiceIns/${this.$params.id}`, {filter})
|
|
.then(res => {
|
|
this.invoiceIn = res.data;
|
|
this.invoiceIn.amount = res.data.invoiceInDueDay.reduce(
|
|
(accumulator, currentValue) => {
|
|
return accumulator + (currentValue['amount'] || 0);
|
|
}, 0);
|
|
});
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnInvoiceInCard', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|
|
|