mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix autocomplete.
This commit is contained in:
@@ -72,8 +72,6 @@ let transactions = function () {
|
|||||||
resetButton: true,
|
resetButton: true,
|
||||||
rulesButton: true,
|
rulesButton: true,
|
||||||
webhooksButton: true,
|
webhooksButton: true,
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// form behaviour during transaction
|
// form behaviour during transaction
|
||||||
@@ -85,7 +83,7 @@ let transactions = function () {
|
|||||||
|
|
||||||
// form data (except transactions) is stored in formData
|
// form data (except transactions) is stored in formData
|
||||||
formData: {
|
formData: {
|
||||||
defaultCurrency: null,
|
primaryCurrency: null,
|
||||||
enabledCurrencies: [],
|
enabledCurrencies: [],
|
||||||
primaryCurrencies: [],
|
primaryCurrencies: [],
|
||||||
foreignCurrencies: [],
|
foreignCurrencies: [],
|
||||||
@@ -200,8 +198,7 @@ let transactions = function () {
|
|||||||
// addedSplit, is called from the HTML
|
// addedSplit, is called from the HTML
|
||||||
// for source account
|
// for source account
|
||||||
const renderAccount = function (item, b, c) {
|
const renderAccount = function (item, b, c) {
|
||||||
console.log(item);
|
return item.name_with_balance + '<br><small class="text-muted">' + i18next.t('firefly.account_type_' + item.type) + '</small>';
|
||||||
return item.title + '<br><small class="text-muted">' + i18next.t('firefly.account_type_' + item.meta.type) + '</small>';
|
|
||||||
};
|
};
|
||||||
addAutocomplete({
|
addAutocomplete({
|
||||||
selector: 'input.ac-source',
|
selector: 'input.ac-source',
|
||||||
@@ -209,7 +206,7 @@ let transactions = function () {
|
|||||||
account_types: this.filters.source,
|
account_types: this.filters.source,
|
||||||
onRenderItem: renderAccount,
|
onRenderItem: renderAccount,
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
labelField: 'title',
|
labelField: 'name',
|
||||||
onChange: changeSourceAccount,
|
onChange: changeSourceAccount,
|
||||||
onSelectItem: selectSourceAccount
|
onSelectItem: selectSourceAccount
|
||||||
});
|
});
|
||||||
@@ -217,7 +214,7 @@ let transactions = function () {
|
|||||||
selector: 'input.ac-dest',
|
selector: 'input.ac-dest',
|
||||||
serverUrl: urls.account,
|
serverUrl: urls.account,
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
labelField: 'title',
|
labelField: 'name',
|
||||||
account_types: this.filters.destination,
|
account_types: this.filters.destination,
|
||||||
onRenderItem: renderAccount,
|
onRenderItem: renderAccount,
|
||||||
onChange: changeDestinationAccount,
|
onChange: changeDestinationAccount,
|
||||||
@@ -227,7 +224,7 @@ let transactions = function () {
|
|||||||
selector: 'input.ac-category',
|
selector: 'input.ac-category',
|
||||||
serverUrl: urls.category,
|
serverUrl: urls.category,
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
labelField: 'title',
|
labelField: 'name',
|
||||||
onChange: changeCategory,
|
onChange: changeCategory,
|
||||||
onSelectItem: changeCategory
|
onSelectItem: changeCategory
|
||||||
});
|
});
|
||||||
@@ -330,7 +327,7 @@ let transactions = function () {
|
|||||||
// load meta data.
|
// load meta data.
|
||||||
loadCurrencies().then(data => {
|
loadCurrencies().then(data => {
|
||||||
this.formStates.loadingCurrencies = false;
|
this.formStates.loadingCurrencies = false;
|
||||||
this.formData.defaultCurrency = data.defaultCurrency;
|
this.formData.primaryCurrency = data.primaryCurrency;
|
||||||
this.formData.enabledCurrencies = data.enabledCurrencies;
|
this.formData.enabledCurrencies = data.enabledCurrencies;
|
||||||
this.formData.primaryCurrencies = data.primaryCurrencies;
|
this.formData.primaryCurrencies = data.primaryCurrencies;
|
||||||
this.formData.foreignCurrencies = data.foreignCurrencies;
|
this.formData.foreignCurrencies = data.foreignCurrencies;
|
||||||
|
@@ -28,7 +28,7 @@ export function loadCurrencies() {
|
|||||||
let getter = new Get();
|
let getter = new Get();
|
||||||
return getter.list(params).then((response) => {
|
return getter.list(params).then((response) => {
|
||||||
let returnData = {
|
let returnData = {
|
||||||
defaultCurrency: {},
|
primaryCurrency: {},
|
||||||
primaryCurrencies: [],
|
primaryCurrencies: [],
|
||||||
foreignCurrencies: [],
|
foreignCurrencies: [],
|
||||||
enabledCurrencies: [],
|
enabledCurrencies: [],
|
||||||
@@ -46,13 +46,13 @@ export function loadCurrencies() {
|
|||||||
id: current.id,
|
id: current.id,
|
||||||
name: current.attributes.name,
|
name: current.attributes.name,
|
||||||
code: current.attributes.code,
|
code: current.attributes.code,
|
||||||
default: current.attributes.default,
|
primary: current.attributes.primary,
|
||||||
symbol: current.attributes.symbol,
|
symbol: current.attributes.symbol,
|
||||||
decimal_places: current.attributes.decimal_places,
|
decimal_places: current.attributes.decimal_places,
|
||||||
|
|
||||||
};
|
};
|
||||||
if (obj.default) {
|
if (obj.primary) {
|
||||||
returnData.defaultCurrency = obj;
|
returnData.primaryCurrency = obj;
|
||||||
}
|
}
|
||||||
returnData.enabledCurrencies.push(obj);
|
returnData.enabledCurrencies.push(obj);
|
||||||
returnData.primaryCurrencies.push(obj);
|
returnData.primaryCurrencies.push(obj);
|
||||||
|
Reference in New Issue
Block a user