mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 12:43:57 -06:00
Expand fields.
This commit is contained in:
parent
ce191fa6d3
commit
e434de72a3
@ -8,9 +8,28 @@
|
||||
|
||||
/* globals globalSum */
|
||||
|
||||
var destAccounts = {};
|
||||
var srcAccounts = {};
|
||||
var categories = {};
|
||||
$(function () {
|
||||
"use strict";
|
||||
$('.btn-do-split').click(cloneRow);
|
||||
|
||||
$.getJSON('json/expense-accounts').done(function (data) {
|
||||
destAccounts = data;
|
||||
console.log('destAccounts length is now ' + destAccounts.length);
|
||||
});
|
||||
|
||||
$.getJSON('json/revenue-accounts').done(function (data) {
|
||||
srcAccounts = data;
|
||||
console.log('srcAccounts length is now ' + srcAccounts.length);
|
||||
});
|
||||
|
||||
$.getJSON('json/categories').done(function (data) {
|
||||
categories = data;
|
||||
console.log('categories length is now ' + categories.length);
|
||||
});
|
||||
|
||||
$('input[name="amount[]"]').on('input', calculateSum)
|
||||
});
|
||||
|
||||
@ -21,6 +40,19 @@ function cloneRow() {
|
||||
source.removeClass('initial-row');
|
||||
source.find('.count').text('#' + count);
|
||||
source.find('input[name="amount[]"]').val("").on('input', calculateSum);
|
||||
if (destAccounts.length > 0) {
|
||||
console.log('Will be able to extend dest-accounts.');
|
||||
source.find('input[name="destination_account_name[]"]').typeahead({source: destAccounts});
|
||||
}
|
||||
|
||||
if (destAccounts.length > 0) {
|
||||
console.log('Will be able to extend src-accounts.');
|
||||
source.find('input[name="source_account_name[]"]').typeahead({source: srcAccounts});
|
||||
}
|
||||
if(categories.length > 0) {
|
||||
console.log('Will be able to extend categories.');
|
||||
source.find('input[name="category[]"]').typeahead({source: categories});
|
||||
}
|
||||
|
||||
$('.split-table tbody').append(source);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user