refactor autocomplete
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2021-01-19 09:27:15 +01:00
parent 6acfe7f1cf
commit 49b0bca721
4 changed files with 18 additions and 8 deletions

View File

@ -149,6 +149,9 @@ export default class Autocomplete extends Field {
where: where
};
if (this.include)
filter.include = this.include;
let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`${this.url}?filter=${json}`).then(
json => this.onSelectionRequest(json.data),

View File

@ -33,7 +33,7 @@
value-field="id"
fields="['accountingTypeFk']"
include="{relation: 'accountingType'}"
ng-model="$ctrl.receipt.bankFk"
ng-model="$ctrl.bankFk"
search-function="{or: [{id: $search}, {bank: {like: '%'+ $search +'%'}}]}"
selection="$ctrl.bankSelection"
order="id"

View File

@ -7,9 +7,7 @@ class Controller extends Dialog {
this.receipt = {
payed: new Date(),
clientFk: this.$params.id,
companyFk: this.vnConfig.companyFk,
bankFk: this.vnConfig.bankFk
clientFk: this.$params.id
};
}
@ -17,10 +15,6 @@ class Controller extends Dialog {
this.receipt.payed = value;
}
set bankFk(value) {
this.receipt.bankFk = value;
}
set amountPaid(value) {
this.receipt.amountPaid = value;
}
@ -72,6 +66,17 @@ class Controller extends Dialog {
return this._deliveredAmount;
}
get bankFk() {
if (!this.receipt.bankFk)
this.receipt.bankFk = this.vnConfig.bankFk;
return this.receipt.bankFk;
}
set bankFk(value) {
this.receipt.bankFk = value;
}
accountShortToStandard(value) {
this.receipt.compensationAccount = value.replace('.', '0'.repeat(11 - value.length));
}

View File

@ -0,0 +1,2 @@
Compensation: Compensación
Cash: Efectivo