2021-01-07 14:14:38 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
import Section from 'salix/components/section';
|
|
|
|
|
|
|
|
class Controller extends Section {
|
|
|
|
constructor($element, $) {
|
|
|
|
super($element, $);
|
|
|
|
this.include = {
|
|
|
|
relation: 'bankEntity',
|
|
|
|
scope: {
|
|
|
|
fields: ['countryFk', 'id', 'name', 'bic']
|
|
|
|
}
|
|
|
|
};
|
2021-08-15 06:35:14 +00:00
|
|
|
const filter = {
|
|
|
|
where: {code: 'wireTransfer'}
|
|
|
|
};
|
|
|
|
|
|
|
|
this.$http.get(`payMethods/findOne`, {filter})
|
|
|
|
.then(res => {
|
|
|
|
this.wireTransferFk = res.data.id;
|
|
|
|
});
|
2021-01-07 14:14:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
add() {
|
|
|
|
this.$.model.insert({
|
|
|
|
supplierFk: this.$params.id
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-09-15 15:58:58 +00:00
|
|
|
onAccept(data) {
|
|
|
|
const accounts = this.supplierAccounts;
|
|
|
|
const targetAccount = accounts[data.index];
|
|
|
|
targetAccount.bankEntityFk = data.id;
|
2021-08-15 06:35:14 +00:00
|
|
|
}
|
|
|
|
|
2021-02-11 17:35:23 +00:00
|
|
|
onSubmit() {
|
|
|
|
this.$.watcher.check();
|
2021-09-08 07:44:46 +00:00
|
|
|
return this.$.model.save()
|
2021-08-23 12:47:26 +00:00
|
|
|
.then(() => {
|
|
|
|
this.$.watcher.notifySaved();
|
|
|
|
this.$.watcher.updateOriginalData();
|
|
|
|
return this.card.reload();
|
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
if (this.supplier.payMethodFk != this.wireTransferFk)
|
|
|
|
this.$.payMethodToTransfer.show();
|
|
|
|
});
|
2021-02-11 17:35:23 +00:00
|
|
|
}
|
2021-01-07 14:14:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ngModule.vnComponent('vnSupplierAccount', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
require: {
|
|
|
|
card: '^vnSupplierCard'
|
|
|
|
}
|
|
|
|
});
|