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

58 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-05-31 06:21:16 +00:00
import ngModule from '../../../supplier/front/module';
import Section from 'salix/components/section';
class Controller extends Section {
constructor($element, $) {
super($element, $);
this.invoiceIn = {};
}
$onInit() {
if (this.$params && this.$params.supplierFk)
this.supplierFk = this.$params.supplierFk;
}
set invoiceIn(value) {
if (value)
this._invoiceIn = value;
}
get invoiceIn() {
return this._invoiceIn;
}
set supplierFk(value) {
this.invoiceIn.supplierFk = value;
}
get supplierFk() {
return this.invoiceIn.supplierFk;
}
set issued(value) {
this.invoiceIn.landed = value;
}
get issued() {
return this.invoiceIn.issued;
}
get warehouseFk() {
return this.invoiceIn.warehouseFk;
}
onSubmit() {
this.$http.post(`InvoicesIn/new`, this.invoiceIn).then(res => {
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$state.go('invoiceIn.summary', {id: res.data});
});
}
}
ngModule.vnComponent('vnInvoiceInCreate', {
template: require('./index.html'),
controller: Controller
});