From 1fec7d6271e2cf0a3b35d6f6e24ac090c2b2cf41 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 9 Dec 2017 19:19:15 +0100 Subject: [PATCH] Fix #1047 --- public/js/ff/accounts/reconcile.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/public/js/ff/accounts/reconcile.js b/public/js/ff/accounts/reconcile.js index 6609efd287..4d01a0046e 100644 --- a/public/js/ff/accounts/reconcile.js +++ b/public/js/ff/accounts/reconcile.js @@ -36,10 +36,12 @@ $(function () { Respond to changes in balance statements. */ $('input[type="number"]').on('change', function () { + console.log('On change number input.'); if (reconcileStarted) { calculateBalanceDifference(); difference = balanceDifference - selectedAmount; updateDifference(); + } changedBalances = true; }); @@ -48,6 +50,7 @@ $(function () { Respond to changes in the date range. */ $('input[type="date"]').on('change', function () { + console.log('On change date input.'); if (reconcileStarted) { // hide original instructions. $('.select_transactions_instruction').hide(); @@ -67,16 +70,19 @@ $(function () { }); function storeReconcile() { + console.log('In storeReconcile.'); // get modal HTML: var ids = []; $.each($('.reconcile_checkbox:checked'), function (i, v) { ids.push($(v).data('id')); }); + console.log('Ids is ' + ids); var cleared = []; $.each($('input[class="cleared"]'), function (i, v) { var obj = $(v); cleared.push(obj.data('id')); }); + console.log('Cleared is ' + ids); var variables = { startBalance: parseFloat($('input[name="start_balance"]').val()), @@ -86,13 +92,12 @@ function storeReconcile() { transactions: ids, cleared: cleared, }; + console.log var uri = overviewUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val()); $.getJSON(uri, variables).done(function (data) { - if (data.is_zero === false) { - $('#defaultModal').empty().html(data.html).modal('show'); - } + $('#defaultModal').empty().html(data.html).modal('show'); }); } @@ -101,6 +106,7 @@ function storeReconcile() { * @param e */ function checkReconciledBox(e) { + console.log('In checkReconciledBox.'); var el = $(e.target); var amount = parseFloat(el.val()); // if checked, add to selected amount @@ -120,6 +126,7 @@ function checkReconciledBox(e) { * and put it in balanceDifference. */ function calculateBalanceDifference() { + console.log('In calculateBalanceDifference.'); var startBalance = parseFloat($('input[name="start_balance"]').val()); var endBalance = parseFloat($('input[name="end_balance"]').val()); balanceDifference = startBalance - endBalance; @@ -133,6 +140,7 @@ function calculateBalanceDifference() { * This more or less resets the reconciliation. */ function getTransactionsForRange() { + console.log('In getTransactionsForRange.'); // clear out the box: $('#transactions_holder').empty().append($('

').addClass('text-center').html('')); var uri = transactionsUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val()); @@ -147,6 +155,7 @@ function getTransactionsForRange() { * */ function includeClearedTransactions() { + console.log('In includeClearedTransactions.'); $.each($('input[class="cleared"]'), function (i, v) { var obj = $(v); if (obj.data('younger') === false) { @@ -160,6 +169,7 @@ function includeClearedTransactions() { * @param data */ function placeTransactions(data) { + console.log('In placeTransactions.'); $('#transactions_holder').empty().html(data.html); selectedAmount = 0; // update start + end balance when user has not touched them. @@ -191,7 +201,7 @@ function placeTransactions(data) { * @returns {boolean} */ function startReconcile() { - + console.log('In startReconcile.'); reconcileStarted = true; // hide the start button. @@ -213,6 +223,7 @@ function startReconcile() { } function updateDifference() { + console.log('In updateDifference.'); var addClass = 'text-info'; if (difference > 0) { addClass = 'text-success';