refactor
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Javi Gallego 2021-08-23 14:47:26 +02:00
parent cffe25d41f
commit 072f88d1a5
3 changed files with 28 additions and 35 deletions

View File

@ -7,15 +7,6 @@
data="$ctrl.supplierAccounts" data="$ctrl.supplierAccounts"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-crud-model
vn-id="model1"
url="PayMethods"
fields="['id']"
link="{code: 'wireTransfer'}"
include="$ctrl.include"
data="$ctrl.supplierAccounts"
auto-load="true">
</vn-crud-model>
<vn-watcher <vn-watcher
vn-id="watcher" vn-id="watcher"
data="$ctrl.supplierAccounts" data="$ctrl.supplierAccounts"
@ -24,29 +15,29 @@
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-lg"> <form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-lg">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg">
<vn-horizontal ng-repeat="supplierAccount in $ctrl.supplierAccounts"> <vn-horizontal ng-repeat="supplierAccount in $ctrl.supplierAccounts">
<vn-textfield vn-three <vn-textfield
ng-show="supplierAccount.iban || supplierAccount.iban == undefined" ng-show="supplierAccount.iban || supplierAccount.iban == undefined"
label="Iban" label="Iban"
ng-model="supplierAccount.iban" ng-model="supplierAccount.iban"
on-change="supplierAccount.bankEntityFk = supplierAccount.iban.slice(4,8)" on-change="supplierAccount.bankEntityFk = supplierAccount.iban.slice(4,8)"
rule> rule>
</vn-textfield> </vn-textfield>
<vn-autocomplete vn-three <vn-autocomplete
label="Bank entity" label="Bank entity"
ng-model="supplierAccount.bankEntityFk" ng-model="supplierAccount.bankEntityFk"
url="BankEntities" url="BankEntities"
show-field="name" show-field="name"
rule> rule>
<append>
<vn-icon-button
icon="add_circle"
vn-tooltip="New bank entity"
ng-click="$ctrl.showBankEntity($event, $index)"
tabindex="-1">
</vn-icon-button>
</append>
</vn-autocomplete> </vn-autocomplete>
<append> <vn-textfield
<vn-icon-button
icon="add_circle"
vn-tooltip="New bank entity"
ng-click="$ctrl.showBankEntity($event, $index)"
tabindex="-1">
</vn-icon-button>
</append>
<vn-textfield vn-three
label="Beneficiary" label="Beneficiary"
ng-model="supplierAccount.beneficiary" ng-model="supplierAccount.beneficiary"
info="Beneficiary information"> info="Beneficiary information">

View File

@ -52,19 +52,21 @@ class Controller extends Section {
}; };
const query = `Suppliers/${this.$params.id}`; const query = `Suppliers/${this.$params.id}`;
return this.$http.patch(query, values) return this.$http.patch(query, values)
.then(this.$.watcher.notifySaved()); .then(() => this.$.watcher.notifySaved());
} }
onSubmit() { onSubmit() {
this.$.watcher.check(); this.$.watcher.check();
this.$.model.save().then(() => { this.$.model.save()
if (this.supplier.payMethodFk != this.wireTransferFk) .then(() => {
this.$.payMethodToTransfer.show(); this.$.watcher.notifySaved();
this.$.watcher.updateOriginalData();
this.$.watcher.notifySaved(); return this.card.reload();
this.$.watcher.updateOriginalData(); })
this.card.reload(); .then(() => {
}); if (this.supplier.payMethodFk != this.wireTransferFk)
this.$.payMethodToTransfer.show();
});
} }
} }

View File

@ -37,7 +37,7 @@ class Controller extends ModuleCard {
} }
] ]
}; };
this.$http.get(`Suppliers/${this.$params.id}`, {filter}) return this.$http.get(`Suppliers/${this.$params.id}`, {filter})
.then(response => this.supplier = response.data); .then(response => this.supplier = response.data);
} }
} }