This commit is contained in:
Sander Dorigo
2025-06-11 09:28:56 +02:00
parent e786bf47c2
commit 4f07b089d2
2 changed files with 10 additions and 1 deletions

View File

@@ -137,7 +137,6 @@ class IndexController extends Controller
// get all inactive budgets, and simply list them:
$inactive = $this->repository->getInactiveBudgets();
$defaultCurrency = $this->defaultCurrency;
return view(
'budgets.index',
compact(
@@ -225,6 +224,7 @@ class IndexController extends Controller
'start_date' => $limit->start_date->isoFormat($this->monthAndDayFormat),
'end_date' => $limit->end_date->isoFormat($this->monthAndDayFormat),
'in_range' => $limit->start_date->isSameDay($start) && $limit->end_date->isSameDay($end),
'total_days' => $limit->start_date->diffInDays($limit->end_date) + 1,
'currency_id' => $currency->id,
'currency_symbol' => $currency->symbol,
'currency_name' => $currency->name,

View File

@@ -339,6 +339,7 @@
{% if spentInfo.currency_id == budgetLimit.currency_id and budgetLimit.in_range %}
{# the code below is used for budget limits INSIDE the current view range. #}
{% set countLimit = countLimit + 1 %}
<span class="left_span" data-currency="{{ spentInfo.currency_id }}" data-limit="{{ budgetLimit.id }}"
data-value="{{ spentInfo.spent + budgetLimit.amount }}" class="amount_left">
{# the amount left is automatically calculated. #}
@@ -356,7 +357,9 @@
<br/>
{% endif %}
{% endfor %}
{% if countLimit == 0 %}
{# this code is used for budget limits OUTSIDE the current view range. #}
<span class="left_span" data-id="{{ budget.id }}" data-currency="{{ spentInfo.currency_id }}" data-limit="0"
class="amount_left" data-value="{{ spentInfo.spent }}">
@@ -366,7 +369,9 @@
{% endif %}
{% endfor %}
{% for budgetLimit in budget.budgeted %}
D
{% if null == budget.spent[budgetLimit.currency_id] %}
E
<span class="left_span" data-currency="{{ spentInfo.currency_id }}" data-limit="{{ budgetLimit.id }}"
data-value="{{ spentInfo.spent + budgetLimit.amount }}" class="amount_left">
{{ formatAmountBySymbol(budgetLimit.amount, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }}
@@ -377,6 +382,10 @@
({{ formatAmountBySymbol(budgetLimit.amount / activeDaysLeft, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }})
{% endif %}
{% endif %}
{% if not budgetLimit.in_range %}
{# For issue #10441, add per day if the budget limit is out of range. #}
({{ formatAmountBySymbol(budgetLimit.amount / budgetLimit.total_days, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }})
{% endif %}
</span>
<br/>
{% endif %}