47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
import ngModule from '../module';
|
|
import Section from 'salix/components/section';
|
|
|
|
class Controller extends Section {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
}
|
|
|
|
get setTaxRate() {
|
|
return this._setTaxRate;
|
|
}
|
|
|
|
set setTaxRate(selection) {
|
|
this._setTaxRate = selection;
|
|
const taxTypeSage = this.$.taxTypeSage.selection;
|
|
const taxableBase = this.$.taxableBase.value;
|
|
if (taxTypeSage && taxableBase)
|
|
this.taxRate = (taxTypeSage.rate / 100) * taxableBase;
|
|
}
|
|
|
|
add() {
|
|
this.$.model.insert({
|
|
invoiceIn: this.$params.id
|
|
});
|
|
}
|
|
|
|
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: '<'
|
|
}
|
|
});
|