mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-08 02:38:09 +00:00
Various code cleanup.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
/** global: budgetChartUri,budgetLimitID */
|
||||
/** global: budgetChartUri, expenseCategoryUri, expenseAssetUri, expenseExpenseUri */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
|
||||
@@ -13,10 +13,7 @@
|
||||
$(function () {
|
||||
"use strict";
|
||||
|
||||
console.log('Getting charts');
|
||||
columnChart(everything, 'category-everything');
|
||||
|
||||
console.log('Specific: ' + specific);
|
||||
columnChart(specific, 'specific-period');
|
||||
|
||||
});
|
||||
@@ -186,7 +186,6 @@ function doubleYNonStackedChart(URI, container) {
|
||||
*/
|
||||
function columnChart(URI, container) {
|
||||
"use strict";
|
||||
console.log('Going to draw column chart for ' + URI + ' in ' + container);
|
||||
var colorData = true;
|
||||
var options = $.extend(true, {}, defaultChartOptions);
|
||||
var chartType = 'bar';
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
/** global: zoomLevel, latitude, longitude, google, doPlaceMarker */
|
||||
|
||||
/*
|
||||
Some vars as prep for the map:
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
/** global: Modernizr, accountInfo, currencyInfo, accountInfo, transferInstructions, what */
|
||||
|
||||
$(document).ready(function () {
|
||||
"use strict";
|
||||
setCommonAutocomplete();
|
||||
@@ -73,7 +75,6 @@ function selectsForeignCurrency() {
|
||||
var nativeCurrencyId = parseInt(accountInfo[selectedAccountId].preferredCurrency);
|
||||
|
||||
if (foreignCurrencyId !== nativeCurrencyId) {
|
||||
console.log('User has selected currency #' + foreignCurrencyId + ' and this is different from native currency #' + nativeCurrencyId);
|
||||
|
||||
// the input where the native amount is entered gets the symbol for the native currency:
|
||||
$('.non-selectable-currency-symbol').text(currencyInfo[nativeCurrencyId].symbol);
|
||||
@@ -90,7 +91,6 @@ function selectsForeignCurrency() {
|
||||
|
||||
}
|
||||
if (foreignCurrencyId === nativeCurrencyId) {
|
||||
console.log('User has selected currency #' + foreignCurrencyId + ' and this is equal to native currency #' + nativeCurrencyId + ' (phew).');
|
||||
$('#exchange_rate_instruction_holder').hide();
|
||||
$('#native_amount_holder').hide();
|
||||
}
|
||||
@@ -110,7 +110,6 @@ function convertForeignToNative() {
|
||||
var date = $('#ffInput_date').val();
|
||||
var amount = $('#ffInput_amount').val();
|
||||
var uri = 'json/rate/' + foreignCurrencyCode + '/' + nativeCurrencyCode + '/' + date + '?amount=' + amount;
|
||||
console.log('Will grab ' + uri);
|
||||
$.get(uri).done(updateNativeAmount);
|
||||
}
|
||||
|
||||
@@ -119,8 +118,6 @@ function convertForeignToNative() {
|
||||
* @param data
|
||||
*/
|
||||
function updateNativeAmount(data) {
|
||||
console.log('Returned data:');
|
||||
console.log(data);
|
||||
$('#ffInput_native_amount').val(data.amount);
|
||||
}
|
||||
|
||||
@@ -158,12 +155,10 @@ function validateCurrencyForTransfer() {
|
||||
$('#source_amount_holder').show().find('.non-selectable-currency-symbol').text(sourceSymbol);
|
||||
|
||||
if (sourceCurrency === destinationCurrency) {
|
||||
console.log('Both accounts accept #' + sourceCurrency);
|
||||
$('#destination_amount_holder').hide();
|
||||
$('#amount_holder').hide();
|
||||
return;
|
||||
}
|
||||
console.log('Source accepts #' + sourceCurrency + ', destination #' + destinationCurrency);
|
||||
$('#ffInput_exchange_rate_instruction').text(getTransferExchangeInstructions());
|
||||
$('#exchange_rate_instruction_holder').show();
|
||||
$('input[name="source_amount"]').val($('input[name="amount"]').val());
|
||||
@@ -191,7 +186,6 @@ function convertSourceToDestination() {
|
||||
var amount = $('#ffInput_source_amount').val();
|
||||
$('#ffInput_amount').val(amount);
|
||||
var uri = 'json/rate/' + sourceCurrencyCode + '/' + destinationCurrencyCode + '/' + date + '?amount=' + amount;
|
||||
console.log('Will grab ' + uri);
|
||||
$.get(uri).done(updateDestinationAmount);
|
||||
}
|
||||
|
||||
@@ -200,7 +194,5 @@ function convertSourceToDestination() {
|
||||
* @param data
|
||||
*/
|
||||
function updateDestinationAmount(data) {
|
||||
console.log('Returned data:');
|
||||
console.log(data);
|
||||
$('#ffInput_destination_amount').val(data.amount);
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
/** global: what,Modernizr, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt, middleCrumbUrl,exchangeRateInstructions */
|
||||
/** global: currencyInfo, accountInfo, what,Modernizr, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt, middleCrumbUrl,exchangeRateInstructions, convertForeignToNative, convertSourceToDestination, selectsForeignCurrency, accountInfo */
|
||||
|
||||
$(document).ready(function () {
|
||||
"use strict";
|
||||
@@ -64,8 +64,6 @@ function updateNativeCurrency() {
|
||||
var newAccountId = getAccountId();
|
||||
var nativeCurrencyId = accountInfo[newAccountId].preferredCurrency;
|
||||
|
||||
console.log('User selected account #' + newAccountId + '. Native currency is #' + nativeCurrencyId);
|
||||
|
||||
$('.currency-option[data-id="' + nativeCurrencyId + '"]').click();
|
||||
$('[data-toggle="dropdown"]').parent().removeClass('open');
|
||||
if (what !== 'transfer') {
|
||||
@@ -107,6 +105,7 @@ function updateForm() {
|
||||
var srcName = $('#ffInput_source_account_name');
|
||||
|
||||
switch (what) {
|
||||
|
||||
case 'withdrawal':
|
||||
// show source_id and dest_name
|
||||
document.getElementById('source_account_id_holder').style.display = 'block';
|
||||
@@ -178,6 +177,8 @@ function updateForm() {
|
||||
}
|
||||
document.getElementById('piggy_bank_id_holder').style.display = showPiggies;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
updateNativeCurrency();
|
||||
}
|
||||
@@ -232,4 +233,5 @@ function getAccountId() {
|
||||
if (what === "deposit" || what === "transfer") {
|
||||
return $('select[name="destination_account_id"]').val();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
/** global: what, Modernizr */
|
||||
/** global: what, Modernizr, selectsForeignCurrency, convertForeignToNative, validateCurrencyForTransfer, convertSourceToDestination, journalData, journal, accountInfo, exchangeRateInstructions, currencyInfo */
|
||||
|
||||
$(document).ready(function () {
|
||||
"use strict";
|
||||
@@ -79,6 +79,7 @@ function getAccountId() {
|
||||
}
|
||||
|
||||
alert('Cannot handle ' + journal.transaction_type.type);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user