mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 18:54:58 +00:00 
			
		
		
		
	Show attachments for budgets #2828
This commit is contained in:
		| @@ -160,6 +160,7 @@ class IndexController extends Controller | ||||
|             $array                = $current->toArray(); | ||||
|             $array['spent']       = []; | ||||
|             $array['budgeted']    = []; | ||||
|             $array['attachments'] = $this->repository->getAttachments($current); | ||||
|             $array['auto_budget'] = $this->repository->getAutoBudget($current); | ||||
|             $budgetLimits         = $this->blRepository->getBudgetLimits($current, $start, $end); | ||||
|  | ||||
|   | ||||
| @@ -31,6 +31,7 @@ use FireflyIII\Http\Controllers\Controller; | ||||
| use FireflyIII\Models\Budget; | ||||
| use FireflyIII\Models\BudgetLimit; | ||||
| use FireflyIII\Models\TransactionType; | ||||
| use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; | ||||
| use FireflyIII\Repositories\Journal\JournalRepositoryInterface; | ||||
| use FireflyIII\Support\Http\Controllers\AugumentData; | ||||
| use FireflyIII\Support\Http\Controllers\PeriodOverview; | ||||
| @@ -48,6 +49,9 @@ class ShowController extends Controller | ||||
|     /** @var JournalRepositoryInterface */ | ||||
|     private $journalRepos; | ||||
|  | ||||
|     /** @var BudgetRepositoryInterface */ | ||||
|     private $repository; | ||||
|  | ||||
|     /** | ||||
|      * ShowController constructor. | ||||
|      * | ||||
| @@ -62,6 +66,7 @@ class ShowController extends Controller | ||||
|                 app('view')->share('title', (string) trans('firefly.budgets')); | ||||
|                 app('view')->share('mainTitleIcon', 'fa-tasks'); | ||||
|                 $this->journalRepos = app(JournalRepositoryInterface::class); | ||||
|                 $this->repository = app(BudgetRepositoryInterface::class); | ||||
|  | ||||
|                 return $next($request); | ||||
|             } | ||||
| @@ -158,6 +163,7 @@ class ShowController extends Controller | ||||
|         $pageSize   = (int) app('preferences')->get('listPageSize', 50)->data; | ||||
|         $limits     = $this->getLimits($budget, $allStart, $allEnd); | ||||
|         $repetition = null; | ||||
|         $attachments = $this->repository->getAttachments($budget); | ||||
|  | ||||
|         // collector: | ||||
|         /** @var GroupCollectorInterface $collector */ | ||||
| @@ -170,7 +176,7 @@ class ShowController extends Controller | ||||
|  | ||||
|         $subTitle = (string) trans('firefly.all_journals_for_budget', ['name' => $budget->name]); | ||||
|  | ||||
|         return view('budgets.show', compact('limits', 'budget', 'repetition', 'groups', 'subTitle')); | ||||
|         return view('budgets.show', compact('limits','attachments', 'budget', 'repetition', 'groups', 'subTitle')); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -212,8 +218,9 @@ class ShowController extends Controller | ||||
|         /** @var Carbon $start */ | ||||
|         $start  = session('first', Carbon::now()->startOfYear()); | ||||
|         $end    = new Carbon; | ||||
|         $attachments = $this->repository->getAttachments($budget); | ||||
|         $limits = $this->getLimits($budget, $start, $end); | ||||
|  | ||||
|         return view('budgets.show', compact('limits', 'budget', 'budgetLimit', 'groups', 'subTitle')); | ||||
|         return view('budgets.show', compact('limits','attachments', 'budget', 'budgetLimit', 'groups', 'subTitle')); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -114,7 +114,7 @@ | ||||
|                         <h3 class="box-title">{{ 'attachments'|_ }}</h3> | ||||
|                     </div> | ||||
|                     <div class="box-body table-responsive no-padding"> | ||||
|                         {%  include 'list.attachments'  %} | ||||
|                         {% include 'list.attachments' %} | ||||
|                     </div> | ||||
|                 </div> | ||||
|             {% endif %} | ||||
|   | ||||
| @@ -234,6 +234,7 @@ | ||||
|                                     </div> | ||||
|                                 </td> | ||||
|                                 <td data-value="{{ budget.name }}"> | ||||
|                                     <a href="{{ route('budgets.show',budget.id) }}" data-id="{{ budget.id }}">{{ budget.name }}</a> | ||||
|                                     {% if budget.auto_budget %} | ||||
|                                     {% if 1 == budget.auto_budget.auto_budget_type %} | ||||
|                                         <i class="fa fa-fw fa-calendar-check-o" title="{{ 'auto_budget_reset_icon'|_ }}"></i> | ||||
| @@ -242,7 +243,9 @@ | ||||
|                                         <i class="fa fa-fw fa-calendar-plus-o" title="{{ 'auto_budget_rollover_icon'|_ }}"></i> | ||||
|                                     {% endif %} | ||||
|                                     {% endif %} | ||||
|                                     <a href="{{ route('budgets.show',budget.id) }}" data-id="{{ budget.id }}">{{ budget.name }}</a> | ||||
|                                     {% if budget.attachments.count > 0 %} | ||||
|                                         <i class="fa fa-paperclip"></i> | ||||
|                                     {% endif %} | ||||
|                                 </td> | ||||
|                                 <td data-value="-1"> | ||||
|                                     {% if 0==budget.budgeted|length %} | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| {% block content %} | ||||
|     <div class="row"> | ||||
|         <div class="col-lg-12 col-md-12 col-sm-12"> | ||||
|         <div class="{% if attachments.count == 0 %}col-lg-12 col-md-12 col-sm-12 col-xs-12{% else %}col-lg-8 col-md-6 col-sm-12 col-xs-12{% endif %}"> | ||||
|             <div class="box"> | ||||
|                 <div class="box-header with-border"> | ||||
|                     <h3 class="box-title"> | ||||
| @@ -38,6 +38,20 @@ | ||||
|                 {% endif %} | ||||
|             </div> | ||||
|         </div> | ||||
|         {% if attachments.count > 0 %} | ||||
|             <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12"> | ||||
|                 <div class="box"> | ||||
|                     <div class="box-header with-border"> | ||||
|                         <h3 class="box-title"> | ||||
|                             {{ 'attachments'|_ }} | ||||
|                         </h3> | ||||
|                     </div> | ||||
|                     <div class="box-body table-responsive no-padding"> | ||||
|                         {% include 'list.attachments' %} | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         {% endif %} | ||||
|     </div> | ||||
|     <div class="row"> | ||||
|         <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user