mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Update the amount, not yet the bar #2977
This commit is contained in:
33
public/v1/js/ff/budgets/index.js
vendored
33
public/v1/js/ff/budgets/index.js
vendored
@@ -23,16 +23,10 @@
|
||||
*/
|
||||
$(function () {
|
||||
"use strict";
|
||||
|
||||
//$('.updateIncome').on('click', updateIncome);
|
||||
|
||||
/*
|
||||
On start, fill the "spent"-bar using the content from the page.
|
||||
*/
|
||||
//drawSpentBar();
|
||||
drawSpentBars();
|
||||
//drawBudgetedBar();
|
||||
|
||||
drawBudgetedBars();
|
||||
|
||||
$('.update_ab').on('click', updateAvailableBudget);
|
||||
@@ -45,8 +39,6 @@ $(function () {
|
||||
/*
|
||||
When the input changes, update the percentages for the budgeted bar:
|
||||
*/
|
||||
//$('input[type="number"]').on('change', updateBudgetedAmounts);
|
||||
|
||||
$('.selectPeriod').change(function (e) {
|
||||
var selected = $(e.currentTarget);
|
||||
if (selected.find(":selected").val() !== "x") {
|
||||
@@ -107,7 +99,8 @@ function updateBudgetedAmount(e) {
|
||||
if (data.left_per_day > 0) {
|
||||
$('.left_span[data-limit="0"][data-id="' + budgetId + '"]').html(data.left_formatted + '(' + data.left_per_day_formatted + ')');
|
||||
}
|
||||
//$('.left_span[data-limit="0"][data-id="' + budgetId + '"]').text('XXXXX');
|
||||
// update budgeted amount
|
||||
updateTotalBudgetedAmount(data.transaction_currency_id);
|
||||
|
||||
}).fail(function () {
|
||||
alert('I failed :(');
|
||||
@@ -118,10 +111,12 @@ function updateBudgetedAmount(e) {
|
||||
amount: input.val(),
|
||||
}).done(function (data) {
|
||||
input.prop('disabled', false);
|
||||
$('.left_span[data-limit="'+budgetLimitId+'"]').html(data.left_formatted);
|
||||
$('.left_span[data-limit="' + budgetLimitId + '"]').html(data.left_formatted);
|
||||
if (data.left_per_day > 0) {
|
||||
$('.left_span[data-limit="'+budgetLimitId+'"]').html(data.left_formatted + '(' + data.left_per_day_formatted + ')');
|
||||
$('.left_span[data-limit="' + budgetLimitId + '"]').html(data.left_formatted + '(' + data.left_per_day_formatted + ')');
|
||||
}
|
||||
updateTotalBudgetedAmount(data.transaction_currency_id);
|
||||
// update budgeted amount
|
||||
|
||||
}).fail(function () {
|
||||
alert('I failed :(');
|
||||
@@ -129,6 +124,22 @@ function updateBudgetedAmount(e) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateTotalBudgetedAmount(currencyId) {
|
||||
// fade info away:
|
||||
$('span.budgeted_amount[data-currency="' + currencyId + '"]')
|
||||
.fadeTo(100, 0.1, function () {
|
||||
//$(this).fadeTo(500, 1.0);
|
||||
});
|
||||
|
||||
// get new amount:
|
||||
$.get(totalBudgetedUri.replace('REPLACEME',currencyId)).done(function (data) {
|
||||
$('span.budgeted_amount[data-currency="' + currencyId + '"]')
|
||||
.html(data.budgeted_formatted)
|
||||
// fade back:
|
||||
.fadeTo(300, 1.0);
|
||||
});
|
||||
}
|
||||
|
||||
var fixHelper = function (e, tr) {
|
||||
"use strict";
|
||||
var $originals = tr.children();
|
||||
|
Reference in New Issue
Block a user