Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Update views and JS for create (single) transaction.
James Cole582398e7f66a
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.phpindex 83f3b93dc9..b887c26d07 100644--- a/app/Http/Controllers/Transaction/SingleController.php+++ b/app/Http/Controllers/Transaction/SingleController.php@@ -113,7 +113,9 @@ class SingleController extends Controllerasort($piggies);- return view('transactions.create', compact('assetAccounts', 'subTitleIcon', 'uploadSize', 'budgets', 'what', 'piggies', 'subTitle', 'optionalFields'));+ return view(+ 'transactions.single.create', compact('assetAccounts', 'subTitleIcon', 'uploadSize', 'budgets', 'what', 'piggies', 'subTitle', 'optionalFields')+ );}/**@@ -317,7 +319,7 @@ class SingleController extends Controller$data = $request->getJournalData();$journal = $repository->update($journal, $data);/** @var array $files */- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;$this->attachments->saveAttachmentsForModel($journal, $files);// flash errorsdiff --git a/public/js/ff/transactions/create.js b/public/js/ff/transactions/single/create.jssimilarity index 72%rename from public/js/ff/transactions/create.jsrename to public/js/ff/transactions/single/create.jsindex aaed65207a..a4b8f5e551 100644--- a/public/js/ff/transactions/create.js+++ b/public/js/ff/transactions/single/create.js@@ -1,9 +1,7 @@/** create.js- * Copyright (C) 2016 [email protected]- *- * This software may be modified and distributed under the terms of the- * Creative Commons Attribution-ShareAlike 4.0 International License.+ * Copyright (c) 2017 [email protected]+ * This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.** See the LICENSE file for details.*/@@ -19,11 +17,57 @@ $(document).ready(function () {updateButtons();updateForm();updateLayout();+ updateDescription();}+ // get JSON things:+ getJSONautocomplete();});+function updateDescription() {+ $.getJSON('json/transaction-journals/' + what).done(function (data) {+ $('input[name="description"]').typeahead('destroy');+ $('input[name="description"]').typeahead({source: data});+ });+}++function getJSONautocomplete() {++ // for withdrawals+ $.getJSON('json/expense-accounts').done(function (data) {+ $('input[name="destination_account_name"]').typeahead({source: data});+ });++ // for tags:+ if ($('input[name="tags"]').length > 0) {+ $.getJSON('json/tags').done(function (data) {++ var opt = {+ typeahead: {+ source: data,+ afterSelect: function () {+ this.$element.val("");+ }+ }+ };+ $('input[name="tags"]').tagsinput(+ opt+ );+ });+ }++ // for deposits+ $.getJSON('json/revenue-accounts').done(function (data) {+ $('input[name="source_account_name"]').typeahead({source: data});+ });++ $.getJSON('json/categories').done(function (data) {+ $('input[name="category"]').typeahead({source: data});+ });++}+function updateLayout() {"use strict";$('#subTitle').text(title[what]);@@ -131,6 +175,7 @@ function clickButton(e) {updateButtons();updateForm();updateLayout();+ updateDescription();}return false;}\ No newline at end of filediff --git a/resources/views/transactions/create.twig b/resources/views/transactions/single/create.twigsimilarity index 98%rename from resources/views/transactions/create.twigrename to resources/views/transactions/single/create.twigindex f978027d70..2b4f3aaaff 100644--- a/resources/views/transactions/create.twig+++ b/resources/views/transactions/single/create.twig@@ -223,8 +223,7 @@</script><script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js"></script><script type="text/javascript" src="js/lib/bootstrap-tagsinput.min.js"></script>- <script type="text/javascript" src="js/ff/transactions/create-edit.js"></script>- <script type="text/javascript" src="js/ff/transactions/create.js"></script>+ <script type="text/javascript" src="js/ff/transactions/single/create.js"></script>{% endblock %}{% block styles %}