mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			259 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			Twig
		
	
	
	
	
	
			
		
		
	
	
			259 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			Twig
		
	
	
	
	
	
| {% extends "./layout/default" %}
 | |
| 
 | |
| {% block breadcrumbs %}
 | |
|     {{ Breadcrumbs.render(Route.getCurrentRoute.getName) }}
 | |
| {% endblock %}
 | |
| 
 | |
| {% block content %}
 | |
|     <div class="row">
 | |
|         <div class="col-lg-9 col-md-8 col-sm-12 col-xs-12">
 | |
|             <div class="box">
 | |
|                 <div class="box-header with-border">
 | |
|                     <h3 class="box-title">{{ start.formatLocalized(monthAndDayFormat) }} — {{ end.formatLocalized(monthAndDayFormat) }}</h3>
 | |
|                 </div>
 | |
|                 <div class="box-body">
 | |
|                     <div class="row">
 | |
|                         <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
 | |
|                             <small>{{ 'budgeted'|_ }}: <span id="budgetedAmount" class="text-success">{{ budgeted|formatAmountPlain }}</span></small>
 | |
|                         </div>
 | |
|                         <div class="col-lg-9 col-md-9 col-sm-9 col-xs-9" style="text-align:right;margin-bottom:3px;">
 | |
|                             <small id="availableBar">{{ trans('firefly.available_between',{start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat) }) }}:
 | |
|                                 <span id="available" data-value="{{ available }}">{{ available|formatAmountPlain }}</span>
 | |
|                                 <a href="#" class="updateIncome btn btn-default btn-xs"><i class="fa fa-pencil"></i></a>
 | |
|                                 <a href="#" class="infoIncome btn btn-info btn-xs"><i class="fa fa-info-circle"></i></a>
 | |
|                             </small>
 | |
|                         </div>
 | |
|                     </div>
 | |
| 
 | |
|                     <div class="row">
 | |
|                         <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
 | |
|                             <div class="progress budgetedBar">
 | |
|                                 <div class="progress-bar progress-bar-danger" id="progress-bar-danger" role="progressbar" aria-valuenow="0" aria-valuemin="0"
 | |
|                                      aria-valuemax="100" style="width: 0;"></div>
 | |
|                                 <div class="progress-bar progress-bar-warning" id="progress-bar-warning" role="progressbar" aria-valuenow="10" aria-valuemin="0"
 | |
|                                      aria-valuemax="100" style="width: 0;"></div>
 | |
|                                 <div class="progress-bar progress-bar-info" id="progress-bar-default" role="progressbar" aria-valuenow="0" aria-valuemin="0"
 | |
|                                      aria-valuemax="100" style="width: 0;"></div>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                     </div>
 | |
|                     <div class="row" id="spentBar">
 | |
|                         <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
 | |
|                             <small>{{ trans('firefly.spent_between', {start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat)}) }}: {{ spent|formatAmount }}</small>
 | |
|                         </div>
 | |
|                     </div>
 | |
|                     <div class="row">
 | |
|                         <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
 | |
|                             <div class="progress spentBar">
 | |
|                                 <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"
 | |
|                                      style="width: 0;"></div>
 | |
|                                 <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"
 | |
|                                      style="width: 0;"></div>
 | |
|                                 <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"
 | |
|                                      style="width: 0;"></div>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                     </div>
 | |
| 
 | |
|                 </div>
 | |
|             </div>
 | |
|         </div>
 | |
|         <div class="col-lg-3 col-md-4 col-sm-12 col-xs-12">
 | |
|             <div class="box">
 | |
|                 <div class="box-header with-border">
 | |
|                     <h3 class="box-title">{{ 'transactionsWithoutBudget'|_ }}</h3>
 | |
|                 </div>
 | |
|                 <div class="box-body">
 | |
|                     <p>
 | |
|                         <a href="{{ route('budgets.no-budget', [start.format('Y-m-d'), end.format('Y-m-d')]) }}">
 | |
|                             {{ trans('firefly.transactions_no_budget', {start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat)}) }}
 | |
|                         </a>
 | |
|                     </p>
 | |
|                 </div>
 | |
|             </div>
 | |
|             {% if paginator.count > 0 and inactive.count > 0 %}
 | |
|                 <div class="box" id="createBudgetBox">
 | |
|                     <div class="box-header with-border">
 | |
|                         <h3 class="box-title">{{ 'createBudget'|_ }}</h3>
 | |
|                     </div>
 | |
|                     <div class="box-body">
 | |
|                         <a href="{{ route('budgets.create') }}" class="btn btn-success pull-right">{{ 'createBudget'|_ }}</a>
 | |
|                     </div>
 | |
|                 </div>
 | |
|             {% endif %}
 | |
|         </div>
 | |
|     </div>
 | |
|     {% if paginator.count == 0 and inactive.count == 0 and page == 1 %}
 | |
|         {% include 'partials.empty' with {what: 'default', type: 'budgets',route: route('budgets.create')} %}
 | |
|         {# make FF ignore demo for now. #}
 | |
|         {% set shownDemo = true %}
 | |
|     {% endif %}
 | |
| 
 | |
|     {# date thing #}
 | |
|     <div class="row">
 | |
|         <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
 | |
|             <div class="box">
 | |
|                 <div class="box-header with-border">
 | |
|                     <h3 class="box-title">{{ 'budget_period_navigator'|_ }}</h3>
 | |
|                 </div>
 | |
|                 <div class="box-body">
 | |
|                     <div class="row" id="periodNavigator">
 | |
|                         <div class="col-lg-2 col-md-4 col-sm-12 col-xs-12">
 | |
|                             <select class="form-control selectPeriod" name="previous">
 | |
|                                 <option label="{{ 'select_date'|_ }}" value="x">{{ 'select_date'|_ }}</option>
 | |
|                                 {% for format, previousLabel in previousLoop %}
 | |
|                                     <option label="{{ previousLabel }}" value="{{ format }}">{{ previousLabel }}</option>
 | |
|                                 {% endfor %}
 | |
|                             </select>
 | |
|                         </div>
 | |
|                         <div class="col-lg-8 col-md-4 col-sm-12 col-xs-12 text-center">
 | |
|                             <div class="btn btn-group btn-group-lg" style="padding-top:0;">
 | |
|                                 <a href="{{ route('budgets.index', [prev.format('Y-m-d')]) }}?page={{ page }}" class="btn btn-default" title="{{ prevText }}">←</a>
 | |
|                                 <a href="{{ route('budgets.index', [start.format('Y-m-d')]) }}?page={{ page }}" class="btn btn-default">{{ currentMonth }}</a>
 | |
|                                 <a href="{{ route('budgets.index', [next.format('Y-m-d')]) }}?page={{ page }}" class="btn btn-default" title="{{ nextText }}">→</a>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                         <div class="col-lg-2 col-md-4 col-sm-12 col-xs-12 text-right">
 | |
|                             <select class="form-control selectPeriod" name="next">
 | |
|                                 <option label="{{ 'select_date'|_ }}" value="x">{{ 'select_date'|_ }}</option>
 | |
|                                 {% for format, nextLabel in nextLoop %}
 | |
|                                     <option label="{{ nextLabel }}" value="{{ format }}">{{ nextLabel }}</option>
 | |
|                                 {% endfor %}
 | |
|                             </select>
 | |
|                         </div>
 | |
|                     </div>
 | |
|                 </div>
 | |
|             </div>
 | |
|         </div>
 | |
|     </div>
 | |
| 
 | |
|     <div class="row">
 | |
|         <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
 | |
|             <div class="box">
 | |
|                 <div class="box-header with-border">
 | |
|                     <h3 class="box-title">{{ 'budgets'|_ }}</h3>
 | |
|                 </div>
 | |
|                 <div class="box-body no-padding">
 | |
|                     <div style="padding:8px;">
 | |
|                         <a href="{{ route('budgets.create') }}" class="btn btn-success"><i class="fa fa-plus fa-fw"></i>  {{ 'createBudget'|_ }}</a>
 | |
|                     </div>
 | |
|                     <div style="padding-left:8px;">
 | |
|                         {{ paginator.render|raw }}
 | |
|                     </div>
 | |
|                     <table class="table table-bordered table-striped sortable" id="budgetList">
 | |
|                         <thead>
 | |
|                         <tr>
 | |
|                             <th data-defaultsort="disabled" class="hidden-sm hidden-xs" style="width:10%;"> </th>
 | |
|                             <th data-defaultsign="az">{{ 'budget'|_ }}</th>
 | |
|                             <th data-defaultsign="_19" style="width:25%;">{{ 'budgeted'|_ }}</th>
 | |
|                             <th data-defaultsign="_19" class="hidden-sm hidden-xs">{{ 'spent'|_ }} ({{ 'per_day'|_|lower }})</th>
 | |
|                             <th data-defaultsign="_19">{{ 'left'|_ }} ({{ 'per_day'|_|lower }})</th>
 | |
|                         </tr>
 | |
|                         </thead>
 | |
|                         <tbody>
 | |
|                         <tr>
 | |
|                             {% for budget in paginator %}
 | |
|                         <tr>
 | |
|                             <td class="hidden-sm hidden-xs">
 | |
|                                 <div class="btn-group btn-group-xs">
 | |
|                                     <a href="{{ route('budgets.edit',budget.id) }}" class="btn btn-xs btn-default"><i class="fa fa-fw fa-pencil"></i></a>
 | |
|                                     <a href="{{ route('budgets.delete',budget.id) }}" class="btn btn-xs btn-danger"><i class="fa fa-fw fa-trash-o"></i></a>
 | |
|                                 </div>
 | |
|                             </td>
 | |
|                             <td data-value="{{ budget.name }}">
 | |
|                                 {% if budgetInformation[budget.id]['currentLimit'] %}
 | |
|                                     <a href="{{ route('budgets.show.limit', [budget.id, budgetInformation[budget.id]['currentLimit'].id]) }}"
 | |
|                                        class="budget-link"
 | |
|                                        data-id="{{ budget.id }}">{{ budget.name }}</a>
 | |
|                                 {% else %}
 | |
|                                     <a href="{{ route('budgets.show',budget.id) }}" class="budget-link" data-id="{{ budget.id }}">{{ budget.name }}</a>
 | |
|                                 {% endif %}
 | |
|                             </td>
 | |
|                             {% if budgetInformation[budget.id]['currentLimit'] %}
 | |
|                                 {% set repAmount = budgetInformation[budget.id]['budgeted'] %}
 | |
|                             {% else %}
 | |
|                                 {% set repAmount = '0' %}
 | |
|                             {% endif %}
 | |
| 
 | |
|                             <td data-value="{{ repAmount }}">
 | |
|                                 <div class="input-group">
 | |
|                                     <div class="input-group-addon">{{ defaultCurrency.symbol|raw }}</div>
 | |
|                                     <input type="hidden" name="balance_currency_id" value="{{ defaultCurrency.id }}"/>
 | |
|                                     <input class="form-control budgetAmount" data-original="{{ repAmount }}"
 | |
|                                            data-id="{{ budget.id }}" value="{{ repAmount }}" autocomplete="off"
 | |
|                                            min="0" name="amount" type="number">
 | |
|                                 </div>
 | |
|                                 <span class="text-danger budget_warning" data-id="{{ budget.id }}" style="display:none;"></span>
 | |
|                             </td>
 | |
|                             <td class="hidden-sm hidden-xs spent" data-id="{{ budget.id }}" data-spent="{{ budgetInformation[budget.id]['spent'] }}"
 | |
|                                 data-value="{{ budgetInformation[budget.id]['spent'] }}">
 | |
|                                 {{ budgetInformation[budget.id]['spent']|formatAmount }}
 | |
|                                 ({{ (budgetInformation[budget.id]['spent'] / activeDaysPassed)|formatAmount }})
 | |
|                             </td>
 | |
|                             <td class="left" data-id="{{ budget.id }}"
 | |
|                                 data-value="{{ (repAmount + budgetInformation[budget.id]['spent']) }}">
 | |
|                                 {{ (repAmount + budgetInformation[budget.id]['spent'])|formatAmount }}
 | |
|                                 {% if repAmount + budgetInformation[budget.id]['spent'] > 0 %}
 | |
|                                 ({{ ((repAmount + budgetInformation[budget.id]['spent']) / activeDaysLeft)|formatAmount }})
 | |
|                                 {% endif %}
 | |
|                             </td>
 | |
|                         </tr>
 | |
|                         {% endfor %}
 | |
|                         </tbody>
 | |
|                     </table>
 | |
|                     <div style="padding-left:8px;">
 | |
|                         {{ paginator.render|raw }}
 | |
|                     </div>
 | |
|                 </div>
 | |
|                 <div class="box-footer">
 | |
|                     <a href="{{ route('budgets.create') }}" class="btn btn-success"><i class="fa fa-plus fa-fw"></i>  {{ 'createBudget'|_ }}</a>
 | |
|                 </div>
 | |
|             </div>
 | |
|         </div>
 | |
|     </div>
 | |
| 
 | |
|     {% if inactive|length > 0 %}
 | |
|         <div class="row">
 | |
|             <div class="col-lg-3 col-sm-4 col-md-6">
 | |
|                 <div class="box">
 | |
|                     <div class="box-header with-border">
 | |
|                         <h3 class="box-title">{{ 'inactiveBudgets'|_ }}</h3>
 | |
|                     </div>
 | |
|                     <div class="box-body">
 | |
|                         {% for budget in inactive %}
 | |
|                             {% if loop.index == inactive.count() %}
 | |
|                                 <a href="{{ route('budgets.show',budget.id) }}">{{ budget.name }}</a>
 | |
|                             {% else %}
 | |
|                                 <a href="{{ route('budgets.show',budget.id) }}">{{ budget.name }}</a>,
 | |
|                             {% endif %}
 | |
|                         {% endfor %}
 | |
|                     </div>
 | |
|                 </div>
 | |
|             </div>
 | |
|         </div>
 | |
|     {% endif %}
 | |
| {% endblock %}
 | |
| 
 | |
| {% block styles %}
 | |
|     <link href="css/bootstrap-sortable.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
 | |
| {% endblock %}
 | |
| 
 | |
| {% block scripts %}
 | |
|     <script type="text/javascript">
 | |
|         // actually spent bar data:
 | |
|         var spent = {{ spent * -1 }}; // must be positive for the calculation to work.
 | |
|         var page = {{ page }};
 | |
|         // budgeted data:
 | |
|         var budgeted = {{ budgeted }};
 | |
|         var available = {{ available }};
 | |
|         var budgetIndexUri = "{{ route('budgets.index','REPLACE') }}";
 | |
|         var budgetAmountUri = "{{ route('budgets.amount','REPLACE') }}";
 | |
|         var updateIncomeUri = "{{ route('budgets.income',[start.format('Y-m-d'),end.format('Y-m-d')]) }}?page={{ page }}";
 | |
|         var infoIncomeUri = "{{ route('budgets.income.info',[start.format('Y-m-d'),end.format('Y-m-d')]) }}";
 | |
|         var periodStart = "{{ start.format('Y-m-d') }}";
 | |
|         var periodEnd = "{{ end.format('Y-m-d') }}";
 | |
|     </script>
 | |
|     <script type="text/javascript" src="js/lib/bootstrap-sortable.js?v={{ FF_VERSION }}"></script>
 | |
|     <script type="text/javascript" src="js/ff/budgets/index.js?v={{ FF_VERSION }}"></script>
 | |
| {% endblock %}
 |