mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 07:08:19 +00:00
Update views and JS for create (single) transaction.
This commit is contained in:
@@ -113,7 +113,9 @@ class SingleController extends Controller
|
|||||||
|
|
||||||
asort($piggies);
|
asort($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();
|
$data = $request->getJournalData();
|
||||||
$journal = $repository->update($journal, $data);
|
$journal = $repository->update($journal, $data);
|
||||||
/** @var array $files */
|
/** @var array $files */
|
||||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||||
$this->attachments->saveAttachmentsForModel($journal, $files);
|
$this->attachments->saveAttachmentsForModel($journal, $files);
|
||||||
|
|
||||||
// flash errors
|
// flash errors
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* create.js
|
* create.js
|
||||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||||
*
|
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
* 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.
|
* See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
@@ -19,11 +17,57 @@ $(document).ready(function () {
|
|||||||
updateButtons();
|
updateButtons();
|
||||||
updateForm();
|
updateForm();
|
||||||
updateLayout();
|
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() {
|
function updateLayout() {
|
||||||
"use strict";
|
"use strict";
|
||||||
$('#subTitle').text(title[what]);
|
$('#subTitle').text(title[what]);
|
||||||
@@ -131,6 +175,7 @@ function clickButton(e) {
|
|||||||
updateButtons();
|
updateButtons();
|
||||||
updateForm();
|
updateForm();
|
||||||
updateLayout();
|
updateLayout();
|
||||||
|
updateDescription();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -223,8 +223,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js"></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/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/single/create.js"></script>
|
||||||
<script type="text/javascript" src="js/ff/transactions/create.js"></script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
Reference in New Issue
Block a user