Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
fix: remove and replace old form functions
James Cole0438fb5a2e1c
diff --git a/resources/views/accounts/create.twig b/resources/views/accounts/create.twigindex b83bb08dcc..46876560cc 100644--- a/resources/views/accounts/create.twig+++ b/resources/views/accounts/create.twig@@ -9,7 +9,8 @@var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";</script>- <form action="{{ route('accounts.store') }}" method="post" id="store" class="form-horizontal" enctype="multipart/form-data">+ <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,7 +59,6 @@{# only correct way to do active checkbox #}{{ 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>@@ -89,13 +89,16 @@var iOwe = '{{ 'i_owe_amount'|_|escape('js') }}';</script><script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>- <script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>+ <script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"+ nonce="{{ JS_NONCE }}"></script><script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script><script type="text/javascript" src="v1/js/ff/accounts/create.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>{% endblock %}{% block styles %}- <link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all" nonce="{{ JS_NONCE }}">- <link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all" nonce="{{ JS_NONCE }}">+ <link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet"+ media="all" nonce="{{ JS_NONCE }}">+ <link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet"+ media="all" nonce="{{ JS_NONCE }}"><link rel="stylesheet" href="v1/lib/leaflet/leaflet.css?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}">{% endblock %}diff --git a/resources/views/accounts/edit.twig b/resources/views/accounts/edit.twigindex 0a47e571ff..0f981e5558 100644--- a/resources/views/accounts/edit.twig+++ b/resources/views/accounts/edit.twig@@ -73,7 +73,6 @@{{ ExpandedForm.checkbox('active', 1) }}{# 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>diff --git a/resources/views/form/amount-no-currency.twig b/resources/views/form/amount-no-currency.twigindex 411bd76787..d558f52f0c 100644--- a/resources/views/form/amount-no-currency.twig+++ b/resources/views/form/amount-no-currency.twig@@ -1,7 +1,7 @@<div class="{{ classes }}" id="{{ name }}_holder"><label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label><div class="col-sm-8">- {{ Form.input('number', name, value, options) }}+ {{ Html.input('number', name, value).class('form-control').attribute('step','any').attribute('autocomplete','off').attribute('spellcheck','false') }}{% include 'form.help' %}{% include 'form.feedback' %}</div>diff --git a/resources/views/form/amount-small.twig b/resources/views/form/amount-small.twigindex 213c3f25ad..34abc84399 100644--- a/resources/views/form/amount-small.twig+++ b/resources/views/form/amount-small.twig@@ -1,24 +1 @@-<div class="input-group">- <div class="input-group-btn">- <button type="button"- class="btn btn-default dropdown-toggle currency-dropdown" id="currency_dropdown_{{ name }}" data-toggle="dropdown"- aria-expanded="false">- <span id="currency_select_symbol_{{ name }}">{{ defaultCurrency.symbol|raw }}</span> <span class="caret"></span>- </button>- <ul class="dropdown-menu currency-dropdown-menu" role="menu">- {% for currency in currencies %}- <li>- <a href="#"- class="currency-option"- data-id="{{ currency.id }}"- data-name="{{ name }}"- data-currency="{{ currency.code }}"- data-symbol="{{ currency.symbol|raw }}">{{ currency.name }}</a></li>- {% endfor %}- </ul>- </div>- {{ Form.input('number', name, value, options) }}---</div>-<input type="hidden" name="amount_currency_id_{{ name }}" value="{{ defaultCurrency.id }}"/>+TODO REPLACE MEdiff --git a/resources/views/form/amount.twig b/resources/views/form/amount.twigindex 4f318676b3..34abc84399 100644--- a/resources/views/form/amount.twig+++ b/resources/views/form/amount.twig@@ -1,33 +1 @@-<div class="{{ classes }}" id="{{ name }}_holder">- <label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>-- <div class="col-sm-8">- <div class="input-group">- <div class="input-group-btn">- <button type="button"- class="btn btn-default dropdown-toggle currency-dropdown" id="currency_dropdown_{{ name }}" data-toggle="dropdown"- aria-expanded="false">- <span id="currency_select_symbol_{{ name }}">{{ defaultCurrency.symbol|raw }}</span> <span class="caret"></span>- </button>- <ul class="dropdown-menu currency-dropdown-menu" role="menu">- {% for currency in currencies %}- <li>- <a href="#"- class="currency-option"- data-id="{{ currency.id }}"- data-name="{{ name }}"- data-currency="{{ currency.code }}"- data-symbol="{{ currency.symbol|raw }}">{{ currency.name }}</a></li>- {% endfor %}- </ul>- </div>- {{ Form.input('number', name, value, options) }}--- </div>-- {% include 'form.feedback' %}- </div>- <!-- Going to put in this value: {{ defaultCurrency.id }} -->- <input type="hidden" name="amount_currency_id_{{ name }}" value="{{ defaultCurrency.id }}" data-backup="{{ defaultCurrency.id }}"/>-</div>+TODO REPLACE MEdiff --git a/resources/views/form/assetAccountCheckList.twig b/resources/views/form/assetAccountCheckList.twigindex 836ab52449..13c085ffd2 100644--- a/resources/views/form/assetAccountCheckList.twig+++ b/resources/views/form/assetAccountCheckList.twig@@ -3,14 +3,14 @@<div class="col-sm-8">{% for groupName, accounts in grouped %}- <strong>{{ groupName }}</strong><br />+ <strong>{{ groupName }}</strong><br/>{% for id, account in accounts %}<div class="checkbox" style="margin-left:2em;"><label>{% if account in selected or (selected|length == 0 and options.select_all == true) %}- {{ Form.checkbox(name~'[]', id, true, options) }}+ {{ Html.checkbox(name~'[]',true).id(id) }}{% else %}- {{ Form.checkbox(name~'[]', id, false, options) }}+ {{ Form.checkbox(name~'[]',false).id(id) }}{% endif %}{{ account|escape }}</label>diff --git a/resources/views/form/balance.twig b/resources/views/form/balance.twigindex 627bd5ce8c..a9b69caf52 100644--- a/resources/views/form/balance.twig+++ b/resources/views/form/balance.twig@@ -1,33 +1 @@-<div class="{{ classes }}" id="{{ name }}_holder">- <label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>-- <div class="col-sm-8">- <div class="input-group">- <div class="input-group-btn">- <button type="button"- class="btn btn-default dropdown-toggle currency-dropdown" id="currency_dropdown_{{ name }}" data-toggle="dropdown"- aria-expanded="false">- <span id="currency_select_symbol_{{ name }}">{{ defaultCurrency.symbol|raw }}</span> <span class="caret"></span>- </button>- <ul class="dropdown-menu currency-dropdown-menu" role="menu">- {% for currency in currencies %}- <li>- <a href="#"- class="currency-option"- data-id="{{ currency.id }}"- data-name="{{ name }}"- data-currency="{{ currency.code }}"- data-symbol="{{ currency.symbol|raw }}">{{ currency.name }}</a></li>- {% endfor %}- </ul>- </div>- {{ Form.input('number', name, value, options) }}--- </div>-- {% include 'form.feedback' %}- </div>-- <input type="hidden" name="amount_currency_id_{{ name }}" value="{{ defaultCurrency.id }}"/>-</div>+TODO REMOVE MEdiff --git a/resources/views/form/checkbox.twig b/resources/views/form/checkbox.twigindex e235ffc557..9c65dbbfe1 100644--- a/resources/views/form/checkbox.twig+++ b/resources/views/form/checkbox.twig@@ -10,7 +10,7 @@<div class="{% if options.small %}col-sm-4{% else %}col-sm-8{% endif %}"><div class="checkbox"><label>- {{ Form.checkbox(name, value, options.checked, options) }}+ {{ Html.checkbox(name, options.checked, value) }}</label></div>{% include 'form.help' %}diff --git a/resources/views/form/date.twig b/resources/views/form/date.twigindex 4eba6608ea..7bd80eb22e 100644--- a/resources/views/form/date.twig+++ b/resources/views/form/date.twig@@ -6,7 +6,7 @@<div class="input-group-addon"><span class="fa fa-calendar"></span></div>- {{ Form.input('date', name, value, options) }}+ {{ Html.input('date', name, value).class('form-control').attribute('autocomplete','off').attribute('spellcheck','false') }}</div>{% include 'form.help' %}{% include 'form.feedback' %}diff --git a/resources/views/form/file.twig b/resources/views/form/file.twigindex 0533dda5dc..7f656e5c19 100644--- a/resources/views/form/file.twig+++ b/resources/views/form/file.twig@@ -2,7 +2,7 @@<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label><div class="col-sm-8">- {{ Form.file(name, options) }}+ {{ Html.input('file',name).attribute('multiple','multiple').class('form-control') }}{% include 'form.help' %}{% include 'form.feedback' %}</div>diff --git a/resources/views/form/integer.twig b/resources/views/form/integer.twigindex 1eac145903..535de496a3 100644--- a/resources/views/form/integer.twig+++ b/resources/views/form/integer.twig@@ -2,7 +2,7 @@<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label><div class="col-sm-8">- {{ Form.input('number', name, value, options) }}+ {{ Html.input('number', name, value).attribute('step',options.step).attribute('autocomplete','off').attribute('spellcheck', 'false').class('form-control') }}{% include 'form.help' %}{% include 'form.feedback' %}</div>diff --git a/resources/views/form/location.twig b/resources/views/form/location.twigindex df18f28068..a9b69caf52 100644--- a/resources/views/form/location.twig+++ b/resources/views/form/location.twig@@ -1,114 +1 @@-<div class="{{ classes }}" id="{{ name }}_holder">- <label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>- <div class="col-sm-8">- {% if config('firefly.mapbox_api_key') == '' %}- <p class="text-danger">- {{ trans('firefly.mapbox_api_key')|raw }}- </p>- {% else %}- <div id="{{ name }}_map" style="width:100%;height:300px;"></div>- <div id="{{ name }}_map_canvas"></div>- <p class="help-block">- {{ 'press_object_location'|_ }}- <button class="btn btn-default btn-xs" type="button" id="{{ name }}_clear_location">{{ 'clear_location'|_ }}</button>- </p>- {# latitude #}- <input type="hidden" name="{{ name }}_latitude" value="{{ options.locations[name].latitude|default('52.3167') }}"/>-- {# longitude #}- <input type="hidden" name="{{ name }}_longitude" value="{{ options.locations[name].longitude|default('5.5500') }}"/>-- {# zoomlevel #}- <input type="hidden" name="{{ name }}_zoom_level" value="{{ options.locations[name].zoom_level|default('6') }}"/>-- {# has location set? #}- <input type="hidden" name="{{ name }}_has_location" value="{{ options.locations[name].has_location|default('false') }}"/>- {% include 'form.feedback' %}- {% endif %}- </div>-</div>--{% if config('firefly.mapbox_api_key') != '' %}- {% set latitudevar = name~'_latitude' %}- {% set longitudevar = name~'_longitude' %}- {% set zoomlevelvar = name~'_zoom_level' %}- {% set haslocationvar = name~'_has_location' %}- {% set clearvar = name~'_clear_location' %}-- <script type="text/javascript" nonce="{{ JS_NONCE }}">- var mymap;- var marker;- if (typeof locations.{{ name }}.latitude === 'undefined') {- locations.{{ name }}.latitude = '52.3167';- }- if (typeof locations.{{ name }}.longitude === 'undefined') {- locations.{{ name }}.longitude = '5.5500';- }- if (typeof locations.{{ name }}.zoom_level === 'undefined') {- locations.{{ name }}.zoom_level = '6';- }-- if (typeof mapboxToken === 'undefined') {- var mapboxToken = 'invalid';- }- window.onload = function () {- document.getElementById('{{ clearvar }}').addEventListener('click', function () {- if (typeof marker !== 'undefined') {- marker.remove();- $('input[name="{{ haslocationvar }}"]').val('false');- $('input[name="{{ latitudevar }}"]').val('');- $('input[name="{{ longitudevar }}"]').val('');- $('input[name="{{ zoomlevelvar }}"]').val('');- }- });- };--- // set location thing:- function setObjectLocation(e) {- if (typeof e.latlng !== 'undefined') {- console.log('Set object location: lat(' + e.latlng.lat + '), long(' + e.latlng.lng + '), zoom (' + mymap.getZoom() + ')');- $('input[name="{{ latitudevar }}"]').val(e.latlng.lat);- $('input[name="{{ longitudevar }}"]').val(e.latlng.lng);- $('input[name="{{ haslocationvar }}"]').val('true');- }- if (typeof e.latlng === 'undefined') {- console.log('Set object zoom level to ' + mymap.getZoom());- }- $('input[name="{{ zoomlevelvar }}"]').val(mymap.getZoom());--- // remove existing marker:- if (typeof marker !== 'undefined' && typeof e.latlng !== 'undefined') {- marker.remove();- }- if (typeof e.latlng !== 'undefined') {- // new marker- marker = L.marker({lat: e.latlng.lat, lng: e.latlng.lng}).addTo(mymap);- }- }--- document.addEventListener("DOMContentLoaded", function () {- "use strict";-- // make map:- mymap = L.map('{{ name }}_map').setView({lat: locations.{{ name }}.latitude, lng: locations.{{ name }}.longitude}, locations.{{ name }}.zoom_level);-- L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?access_token={accessToken}', {- attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',- maxZoom: 18,- id: 'mapbox.streets',- accessToken: mapboxToken- }).addTo(mymap);-- mymap.on('contextmenu', setObjectLocation);- mymap.on('zoomend', setObjectLocation);-- // add marker- if (typeof locations.{{ name }}.has_location !== 'undefined' && locations.{{ name }}.has_location === true) {- marker = L.marker({lat: locations.{{ name }}.latitude, lng: locations.{{ name }}.longitude}).addTo(mymap);- }- });- </script>-{% endif %}+TODO REMOVE MEdiff --git a/resources/views/rules/rule-group/select-transactions.twig b/resources/views/rules/rule-group/select-transactions.twigindex e04b098681..842458804f 100644--- a/resources/views/rules/rule-group/select-transactions.twig+++ b/resources/views/rules/rule-group/select-transactions.twig@@ -6,7 +6,8 @@{% block content %}- <form method="POST" action="{{ route('rule-groups.execute', ruleGroup.id) }}" accept-charset="UTF-8" class="form-horizontal" id="execute-rule-group">+ <form method="POST" action="{{ route('rule-groups.execute', ruleGroup.id) }}" accept-charset="UTF-8"+ class="form-horizontal" id="execute-rule-group"><input name="_token" type="hidden" value="{{ csrf_token() }}"><div class="row">@@ -31,7 +32,8 @@</div></div><div class="box-footer">- <input type="submit" name="submit" value="{{ 'execute'|_ }}" id="do-execute-button" class="btn btn-success pull-right"/>+ <input type="submit" name="submit" value="{{ 'execute'|_ }}" id="do-execute-button"+ class="btn btn-success pull-right"/></div></div></div>@@ -39,12 +41,16 @@</form>{% endblock %}{% block scripts %}- <script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>+ <script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"+ nonce="{{ JS_NONCE }}"></script><script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>- <script type="text/javascript" src="v1/js/ff/rules/select-transactions.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>+ <script type="text/javascript" src="v1/js/ff/rules/select-transactions.js?v={{ FF_VERSION }}"+ nonce="{{ JS_NONCE }}"></script>{% endblock %}{% block styles %}- <link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all" nonce="{{ JS_NONCE }}">- <link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all" nonce="{{ JS_NONCE }}">+ <link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet"+ media="all" nonce="{{ JS_NONCE }}">+ <link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet"+ media="all" nonce="{{ JS_NONCE }}">{% endblock %}diff --git a/resources/views/tags/create.twig b/resources/views/tags/create.twigindex 3b3d080e92..7d466def5a 100644--- a/resources/views/tags/create.twig+++ b/resources/views/tags/create.twig@@ -10,7 +10,8 @@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" enctype="multipart/form-data">+ <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">@@ -33,7 +34,6 @@<div class="box-body">{{ 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>@@ -62,12 +62,15 @@{% endblock %}{% block scripts %}<script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>- <script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>+ <script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"+ nonce="{{ JS_NONCE }}"></script><script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script><script src="v1/js/ff/tags/create-edit.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>{% endblock %}{% block styles %}<link rel="stylesheet" href="v1/lib/leaflet/leaflet.css?v={{ FF_VERSION }}"/>- <link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all" nonce="{{ JS_NONCE }}">- <link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all" nonce="{{ JS_NONCE }}">+ <link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet"+ media="all" nonce="{{ JS_NONCE }}">+ <link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet"+ media="all" nonce="{{ JS_NONCE }}">{% endblock %}diff --git a/resources/views/tags/edit.twig b/resources/views/tags/edit.twigindex 112eb5f457..85614b5fc3 100644--- a/resources/views/tags/edit.twig+++ b/resources/views/tags/edit.twig@@ -38,7 +38,6 @@<div class="box-body">{{ 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>