Some code cleanup.

This commit is contained in:
James Cole
2017-07-08 06:28:44 +02:00
parent de9728895e
commit 5ef2067836
53 changed files with 597 additions and 449 deletions

View File

@@ -69,13 +69,13 @@ function updateBudgetedAmounts(e) {
var spentAmount = parseFloat(spentCell.data('spent'));
var newAmountLeft = spentAmount + parseFloat(value);
var amountLeftString = accounting.formatMoney(newAmountLeft);
if(newAmountLeft < 0) {
if (newAmountLeft < 0) {
leftCell.html('<span class="text-danger">' + amountLeftString + '</span>');
}
if(newAmountLeft > 0) {
if (newAmountLeft > 0) {
leftCell.html('<span class="text-success">' + amountLeftString + '</span>');
}
if(newAmountLeft === 0.0) {
if (newAmountLeft === 0.0) {
leftCell.html('<span style="color:#999">' + amountLeftString + '</span>');
}

View File

@@ -25,6 +25,4 @@ $(function () {
pieChart(expenseExpenseUri, 'budget-expense-out');
});

View File

@@ -122,7 +122,7 @@ function convertForeignToNative() {
function updateNativeAmount(data) {
// if native amount is already filled in, even though we do this for the first time:
// don't overrule it.
if(countConversions === 0 && $('#ffInput_native_amount').val().length > 0) {
if (countConversions === 0 && $('#ffInput_native_amount').val().length > 0) {
countConversions++;
return;
}

View File

@@ -20,8 +20,8 @@ $(document).ready(function () {
$('#ffInput_amount').on('change', convertForeignToNative);
// respond to transfer changes:
$('#ffInput_source_account_id').on('change',validateCurrencyForTransfer);
$('#ffInput_destination_account_id').on('change',validateCurrencyForTransfer);
$('#ffInput_source_account_id').on('change', validateCurrencyForTransfer);
$('#ffInput_destination_account_id').on('change', validateCurrencyForTransfer);
// convert source currency to destination currency (slightly different routine for transfers)
$('#ffInput_source_amount').on('change', convertSourceToDestination);
@@ -64,7 +64,6 @@ function updateInitialPage() {
}
/**
* Get accountID based on some meta info.
*/

View File

@@ -139,10 +139,10 @@ function resetDivSplits() {
row.attr('data-split', i);
// add or remove class with bg thing
if(i % 2 === 0) {
if (i % 2 === 0) {
row.removeClass('bg-gray-light');
}
if(i % 2 === 1) {
if (i % 2 === 1) {
row.addClass('bg-gray-light');
}