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

31 lines
777 B
JavaScript

import ngModule from '../module';
import Section from 'salix/components/section';
class Controller extends Section {
$onInit() {
this.invoiceIn = {};
if (this.$params && this.$params.supplierFk)
this.invoiceIn.supplierFk = this.$params.supplierFk;
this.invoiceIn.issued = Date.vnNew();
}
get companyFk() {
return this.invoiceIn.companyFk || this.vnConfig.companyFk;
}
set companyFk(value) {
this.invoiceIn.companyFk = value;
}
onSubmit() {
this.$.watcher.submit().then(
res => this.$state.go('invoiceIn.card.basicData', {id: res.data.id})
);
}
}
ngModule.vnComponent('vnInvoiceInCreate', {
template: require('./index.html'),
controller: Controller
});