Skip to content

Firefly III: a personal finances manager

Add attachment thing to views #2828

James Coleaceaf5f8917a
diff --git a/resources/views/v1/accounts/create.twig b/resources/views/v1/accounts/create.twig
index 228f70233c..2d73dc1ac2 100644
--- a/resources/views/v1/accounts/create.twig
+++ b/resources/views/v1/accounts/create.twig
@@ -9,7 +9,7 @@
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
</script>
- <form action="{{ route('accounts.store') }}" method="post" id="store" class="form-horizontal">
+ <form action="{{ route('accounts.store') }}" method="post" id="store" class="form-horizontal" enctype="multipart/form-data">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="objectType" value="{{ objectType }}"/>
<input type="hidden" name="active" value="1"/>
@@ -58,6 +58,7 @@
{{ ExpandedForm.checkbox('include_net_worth', 1) }}
{{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }}
{{ ExpandedForm.location('location', null, {locations: locations}) }}
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div>
</div>
</div>
diff --git a/resources/views/v1/accounts/edit.twig b/resources/views/v1/accounts/edit.twig
index 109e3a0a68..d9c6ea2e5f 100644
--- a/resources/views/v1/accounts/edit.twig
+++ b/resources/views/v1/accounts/edit.twig
@@ -11,8 +11,12 @@
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
</script>
- {{ Form.model(account, {'class' : 'form-horizontal','id' : 'update','url' : route('accounts.update',account.id) } ) }}
-
+ {{ Form.model(account, {
+ 'class': 'form-horizontal',
+ 'id': 'update',
+ 'url': route('accounts.update',account.id),
+ 'enctype': 'multipart/form-data'
+ } ) }}
<input type="hidden" name="id" value="{{ account.id }}"/>
<input type="hidden" name="objectType" value="{{ objectType }}"/>
@@ -70,6 +74,8 @@
{# only correct way to do active checkbox #}
{{ ExpandedForm.location('location', null, {locations: locations}) }}
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
+
</div>
</div>
diff --git a/resources/views/v1/budgets/create.twig b/resources/views/v1/budgets/create.twig
index 7af530501a..4253694a13 100644
--- a/resources/views/v1/budgets/create.twig
+++ b/resources/views/v1/budgets/create.twig
@@ -6,7 +6,7 @@
{% block content %}
- <form method="POST" action="{{ route('budgets.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store">
+ <form method="POST" action="{{ route('budgets.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store" enctype="multipart/form-data">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<input name="active" type="hidden" value="1">
@@ -32,6 +32,7 @@
{{ CurrencyForm.currencyList('auto_budget_currency_id') }}
{{ ExpandedForm.amountNoCurrency('auto_budget_amount') }}
{{ ExpandedForm.select('auto_budget_period', autoBudgetPeriods, null) }}
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div>
</div>
</div>
diff --git a/resources/views/v1/budgets/edit.twig b/resources/views/v1/budgets/edit.twig
index 659cf3b419..7dd3478980 100644
--- a/resources/views/v1/budgets/edit.twig
+++ b/resources/views/v1/budgets/edit.twig
@@ -5,7 +5,7 @@
{% endblock %}
{% block content %}
- {{ Form.model(budget, {'class' : 'form-horizontal','id' : 'update','url' : route('budgets.update',budget.id) } ) }}
+ {{ Form.model(budget, {'class' : 'form-horizontal','enctype': 'multipart/form-data','id' : 'update','url' : route('budgets.update',budget.id) } ) }}
<input type="hidden" name="id" value="{{ budget.id }}"/>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
@@ -32,6 +32,7 @@
{{ CurrencyForm.currencyList('auto_budget_currency_id', autoBudget.transaction_currency_id) }}
{{ ExpandedForm.amountNoCurrency('auto_budget_amount', preFilled.auto_budget_amount) }}
{{ ExpandedForm.select('auto_budget_period', autoBudgetPeriods, autoBudget.period) }}
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div>
</div>
</div>
diff --git a/resources/views/v1/categories/create.twig b/resources/views/v1/categories/create.twig
index 770e93106e..c8b6fc8d49 100644
--- a/resources/views/v1/categories/create.twig
+++ b/resources/views/v1/categories/create.twig
@@ -6,7 +6,7 @@
{% block content %}
- <form method="POST" action="{{ route('categories.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store">
+ <form method="POST" action="{{ route('categories.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store" enctype="multipart/form-data">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
@@ -19,10 +19,20 @@
</div>
</div>
</div>
+ <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
+ {# panel for optional fields#}
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ 'optionalFields'|_ }}</h3>
+ </div>
+ <div class="box-body">
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
+ </div>
+ </div>
+ </div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
-
{# panel for options #}
<div class="box">
<div class="box-header with-border">
diff --git a/resources/views/v1/categories/edit.twig b/resources/views/v1/categories/edit.twig
index 2d7f2c5ac6..ff2478a09d 100644
--- a/resources/views/v1/categories/edit.twig
+++ b/resources/views/v1/categories/edit.twig
@@ -5,7 +5,7 @@
{% endblock %}
{% block content %}
- {{ Form.model(category, {'class' : 'form-horizontal','id' : 'update','url' : route('categories.update',category.id)}) }}
+ {{ Form.model(category, {'class' : 'form-horizontal','enctype': 'multipart/form-data','id' : 'update','url' : route('categories.update',category.id)}) }}
<input type="hidden" name="id" value="{{ category.id }}"/>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
@@ -17,7 +17,17 @@
{{ ExpandedForm.text('name') }}
</div>
</div>
-
+ </div>
+ <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
+ {# panel for optional fields#}
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ 'optionalFields'|_ }}</h3>
+ </div>
+ <div class="box-body">
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
+ </div>
+ </div>
</div>
</div>
<div class="row">
diff --git a/resources/views/v1/piggy-banks/create.twig b/resources/views/v1/piggy-banks/create.twig
index 8466c12749..b994ba52a6 100644
--- a/resources/views/v1/piggy-banks/create.twig
+++ b/resources/views/v1/piggy-banks/create.twig
@@ -6,7 +6,7 @@
{% block content %}
- <form method="POST" action="{{ route('piggy-banks.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store">
+ <form method="POST" action="{{ route('piggy-banks.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store" enctype="multipart/form-data">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<input type="hidden" name="repeats" value="0"/>
<div class="row">
@@ -32,6 +32,7 @@
<div class="box-body">
{{ ExpandedForm.date('targetdate') }}
{{ ExpandedForm.textarea('notes', null, {helpText: trans('firefly.field_supports_markdown')} ) }}
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div>
</div>
</div>
diff --git a/resources/views/v1/piggy-banks/edit.twig b/resources/views/v1/piggy-banks/edit.twig
index 8dda406b0c..397fea13eb 100644
--- a/resources/views/v1/piggy-banks/edit.twig
+++ b/resources/views/v1/piggy-banks/edit.twig
@@ -5,7 +5,7 @@
{% endblock %}
{% block content %}
- {{ Form.model(piggyBank, {'class' : 'form-horizontal','id' : 'update','url' : route('piggy-banks.update',piggyBank.id)}) }}
+ {{ Form.model(piggyBank, {'class' : 'form-horizontal','enctype': 'multipart/form-data','id' : 'update','url' : route('piggy-banks.update',piggyBank.id)}) }}
<input type="hidden" name="repeats" value="0"/>
<input type="hidden" name="id" value="{{ piggyBank.id }}"/>
@@ -35,6 +35,7 @@
{{ ExpandedForm.date('startdate') }}
{{ ExpandedForm.date('targetdate') }}
{{ ExpandedForm.textarea('notes', null, {helpText: trans('firefly.field_supports_markdown')}) }}
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div>
</div>
</div>
diff --git a/resources/views/v1/tags/create.twig b/resources/views/v1/tags/create.twig
index 30f5a4ce51..96805de641 100644
--- a/resources/views/v1/tags/create.twig
+++ b/resources/views/v1/tags/create.twig
@@ -10,7 +10,7 @@
var locations = {{ locations|json_encode|raw }};
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
</script>
- <form method="POST" action="{{ route('tags.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store">
+ <form method="POST" action="{{ route('tags.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store" enctype="multipart/form-data">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-12">
@@ -34,6 +34,7 @@
{{ ExpandedForm.date('date') }}
{{ ExpandedForm.textarea('description') }}
{{ ExpandedForm.location('location', null, {locations: locations}) }}
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div>
</div>
</div>
diff --git a/resources/views/v1/tags/edit.twig b/resources/views/v1/tags/edit.twig
index e69ddfc3bd..cc1bb5d50b 100644
--- a/resources/views/v1/tags/edit.twig
+++ b/resources/views/v1/tags/edit.twig
@@ -11,7 +11,7 @@
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
</script>
- {{ Form.model(tag, {'class' : 'form-horizontal','id' : 'update','url' : route('tags.update',tag.id)}) }}
+ {{ Form.model(tag, {'class' : 'form-horizontal','enctype': 'multipart/form-data','id' : 'update','url' : route('tags.update',tag.id)}) }}
<input type="hidden" name="id" value="{{ tag.id }}"/>
@@ -37,6 +37,7 @@
{{ ExpandedForm.date('date', tag.date.format('Y-m-d')) }}
{{ ExpandedForm.textarea('description', tag.description) }}
{{ ExpandedForm.location('location', null, {locations: locations}) }}
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div>
</div>
</div>