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

52 lines
1.2 KiB
JavaScript

import ngModule from '../module';
import Section from 'salix/components/section';
class Controller extends Section {
constructor($element, $) {
super($element, $);
}
/*
get invoiceIn() {
return this._invoiceIn;
}
set invoiceIn(value) {
this._invoiceIn = value;
if (value) {
const filter = {
currency: this.invoiceIn.currency
}
this.$http.get(`ReferenceRates`, {filter})
.then(res => this.referenceRate = res.data);
}
}*/
add() {
const defaultExpenseFk = 6000000001;
this.$.model.insert({
invoiceIn: this.$params.id,
expenseFk: defaultExpenseFk
});
}
onSubmit() {
this.$.watcher.check();
this.$.model.save().then(() => {
this.$.watcher.notifySaved();
this.$.watcher.updateOriginalData();
this.card.reload();
});
}
}
ngModule.vnComponent('vnInvoiceInTax', {
template: require('./index.html'),
controller: Controller,
require: {
card: '^vnInvoiceInCard'
},
bindings: {
invoiceIn: '<'
}
});