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'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
relation: 'invoiceInDueDay'
|
2021-04-15 08:47:39 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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
|
|
|
|
});
|
|
|
|
|