diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php
index ea8d7bc57f..8dab8f94dc 100644
--- a/app/Http/Controllers/Account/ShowController.php
+++ b/app/Http/Controllers/Account/ShowController.php
@@ -103,6 +103,7 @@ class ShowController extends Controller
[$start, $end] = [$end, $start]; // @codeCoverageIgnore
}
$location = $this->repository->getLocation($account);
+ $attachments = $this->repository->getAttachments($account);
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
$today = new Carbon;
$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $account->accountType->type));
@@ -139,6 +140,7 @@ class ShowController extends Controller
'periods',
'subTitleIcon',
'groups',
+ 'attachments',
'subTitle',
'start',
'end',
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index c3bb6a12f1..fa9662c1c3 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -311,7 +311,7 @@ class AccountRepository implements AccountRepositoryInterface
$query = $this->user->accounts()->with(
['accountmeta' => function (HasMany $query) {
$query->where('name', 'account_role');
- }]
+ }, 'attachments']
);
if (count($types) > 0) {
$query->accountTypeIn($types);
diff --git a/resources/views/v1/accounts/show.twig b/resources/views/v1/accounts/show.twig
index 8a16f6d0da..a291392c01 100644
--- a/resources/views/v1/accounts/show.twig
+++ b/resources/views/v1/accounts/show.twig
@@ -7,7 +7,7 @@
{% block content %}
-
+
+ {% if attachments.count > 0 %}
+
+
+
+
+ {% include 'list.attachments' %}
+
+
+
+ {% endif %}
{% if not showAll and isLiability %}
diff --git a/resources/views/v1/list/accounts.twig b/resources/views/v1/list/accounts.twig
index 1dddd28799..00749294d6 100644
--- a/resources/views/v1/list/accounts.twig
+++ b/resources/views/v1/list/accounts.twig
@@ -42,6 +42,9 @@
{% if account.location %}
{% endif %}
+ {% if account.attachments.count > 0 %}
+
+ {% endif %}
{% if objectType == "asset" %}
diff --git a/resources/views/v1/list/attachments.twig b/resources/views/v1/list/attachments.twig
new file mode 100644
index 0000000000..abfdba55d3
--- /dev/null
+++ b/resources/views/v1/list/attachments.twig
@@ -0,0 +1,47 @@
+
+ {% for attachment in attachments %}
+
+
+
+
+
+ {% if attachment.file_exists %}
+
+ {% endif %}
+ {% if not attachment.file_exists %}
+
+ {% endif %}
+
+ |
+
+ {% if attachment.file_exists %}
+
+
+ {% if attachment.title %}
+ {{ attachment.title }}
+ {% else %}
+ {{ attachment.filename }}
+ {% endif %}
+
+ ({{ attachment.size|filesize }})
+ {% if null != attachment.notes and '' != attachment.notes %}
+ {{ attachment.notes|markdown }}
+ {% endif %}
+ {% endif %}
+ {% if not attachment.file_exists %}
+
+ {% if attachment.title %}
+ {{ attachment.title }}
+ {% else %}
+ {{ attachment.filename }}
+ {% endif %}
+
+ {{ 'attachment_not_found'|_ }}
+ {% endif %}
+ |
+
+ {% endfor %}
+
\ No newline at end of file
diff --git a/resources/views/v1/transactions/show.twig b/resources/views/v1/transactions/show.twig
index 7aad96c319..fc6b9810e4 100644
--- a/resources/views/v1/transactions/show.twig
+++ b/resources/views/v1/transactions/show.twig
@@ -325,53 +325,7 @@
{{ 'attachments'|_ }}
-
- {% for attachment in attachments[journal.transaction_journal_id] %}
-
-
-
-
-
- {% if attachment.file_exists %}
-
- {% endif %}
- {% if not attachment.file_exists %}
-
- {% endif %}
-
- |
-
- {% if attachment.file_exists %}
-
-
- {% if attachment.title %}
- {{ attachment.title }}
- {% else %}
- {{ attachment.filename }}
- {% endif %}
-
- ({{ attachment.size|filesize }})
- {% if null != attachment.notes and '' != attachment.notes %}
- {{ attachment.notes|markdown }}
- {% endif %}
- {% endif %}
- {% if not attachment.file_exists %}
-
- {% if attachment.title %}
- {{ attachment.title }}
- {% else %}
- {{ attachment.filename }}
- {% endif %}
-
- {{ 'attachment_not_found'|_ }}
- {% endif %}
- |
-
- {% endfor %}
-
+ {% include 'list.attachments' with {attachments: attachments[journal.transaction_journal_id]} %}
{% endif %}
|