This commit is contained in:
James Cole
2018-05-31 21:48:09 +02:00
parent f1fe90fce0
commit 34fd8cf751
4 changed files with 38 additions and 44 deletions

View File

@@ -33,12 +33,12 @@ $(document).ready(function () {
$.getJSON('json/expense-accounts').done(function (data) {
destAccounts = data;
$('input[name$="destination_account_name]"]').typeahead({source: destAccounts, autoSelect: false});
$('input[name$="destination_name]"]').typeahead({source: destAccounts, autoSelect: false});
});
$.getJSON('json/revenue-accounts').done(function (data) {
srcAccounts = data;
$('input[name$="source_account_name]"]').typeahead({source: srcAccounts, autoSelect: false});
$('input[name$="source_name]"]').typeahead({source: srcAccounts, autoSelect: false});
});
$.getJSON('json/categories').done(function (data) {
@@ -123,11 +123,11 @@ function cloneDivRow() {
source.find('input[name$="][amount]"]').val("").on('change', calculateBothSums);
source.find('input[name$="][foreign_amount]"]').val("").on('change', calculateBothSums);
if (destAccounts.length > 0) {
source.find('input[name$="destination_account_name]"]').typeahead({source: destAccounts, autoSelect: false});
source.find('input[name$="destination_name]"]').typeahead({source: destAccounts, autoSelect: false});
}
if (srcAccounts.length > 0) {
source.find('input[name$="source_account_name]"]').typeahead({source: srcAccounts, autoSelect: false});
source.find('input[name$="source_name]"]').typeahead({source: srcAccounts, autoSelect: false});
}
if (categories.length > 0) {
source.find('input[name$="category_name]"]').typeahead({source: categories, autoSelect: false});
@@ -186,12 +186,12 @@ function resetDivSplits() {
input.attr('name', 'transactions[' + i + '][transaction_description]');
});
// ends with ][destination_account_name]
$.each($('input[name$="][destination_account_name]"]'), function (i, v) {
$.each($('input[name$="][destination_name]"]'), function (i, v) {
var input = $(v);
input.attr('name', 'transactions[' + i + '][destination_account_name]');
});
// ends with ][source_account_name]
$.each($('input[name$="][source_account_name]"]'), function (i, v) {
$.each($('input[name$="][source_name]"]'), function (i, v) {
var input = $(v);
input.attr('name', 'transactions[' + i + '][source_account_name]');
});