mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix bar, also multi currency #2977
This commit is contained in:
24
public/v1/js/ff/budgets/index.js
vendored
24
public/v1/js/ff/budgets/index.js
vendored
@@ -133,10 +133,34 @@ function updateTotalBudgetedAmount(currencyId) {
|
||||
|
||||
// get new amount:
|
||||
$.get(totalBudgetedUri.replace('REPLACEME',currencyId)).done(function (data) {
|
||||
// set thing:
|
||||
$('span.budgeted_amount[data-currency="' + currencyId + '"]')
|
||||
.html(data.budgeted_formatted)
|
||||
// fade back:
|
||||
.fadeTo(300, 1.0);
|
||||
|
||||
// set bar:
|
||||
var pct = parseFloat(data.percentage);
|
||||
if (pct <= 100) {
|
||||
console.log('<100 (' + pct + ')');
|
||||
console.log($('div.budgeted_bar[data-currency="' + currencyId + '"]'));
|
||||
// red bar to 0
|
||||
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-danger').width('0%');
|
||||
// orange to 0:
|
||||
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-warning').width('0%');
|
||||
// blue to the rest:
|
||||
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-info').width(pct + '%');
|
||||
} else {
|
||||
var newPct = (100 / pct) * 100;
|
||||
// red bar to new pct
|
||||
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-danger').width(newPct + '%');
|
||||
// orange to the rest:
|
||||
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-warning').width((100 - newPct) + '%');
|
||||
// blue to 0:
|
||||
$('div.budgeted_bar[data-currency="' + currencyId + '"] div.progress-bar-info').width('0%');
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user