diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php index 8dab8f94dc..c026325cdc 100644 --- a/app/Http/Controllers/Account/ShowController.php +++ b/app/Http/Controllers/Account/ShowController.php @@ -169,6 +169,7 @@ class ShowController extends Controller $location = $this->repository->getLocation($account); $isLiability = $this->repository->isLiability($account); + $attachments = $this->repository->getAttachments($account); $objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type)); $end = new Carbon; $today = new Carbon; @@ -196,6 +197,7 @@ class ShowController extends Controller 'location', 'objectType', 'isLiability', + 'attachments', 'currency', 'today', 'chartUri', diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index 38e8b553e9..12f1b36139 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -197,6 +197,7 @@ class BillController extends Controller $start = session('start'); $end = session('end'); $unfiltered = $this->billRepository->getBills(); + $defaultCurrency = app('amount')->getDefaultCurrency(); $parameters = new ParameterBag(); $parameters->set('start', $start); @@ -208,7 +209,7 @@ class BillController extends Controller /** @var Collection $bills */ $bills = $unfiltered->map( - static function (Bill $bill) use ($transformer, $defaultCurrency) { + function (Bill $bill) use ($transformer, $defaultCurrency) { $return = $transformer->transform($bill); $currency = $bill->transactionCurrency ?? $defaultCurrency; $return['currency_id'] = $currency->id; @@ -216,6 +217,7 @@ class BillController extends Controller $return['currency_symbol'] = $currency->symbol; $return['currency_code'] = $currency->code; $return['currency_decimal_places'] = $currency->decimal_places; + $return['attachments'] = $this->billRepository->getAttachments($bill); return $return; } diff --git a/resources/views/v1/bills/show.twig b/resources/views/v1/bills/show.twig index e4a560f086..c23b38dd8c 100644 --- a/resources/views/v1/bills/show.twig +++ b/resources/views/v1/bills/show.twig @@ -114,34 +114,7 @@

{{ 'attachments'|_ }}

- - {% for att in attachments %} - - - - - {% endfor %} -
-
- - - -
-
- - - {% if att.title %} - {{ att.title }} - {% else %} - {{ att.filename }} - {% endif %} - - ({{ att.size|filesize }}) - {% if att.notes.first %} -
- {{ att.notes.first.text|markdown }} - {% endif %} -
+ {% include 'list.attachments' %}
{% endif %} diff --git a/resources/views/v1/list/bills.twig b/resources/views/v1/list/bills.twig index c0fc882441..bfbd960411 100644 --- a/resources/views/v1/list/bills.twig +++ b/resources/views/v1/list/bills.twig @@ -27,7 +27,7 @@ {% endif %} {{ entry.name }} {# count attachments #} - {% if entry.attachments_count > 0 %} + {% if entry.attachments.count > 0 %} {% endif %}