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
17
public/js/ff/accounts/reconcile.js
vendored
17
public/js/ff/accounts/reconcile.js
vendored
@ -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');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -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($('<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());
|
||||
@ -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';
|
||||
|
Loading…
Reference in New Issue
Block a user