Added autocomplete on bank entity
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Jorge Padawan 2021-02-17 12:07:04 +01:00
parent a2ad1887a4
commit f10092d2cf
3 changed files with 12 additions and 8 deletions

View File

@ -6,6 +6,7 @@ class Controller extends Component {
open() { open() {
this.$.bankEntityDialog.show(); this.$.bankEntityDialog.show();
} }
resetData() { resetData() {
this.data = {}; this.data = {};
} }
@ -15,9 +16,9 @@ class Controller extends Component {
if (!this.data.countryFk) if (!this.data.countryFk)
throw new Error(`The country can't be empty`); throw new Error(`The country can't be empty`);
this.$http.post(`bankEntities`, this.data).then(() => { this.$http.post(`bankEntities`, this.data).then(res => {
this.vnApp.showMessage(this.$t('The bank entity has been created. You can save the data now')); this.vnApp.showMessage(this.$t('The bank entity has been created. You can save the data now'));
this.emit('response', {$response: this.data}); this.emit('response', {$response: res.data});
}); });
} catch (e) { } catch (e) {
this.vnApp.showError(this.$t(e.message)); this.vnApp.showError(this.$t(e.message));

View File

@ -32,7 +32,7 @@
<vn-icon-button <vn-icon-button
icon="add_circle" icon="add_circle"
vn-tooltip="New bank entity" vn-tooltip="New bank entity"
ng-click="bankentity.open()"> ng-click="$ctrl.showBankEntity($event, $index)">
</vn-icon-button> </vn-icon-button>
</append> </append>
<vn-none> <vn-none>
@ -62,6 +62,6 @@
</form> </form>
<!-- New bankentity dialog --> <!-- New bankentity dialog -->
<vn-new-bank-entity <vn-new-bank-entity
vn-id="bankentity" vn-id="bankEntity"
on-response="$ctrl.onResponse($response)"> on-response="$ctrl.onResponse($response)">
</vn-new-bank-entity> </vn-new-bank-entity>

View File

@ -19,14 +19,17 @@ class Controller extends Section {
} }
onResponse(response) { onResponse(response) {
this.name = response.name; console.log(response);
console.log(this.name); const data = this.$.model.data;
const supplierAccount = data[this.currentRowIndex];
supplierAccount.bankEntityFk = response.id;
} }
showBankEntity(event) { showBankEntity(event, $index) {
if (event.defaultPrevented) return; if (event.defaultPrevented) return;
event.preventDefault(); event.preventDefault();
this.$.bankEntity.show(); this.currentRowIndex = $index;
this.$.bankEntity.open();
} }
onBankEntityAccept() { onBankEntityAccept() {