mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 02:45:58 +00:00
Cleanup JS.
This commit is contained in:
@@ -22,7 +22,6 @@ function updateSingleRange(e) {
|
|||||||
var input = $(e.target);
|
var input = $(e.target);
|
||||||
var id = input.data('id');
|
var id = input.data('id');
|
||||||
var value = parseInt(input.val());
|
var value = parseInt(input.val());
|
||||||
|
|
||||||
var spent = parseFloat($('#spent-' + id).data('value'));
|
var spent = parseFloat($('#spent-' + id).data('value'));
|
||||||
|
|
||||||
// update small display:
|
// update small display:
|
||||||
@@ -33,12 +32,6 @@ function updateSingleRange(e) {
|
|||||||
|
|
||||||
// update the text:
|
// update the text:
|
||||||
$('#budget-description-' + id).text('Budgeted: ');
|
$('#budget-description-' + id).text('Budgeted: ');
|
||||||
|
|
||||||
//if(value < spent) {
|
|
||||||
// $('#budgeted-' + id).html('Budgeted: <span class="text-danger">\u20AC ' + value.toFixed(2) + '</span>');
|
|
||||||
//} else {
|
|
||||||
// $('#budgeted-' + id).html('Budgeted: <span class="text-success">\u20AC ' + value.toFixed(2) + '</span>');
|
|
||||||
//}
|
|
||||||
} else {
|
} else {
|
||||||
// hide the input:
|
// hide the input:
|
||||||
$('#budget-info-' + id + ' span').hide();
|
$('#budget-info-' + id + ' span').hide();
|
||||||
@@ -46,9 +39,8 @@ function updateSingleRange(e) {
|
|||||||
|
|
||||||
// update the text:
|
// update the text:
|
||||||
$('#budget-description-' + id).html('<em>No budget</em>');
|
$('#budget-description-' + id).html('<em>No budget</em>');
|
||||||
|
|
||||||
//$('#budgeted-' + id).html('<em>No budget</em>');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the range display text:
|
// update the range display text:
|
||||||
$('#budget-range-display-' + id).text('\u20AC ' + value.toFixed(2));
|
$('#budget-range-display-' + id).text('\u20AC ' + value.toFixed(2));
|
||||||
|
|
||||||
@@ -66,7 +58,6 @@ function updateSingleRange(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update or hide the bar, whichever is necessary.
|
// update or hide the bar, whichever is necessary.
|
||||||
|
|
||||||
updateTotal();
|
updateTotal();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -82,8 +73,9 @@ function updateTotal() {
|
|||||||
* Update total sum:
|
* Update total sum:
|
||||||
*/
|
*/
|
||||||
var totalAmount = parseInt($('#totalAmount').data('value'));
|
var totalAmount = parseInt($('#totalAmount').data('value'));
|
||||||
|
var pct;
|
||||||
if (sum <= totalAmount) {
|
if (sum <= totalAmount) {
|
||||||
var pct = sum / totalAmount * 100;
|
pct = sum / totalAmount * 100;
|
||||||
$('#progress-bar-default').css('width', pct + '%');
|
$('#progress-bar-default').css('width', pct + '%');
|
||||||
$('#progress-bar-warning').css('width', '0');
|
$('#progress-bar-warning').css('width', '0');
|
||||||
$('#progress-bar-danger').css('width', '0');
|
$('#progress-bar-danger').css('width', '0');
|
||||||
@@ -91,7 +83,7 @@ function updateTotal() {
|
|||||||
} else {
|
} else {
|
||||||
// we gaan er X overheen,
|
// we gaan er X overheen,
|
||||||
|
|
||||||
var pct = totalAmount / sum * 100;
|
pct = totalAmount / sum * 100;
|
||||||
var danger = 100 - pct;
|
var danger = 100 - pct;
|
||||||
var err = 100 - danger;
|
var err = 100 - danger;
|
||||||
$('#progress-bar-default').css('width', 0);
|
$('#progress-bar-default').css('width', 0);
|
||||||
|
Reference in New Issue
Block a user