diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php index 4690f03887..69d4e2dc4d 100644 --- a/app/Http/Controllers/Budget/IndexController.php +++ b/app/Http/Controllers/Budget/IndexController.php @@ -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); diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.php index 5676e77660..3938a1d79b 100644 --- a/app/Http/Controllers/Budget/ShowController.php +++ b/app/Http/Controllers/Budget/ShowController.php @@ -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')); } } diff --git a/resources/views/v1/bills/show.twig b/resources/views/v1/bills/show.twig index c23b38dd8c..c9371e745f 100644 --- a/resources/views/v1/bills/show.twig +++ b/resources/views/v1/bills/show.twig @@ -114,7 +114,7 @@

{{ 'attachments'|_ }}

- {% include 'list.attachments' %} + {% include 'list.attachments' %}
{% endif %} diff --git a/resources/views/v1/budgets/index.twig b/resources/views/v1/budgets/index.twig index 12495926c8..f0a23462c1 100644 --- a/resources/views/v1/budgets/index.twig +++ b/resources/views/v1/budgets/index.twig @@ -234,6 +234,7 @@ + {{ budget.name }} {% if budget.auto_budget %} {% if 1 == budget.auto_budget.auto_budget_type %} @@ -242,7 +243,9 @@ {% endif %} {% endif %} - {{ budget.name }} + {% if budget.attachments.count > 0 %} + + {% endif %} {% if 0==budget.budgeted|length %} diff --git a/resources/views/v1/budgets/show.twig b/resources/views/v1/budgets/show.twig index 37657d7435..4168d88229 100644 --- a/resources/views/v1/budgets/show.twig +++ b/resources/views/v1/budgets/show.twig @@ -6,7 +6,7 @@ {% block content %}
-
+

@@ -38,6 +38,20 @@ {% endif %}

+ {% if attachments.count > 0 %} +
+
+
+

+ {{ 'attachments'|_ }} +

+
+
+ {% include 'list.attachments' %} +
+
+
+ {% endif %}