mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Budget box is multi-currency.
This commit is contained in:
		| @@ -11,19 +11,74 @@ | ||||
|     </tr> | ||||
|     </thead> | ||||
|     <tbody> | ||||
|     {% set sum_budgeted = 0 %} | ||||
|     {% set sum_spent = 0 %} | ||||
|     {% set sum_left = 0 %} | ||||
|     {% set sum_overspent = 0 %} | ||||
|     {% for line in budgets %} | ||||
|     {% for budget in budgets.budgets %} | ||||
|         {% for row in budget.rows %} | ||||
|             <tr> | ||||
|                 <!-- budget name, always visible --> | ||||
|                 {% if budget.no_budget %} | ||||
|                     <td data-value="zzz"> | ||||
|                         <em>{{ 'no_budget'|_ }} ({{ row.currency_name }})</em> | ||||
|                     </td> | ||||
|                 {% else %} | ||||
|                     <td data-value="{{ budget.budget_name }}"> | ||||
|                         <a href="{{ route('budgets.show',budget.budget_id) }}">{{ budget.budget_name }}</a> | ||||
|                     </td> | ||||
|                 {% endif %} | ||||
|  | ||||
|                 <!-- date, hidden on mobile  --> | ||||
|                 <td class="hidden-xs" data-value="{{ row.start_date.format('Y-m-d')|default('0000-00-00') }}"> | ||||
|                     {% if null != row.limit_id %} | ||||
|                         <a href="{{ route('budgets.show.limit', [budget.budget_id, row.limit_id]) }}"> | ||||
|                             {{ row.start_date.formatLocalized(monthAndDayFormat) }} | ||||
|                             — | ||||
|                             {{ row.end_date.formatLocalized(monthAndDayFormat) }} | ||||
|                         </a> | ||||
|                     {% endif %} | ||||
|                 </td> | ||||
|  | ||||
|                 <!-- budgeted, hidden on mobile --> | ||||
|                 <td data-value="{{ row.budgeted|default(0) }}" style="text-align: right;" class="hidden-xs"> | ||||
|                     {% if null != row.budgeted %} | ||||
|                         {{ formatAmountBySymbol(row.budgeted, row.currency_symbol, row.currency_decimal_places) }} | ||||
|                     {% endif %} | ||||
|                 </td> | ||||
|  | ||||
|                 <!-- spent, visible on mobile --> | ||||
|                 <td data-value="{{ row.spent|default(0) }}" style="text-align: right;"> | ||||
|                     {{ formatAmountBySymbol(row.spent, row.currency_symbol, row.currency_decimal_places) }} | ||||
|                 </td> | ||||
|  | ||||
|                 <!-- info button, not visible on mobile --> | ||||
|                 <td class="hidden-xs"> | ||||
|                     {% if row.spent != 0 %} | ||||
|                         <i class="fa fa-fw text-muted fa-info-circle firefly-info-button" | ||||
|                            data-location="budget-spent-amount" data-currency-id="{{ row.currency_id }}" data-budget-id="{{ budget.budget_id }}"></i> | ||||
|                     {% endif %} | ||||
|                 </td> | ||||
|  | ||||
|                 <!-- left, hidden on mobile  --> | ||||
|                 <td data-value="{{ row.left|default(0) }}" style="text-align: right;" class="hidden-xs"> | ||||
|                     {% if null != row.left %} | ||||
|                         {{ formatAmountBySymbol(row.left, row.currency_symbol, row.currency_decimal_places) }} | ||||
|                     {% endif %} | ||||
|                 </td> | ||||
|  | ||||
|                 <!-- overspent, visible. --> | ||||
|                 <td data-value="{{ row.overspent|default(0) }}" style="text-align: right;"> | ||||
|                     {% if null != row.overspent %} | ||||
|                         {{ formatAmountBySymbol(row.overspent, row.currency_symbol, row.currency_decimal_places) }} | ||||
|                     {% endif %} | ||||
|                 </td> | ||||
|             </tr> | ||||
|         {% endfor %} | ||||
|         {# | ||||
|         {% set sum_budgeted = sum_budgeted + line.budgeted %} | ||||
|         {% set sum_spent = sum_spent + line.spent %} | ||||
|         {% set sum_left = sum_left + line.left %} | ||||
|         {% set sum_overspent = sum_overspent + line.overspent %} | ||||
|  | ||||
|         <tr> | ||||
|             {# Budget name, always visible #} | ||||
|             <!-- Budget name, always visible --> | ||||
|             {% if line.type == 'no-budget' %} | ||||
|                 <td data-value="zzzzzzz"> | ||||
|                     <em>{{ 'no_budget'|_ }}</em> | ||||
| @@ -33,7 +88,7 @@ | ||||
|                     <a href="{{ route('budgets.show',line.id) }}">{{ line.name }}</a> | ||||
|                 </td> | ||||
|             {% endif %} | ||||
|             {# date, hidden on mobile #} | ||||
|             <!-- date, hidden on mobile  --> | ||||
|             {% if line.type == 'budget-line' %} | ||||
|                 <td class="hidden-xs" data-value="{{ line.start.format('Y-m-d') }}"> | ||||
|                     <a href="{{ route('budgets.show.limit', [line.id, line.limit]) }}"> | ||||
| @@ -48,17 +103,17 @@ | ||||
|                 </td> | ||||
|             {% endif %} | ||||
|  | ||||
|             {# budgeted, hidden on mobile #} | ||||
|             <!-- budgeted, hidden on mobile --> | ||||
|             <td data-value="{{ line.budgeted }}" style="text-align: right;" class="hidden-xs"> | ||||
|                 {{ line.budgeted|formatAmount }} | ||||
|             </td> | ||||
|  | ||||
|             {# spent, visible on mobile #} | ||||
|             <!-- spent, visible on mobile --> | ||||
|             <td data-value="{{ line.spent }}" style="text-align: right;"> | ||||
|                 {{ line.spent|formatAmount }} | ||||
|             </td> | ||||
|  | ||||
|             {# info button, not visible on mobile #} | ||||
|             <!-- info button, not visible on mobile --> | ||||
|             <td class="hidden-xs"> | ||||
|                 {% if line.spent != 0 %} | ||||
|                     <i class="fa fa-fw text-muted fa-info-circle firefly-info-button" | ||||
| @@ -66,37 +121,51 @@ | ||||
|                 {% endif %} | ||||
|             </td> | ||||
|  | ||||
|             {# left, hidden on mobile #} | ||||
|             <!-- left, hidden on mobile  --> | ||||
|             <td data-value="{{ line.left }}" style="text-align: right;" class="hidden-xs"> | ||||
|                 {{ line.left|formatAmount }} | ||||
|             </td> | ||||
|  | ||||
|             {# overspent, visible. #} | ||||
|             <!-- overspent, visible. --> | ||||
|             <td data-value="{{ line.overspent }}" style="text-align: right;"> | ||||
|                 {{ line.overspent|formatAmount }} | ||||
|             </td> | ||||
|         #} | ||||
|         </tr> | ||||
|     {% endfor %} | ||||
|     </tbody> | ||||
|     <tfoot> | ||||
|     {% for sum in budgets.sums %} | ||||
|         <tr> | ||||
|             <td colspan="2"><em>{{ 'sum'|_ }} ({{ sum.currency_name }})</em></td> | ||||
|             <td style="text-align: right;">{{ formatAmountBySymbol(sum.budgeted, sum.currency_symbol, sum.decimal_places) }}</td> | ||||
|             <td style="text-align: right;">{{ formatAmountBySymbol(sum.spent, sum.currency_symbol, sum.decimal_places) }}</td> | ||||
|             <td> </td> | ||||
|             <td style="text-align: right;">{{ formatAmountBySymbol(sum.left, sum.currency_symbol, sum.decimal_places) }}</td> | ||||
|             <td style="text-align: right;">{{ formatAmountBySymbol(sum.overspent, sum.currency_symbol, sum.decimal_places) }}</td> | ||||
|         </tr> | ||||
|     {% endfor %} | ||||
|     {# | ||||
|     <tr> | ||||
|         {# title, visible #} | ||||
|         <!-- title, visible --> | ||||
|         <td><em>{{ 'sum'|_ }}</em></td> | ||||
|         {# date, hidden #} | ||||
|  | ||||
|         <!-- date, hidden --> | ||||
|         <td class="hidden-xs"> </td> | ||||
|  | ||||
|         {# sum of budgeted, hidden #} | ||||
|         <!-- sum of budgeted, hidden --> | ||||
|         <td style="text-align: right;" class="hidden-xs">{{ sum_budgeted|formatAmount }}</td> | ||||
|  | ||||
|         {# spent, visible #} | ||||
|         <!-- spent, visible --> | ||||
|         <td style="text-align: right;">{{ sum_spent|formatAmount }}</td> | ||||
|  | ||||
|         {# info button, hidden #} | ||||
|         <!-- info button, hidden  --> | ||||
|         <td class="hidden-xs"> </td> | ||||
|  | ||||
|         {# left, hidden #} | ||||
|         <!-- left, hidden --> | ||||
|         <td style="text-align: right;" class="hidden-xs">{{ sum_left|formatAmount }}</td> | ||||
|         <td style="text-align: right;">{{ sum_overspent|formatAmount }}</td> | ||||
|     </tr> | ||||
|     #} | ||||
|     </tfoot> | ||||
| </table> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user