mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Clean up JS
This commit is contained in:
parent
bceffbc874
commit
e81865fce3
32
public/v1/js/ff/accounts/reconcile.js
vendored
32
public/v1/js/ff/accounts/reconcile.js
vendored
@ -36,9 +36,9 @@ $(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 type=number change.');
|
//console.log('On type=number change.');
|
||||||
if (reconcileStarted) {
|
if (reconcileStarted) {
|
||||||
console.log('Reconcile has started.');
|
//console.log('Reconcile has started.');
|
||||||
calculateBalanceDifference();
|
calculateBalanceDifference();
|
||||||
difference = balanceDifference - selectedAmount;
|
difference = balanceDifference - selectedAmount;
|
||||||
updateDifference();
|
updateDifference();
|
||||||
@ -51,9 +51,9 @@ $(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 type=date change.');
|
//console.log('On type=date change.');
|
||||||
if (reconcileStarted) {
|
if (reconcileStarted) {
|
||||||
console.log('Reconcile has started.');
|
//console.log('Reconcile has started.');
|
||||||
// hide original instructions.
|
// hide original instructions.
|
||||||
$('.select_transactions_instruction').hide();
|
$('.select_transactions_instruction').hide();
|
||||||
|
|
||||||
@ -98,38 +98,38 @@ function selectAllReconcile(e) {
|
|||||||
// if checked, add to selected amount
|
// if checked, add to selected amount
|
||||||
if (doCheck === true && check.data('younger') === false) {
|
if (doCheck === true && check.data('younger') === false) {
|
||||||
selectedAmount = selectedAmount - amount;
|
selectedAmount = selectedAmount - amount;
|
||||||
console.log('checked = true and younger = false so selected amount = ' + selectedAmount);
|
//console.log('checked = true and younger = false so selected amount = ' + selectedAmount);
|
||||||
localStorage.setItem(identifier, 'true');
|
localStorage.setItem(identifier, 'true');
|
||||||
}
|
}
|
||||||
if (doCheck === false && check.data('younger') === false) {
|
if (doCheck === false && check.data('younger') === false) {
|
||||||
selectedAmount = selectedAmount + amount;
|
selectedAmount = selectedAmount + amount;
|
||||||
console.log('checked = false and younger = false so selected amount = ' + selectedAmount);
|
//console.log('checked = false and younger = false so selected amount = ' + selectedAmount);
|
||||||
localStorage.setItem(identifier, 'false');
|
localStorage.setItem(identifier, 'false');
|
||||||
}
|
}
|
||||||
difference = balanceDifference - selectedAmount;
|
difference = balanceDifference - selectedAmount;
|
||||||
console.log('Difference is now ' + difference);
|
//console.log('Difference is now ' + difference);
|
||||||
});
|
});
|
||||||
|
|
||||||
updateDifference();
|
updateDifference();
|
||||||
}
|
}
|
||||||
|
|
||||||
function storeReconcile() {
|
function storeReconcile() {
|
||||||
console.log('in 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) {
|
||||||
var obj = $(v);
|
var obj = $(v);
|
||||||
if (obj.data('inrange') === true) {
|
if (obj.data('inrange') === true) {
|
||||||
console.log('Added item with amount to list of checked ' + obj.val());
|
//console.log('Added item with amount to list of checked ' + obj.val());
|
||||||
ids.push(obj.data('id'));
|
ids.push(obj.data('id'));
|
||||||
} else {
|
} else {
|
||||||
console.log('Ignored item with amount because is not in range ' + obj.val());
|
//console.log('Ignored item with amount because is not in range ' + obj.val());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var cleared = [];
|
var cleared = [];
|
||||||
$.each($('input[class="cleared"]'), function (i, v) {
|
$.each($('input[class="cleared"]'), function (i, v) {
|
||||||
var obj = $(v);
|
var obj = $(v);
|
||||||
console.log('Added item with amount to list of cleared ' + obj.val());
|
//console.log('Added item with amount to list of cleared ' + obj.val());
|
||||||
// todo here we need to check previous transactions etc.
|
// todo here we need to check previous transactions etc.
|
||||||
cleared.push(obj.data('id'));
|
cleared.push(obj.data('id'));
|
||||||
});
|
});
|
||||||
@ -160,20 +160,20 @@ function checkReconciledBox(e) {
|
|||||||
var amount = parseFloat(el.val());
|
var amount = parseFloat(el.val());
|
||||||
var journalId = parseInt(el.data('id'));
|
var journalId = parseInt(el.data('id'));
|
||||||
var identifier = 'checked_' + journalId;
|
var identifier = 'checked_' + journalId;
|
||||||
console.log('in checkReconciledBox(' + journalId + ') with amount ' + amount + ' and selected amount ' + selectedAmount);
|
//console.log('in checkReconciledBox(' + journalId + ') with amount ' + amount + ' and selected amount ' + selectedAmount);
|
||||||
// if checked, add to selected amount
|
// if checked, add to selected amount
|
||||||
if (el.prop('checked') === true && el.data('younger') === false) {
|
if (el.prop('checked') === true && el.data('younger') === false) {
|
||||||
selectedAmount = selectedAmount - amount;
|
selectedAmount = selectedAmount - amount;
|
||||||
console.log('checked = true and younger = false so selected amount = ' + selectedAmount);
|
//console.log('checked = true and younger = false so selected amount = ' + selectedAmount);
|
||||||
localStorage.setItem(identifier, 'true');
|
localStorage.setItem(identifier, 'true');
|
||||||
}
|
}
|
||||||
if (el.prop('checked') === false && el.data('younger') === false) {
|
if (el.prop('checked') === false && el.data('younger') === false) {
|
||||||
selectedAmount = selectedAmount + amount;
|
selectedAmount = selectedAmount + amount;
|
||||||
console.log('checked = false and younger = false so selected amount = ' + selectedAmount);
|
//console.log('checked = false and younger = false so selected amount = ' + selectedAmount);
|
||||||
localStorage.setItem(identifier, 'false');
|
localStorage.setItem(identifier, 'false');
|
||||||
}
|
}
|
||||||
difference = balanceDifference - selectedAmount;
|
difference = balanceDifference - selectedAmount;
|
||||||
console.log('Difference is now ' + difference);
|
//console.log('Difference is now ' + difference);
|
||||||
updateDifference();
|
updateDifference();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ function checkReconciledBox(e) {
|
|||||||
* and put it in balanceDifference.
|
* and put it in balanceDifference.
|
||||||
*/
|
*/
|
||||||
function calculateBalanceDifference() {
|
function calculateBalanceDifference() {
|
||||||
console.log('in 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;
|
||||||
|
Loading…
Reference in New Issue
Block a user