Skip to content

Firefly III: a personal finances manager

Code for #1321

James Cole07768a43c8b3
diff --git a/public/js/ff/transactions/single/edit.js b/public/js/ff/transactions/single/edit.js
index 86b79bf30a..cf5248e021 100644
--- a/public/js/ff/transactions/single/edit.js
+++ b/public/js/ff/transactions/single/edit.js
@@ -52,6 +52,8 @@ $(document).ready(function () {
// convert source currency to destination currency (slightly different routine for transfers)
$('#ffInput_source_amount').on('change', convertSourceToDestination);
+ //
+
});
diff --git a/resources/lang/en_US/form.php b/resources/lang/en_US/form.php
index 9904018181..46bf5d8c85 100644
--- a/resources/lang/en_US/form.php
+++ b/resources/lang/en_US/form.php
@@ -95,6 +95,7 @@ return [
'amount' => 'Amount',
'foreign_amount' => 'Foreign amount',
+ 'existing_attachments' => 'Existing attachments',
'date' => 'Date',
'interest_date' => 'Interest date',
'book_date' => 'Book date',
diff --git a/resources/views/transactions/single/edit.twig b/resources/views/transactions/single/edit.twig
index 13c50709be..11fc096c5b 100644
--- a/resources/views/transactions/single/edit.twig
+++ b/resources/views/transactions/single/edit.twig
@@ -177,15 +177,39 @@
</div>
{% endif %}
- {% if optionalFields.attachments %}
+ {% if optionalFields.attachments or journal.attachments|length > 0 %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'optional_field_attachments'|_ }}</h3>
</div>
<div class="box-body">
- {% if optionalFields.attachments %}
- {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
+ {% if journal.attachments|length > 0 %}
+ <div id="att_holder_attachments" class="form-group">
+ <label class="col-sm-4 control-label">
+ {{ trans('form.existing_attachments') }}
+ </label>
+ <div class="col-sm-8">
+ {% for att in journal.attachments %}
+ <div class="row att_row" data-id="{{ att.id }}">
+ <div class="col-lg-1"><a href="{{ route('attachments.delete', att.id) }}" data-id="{{ att.id }}" class="del_att btn btn-danger btn-xs"><i class="fa fa-trash"></i></a></div>
+ <div class="col-lg-11">
+ <a href="{{ route('attachments.view', att.id) }}" title="{{ att.filename }}">
+ {% if att.title %}
+ {{ att.title }} ({{ att.filename }})
+ {% else %}
+ {{ att.filename }}
+ {% endif %}
+ </a>
+ ({{ att.size|filesize }})
+ </div>
+ </div>
+ {% endfor %}
+ </div>
+ </div>
{% endif %}
+
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
+
</div>
</div>
{% endif %}