mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #1047
This commit is contained in:
parent
17684a3ab3
commit
1fec7d6271
19
public/js/ff/accounts/reconcile.js
vendored
19
public/js/ff/accounts/reconcile.js
vendored
@ -36,10 +36,12 @@ $(function () {
|
|||||||
Respond to changes in balance statements.
|
Respond to changes in balance statements.
|
||||||
*/
|
*/
|
||||||
$('input[type="number"]').on('change', function () {
|
$('input[type="number"]').on('change', function () {
|
||||||
|
console.log('On change number input.');
|
||||||
if (reconcileStarted) {
|
if (reconcileStarted) {
|
||||||
calculateBalanceDifference();
|
calculateBalanceDifference();
|
||||||
difference = balanceDifference - selectedAmount;
|
difference = balanceDifference - selectedAmount;
|
||||||
updateDifference();
|
updateDifference();
|
||||||
|
|
||||||
}
|
}
|
||||||
changedBalances = true;
|
changedBalances = true;
|
||||||
});
|
});
|
||||||
@ -48,6 +50,7 @@ $(function () {
|
|||||||
Respond to changes in the date range.
|
Respond to changes in the date range.
|
||||||
*/
|
*/
|
||||||
$('input[type="date"]').on('change', function () {
|
$('input[type="date"]').on('change', function () {
|
||||||
|
console.log('On change date input.');
|
||||||
if (reconcileStarted) {
|
if (reconcileStarted) {
|
||||||
// hide original instructions.
|
// hide original instructions.
|
||||||
$('.select_transactions_instruction').hide();
|
$('.select_transactions_instruction').hide();
|
||||||
@ -67,16 +70,19 @@ $(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function storeReconcile() {
|
function storeReconcile() {
|
||||||
|
console.log('In storeReconcile.');
|
||||||
// get modal HTML:
|
// get modal HTML:
|
||||||
var ids = [];
|
var ids = [];
|
||||||
$.each($('.reconcile_checkbox:checked'), function (i, v) {
|
$.each($('.reconcile_checkbox:checked'), function (i, v) {
|
||||||
ids.push($(v).data('id'));
|
ids.push($(v).data('id'));
|
||||||
});
|
});
|
||||||
|
console.log('Ids is ' + ids);
|
||||||
var cleared = [];
|
var cleared = [];
|
||||||
$.each($('input[class="cleared"]'), function (i, v) {
|
$.each($('input[class="cleared"]'), function (i, v) {
|
||||||
var obj = $(v);
|
var obj = $(v);
|
||||||
cleared.push(obj.data('id'));
|
cleared.push(obj.data('id'));
|
||||||
});
|
});
|
||||||
|
console.log('Cleared is ' + ids);
|
||||||
|
|
||||||
var variables = {
|
var variables = {
|
||||||
startBalance: parseFloat($('input[name="start_balance"]').val()),
|
startBalance: parseFloat($('input[name="start_balance"]').val()),
|
||||||
@ -86,13 +92,12 @@ function storeReconcile() {
|
|||||||
transactions: ids,
|
transactions: ids,
|
||||||
cleared: cleared,
|
cleared: cleared,
|
||||||
};
|
};
|
||||||
|
console.log
|
||||||
var uri = overviewUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val());
|
var uri = overviewUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val());
|
||||||
|
|
||||||
|
|
||||||
$.getJSON(uri, variables).done(function (data) {
|
$.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
|
* @param e
|
||||||
*/
|
*/
|
||||||
function checkReconciledBox(e) {
|
function checkReconciledBox(e) {
|
||||||
|
console.log('In checkReconciledBox.');
|
||||||
var el = $(e.target);
|
var el = $(e.target);
|
||||||
var amount = parseFloat(el.val());
|
var amount = parseFloat(el.val());
|
||||||
// if checked, add to selected amount
|
// if checked, add to selected amount
|
||||||
@ -120,6 +126,7 @@ function checkReconciledBox(e) {
|
|||||||
* and put it in balanceDifference.
|
* and put it in balanceDifference.
|
||||||
*/
|
*/
|
||||||
function calculateBalanceDifference() {
|
function calculateBalanceDifference() {
|
||||||
|
console.log('In calculateBalanceDifference.');
|
||||||
var startBalance = parseFloat($('input[name="start_balance"]').val());
|
var startBalance = parseFloat($('input[name="start_balance"]').val());
|
||||||
var endBalance = parseFloat($('input[name="end_balance"]').val());
|
var endBalance = parseFloat($('input[name="end_balance"]').val());
|
||||||
balanceDifference = startBalance - endBalance;
|
balanceDifference = startBalance - endBalance;
|
||||||
@ -133,6 +140,7 @@ function calculateBalanceDifference() {
|
|||||||
* This more or less resets the reconciliation.
|
* This more or less resets the reconciliation.
|
||||||
*/
|
*/
|
||||||
function getTransactionsForRange() {
|
function getTransactionsForRange() {
|
||||||
|
console.log('In getTransactionsForRange.');
|
||||||
// clear out the box:
|
// clear out the box:
|
||||||
$('#transactions_holder').empty().append($('<p>').addClass('text-center').html('<i class="fa fa-fw fa-spin fa-spinner"></i>'));
|
$('#transactions_holder').empty().append($('<p>').addClass('text-center').html('<i class="fa fa-fw fa-spin fa-spinner"></i>'));
|
||||||
var uri = transactionsUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val());
|
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() {
|
function includeClearedTransactions() {
|
||||||
|
console.log('In includeClearedTransactions.');
|
||||||
$.each($('input[class="cleared"]'), function (i, v) {
|
$.each($('input[class="cleared"]'), function (i, v) {
|
||||||
var obj = $(v);
|
var obj = $(v);
|
||||||
if (obj.data('younger') === false) {
|
if (obj.data('younger') === false) {
|
||||||
@ -160,6 +169,7 @@ function includeClearedTransactions() {
|
|||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
function placeTransactions(data) {
|
function placeTransactions(data) {
|
||||||
|
console.log('In placeTransactions.');
|
||||||
$('#transactions_holder').empty().html(data.html);
|
$('#transactions_holder').empty().html(data.html);
|
||||||
selectedAmount = 0;
|
selectedAmount = 0;
|
||||||
// update start + end balance when user has not touched them.
|
// update start + end balance when user has not touched them.
|
||||||
@ -191,7 +201,7 @@ function placeTransactions(data) {
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function startReconcile() {
|
function startReconcile() {
|
||||||
|
console.log('In startReconcile.');
|
||||||
reconcileStarted = true;
|
reconcileStarted = true;
|
||||||
|
|
||||||
// hide the start button.
|
// hide the start button.
|
||||||
@ -213,6 +223,7 @@ function startReconcile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateDifference() {
|
function updateDifference() {
|
||||||
|
console.log('In updateDifference.');
|
||||||
var addClass = 'text-info';
|
var addClass = 'text-info';
|
||||||
if (difference > 0) {
|
if (difference > 0) {
|
||||||
addClass = 'text-success';
|
addClass = 'text-success';
|
||||||
|
Loading…
Reference in New Issue
Block a user