import ngModule from '../module';
import ModuleCard from 'salix/components/module-card';

class Controller extends ModuleCard {
    reload() {
        const filter = {
            fields: [
                'id',
                'ref',
                'issued',
                'amount',
                'clientFk',
                'companyFk'
            ],
            include: [
                {
                    relation: 'company',
                    scope: {
                        fields: ['id', 'code']
                    }
                }, {
                    relation: 'client',
                    scope: {
                        fields: ['id', 'socialName', 'name']
                    }
                }
            ]
        };

        this.$http.get(`InvoiceOuts/${this.$params.id}`, {filter})
            .then(res => this.invoiceOut = res.data);
    }
}

ngModule.vnComponent('vnInvoiceOutCard', {
    template: require('./index.html'),
    controller: Controller
});