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"
auto-load="true">
</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-id="watcher"
data="$ctrl.supplierAccounts"
@ -24,29 +15,29 @@
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-lg">
<vn-card class="vn-pa-lg">
<vn-horizontal ng-repeat="supplierAccount in $ctrl.supplierAccounts">
<vn-textfield vn-three
ng-show="supplierAccount.iban || supplierAccount.iban == undefined"
label="Iban"
ng-model="supplierAccount.iban"
on-change="supplierAccount.bankEntityFk = supplierAccount.iban.slice(4,8)"
rule>
<vn-textfield
ng-show="supplierAccount.iban || supplierAccount.iban == undefined"
label="Iban"
ng-model="supplierAccount.iban"
on-change="supplierAccount.bankEntityFk = supplierAccount.iban.slice(4,8)"
rule>
</vn-textfield>
<vn-autocomplete vn-three
<vn-autocomplete
label="Bank entity"
ng-model="supplierAccount.bankEntityFk"
url="BankEntities"
show-field="name"
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>
<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-textfield vn-three
<vn-textfield
label="Beneficiary"
ng-model="supplierAccount.beneficiary"
info="Beneficiary information">

View File

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