Show attachments for budgets #2828

This commit is contained in:
James Cole
2020-03-19 18:28:02 +01:00
parent 9b53576fc2
commit 417a0d0f83
5 changed files with 30 additions and 5 deletions

View File

@@ -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);

View File

@@ -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'));
}
}