mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Edit JS file for split transaction
This commit is contained in:
parent
9c09f93908
commit
e336a45f79
@ -112,7 +112,7 @@ class SplitController extends Controller
|
||||
Session::forget('transactions.edit-split.fromUpdate');
|
||||
|
||||
return view(
|
||||
'transactions.edit-split',
|
||||
'transactions.split.edit',
|
||||
compact(
|
||||
'subTitleIcon', 'currencies', 'optionalFields',
|
||||
'preFilled', 'subTitle', 'amount', 'sourceAccounts', 'uploadSize', 'destinationAccounts', 'assetAccounts',
|
||||
|
@ -33,7 +33,9 @@ $(document).ready(function () {
|
||||
var opt = {
|
||||
typeahead: {
|
||||
source: data,
|
||||
afterSelect: function(val) { this.$element.val(""); }
|
||||
afterSelect: function () {
|
||||
this.$element.val("");
|
||||
}
|
||||
}
|
||||
};
|
||||
$('input[name="tags"]').tagsinput(
|
||||
@ -94,6 +96,4 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
@ -10,5 +10,48 @@
|
||||
|
||||
$(document).ready(function () {
|
||||
"use strict";
|
||||
// no special JS for edit transaction.
|
||||
|
||||
// withdrawal specific fields
|
||||
if (what == 'withdrawal') {
|
||||
|
||||
$.getJSON('json/expense-accounts').done(function (data) {
|
||||
$('input[name="destination_account_name"]').typeahead({source: data});
|
||||
});
|
||||
}
|
||||
|
||||
// deposit specific fields:
|
||||
if (what == 'deposit') {
|
||||
$.getJSON('json/revenue-accounts').done(function (data) {
|
||||
$('input[name="source_account_name"]').typeahead({source: data});
|
||||
});
|
||||
}
|
||||
|
||||
// tags are always present:
|
||||
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
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// description
|
||||
$.getJSON('json/transaction-journals/' + what).done(function (data) {
|
||||
$('input[name="description"]').typeahead({source: data});
|
||||
});
|
||||
|
||||
// category (always there)
|
||||
$.getJSON('json/categories').done(function (data) {
|
||||
$('input[name="category"]').typeahead({source: data});
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -1,19 +1,20 @@
|
||||
/*
|
||||
* from-store.js
|
||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This software may be modified and distributed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
* edit.js
|
||||
* 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.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
/** global: originalSum, accounting */
|
||||
|
||||
var destAccounts = {};
|
||||
var srcAccounts = {};
|
||||
var categories = {};
|
||||
$(function () {
|
||||
var descriptions = {};
|
||||
|
||||
$(document).ready(function () {
|
||||
"use strict";
|
||||
$('.btn-do-split').click(cloneRow);
|
||||
$('.remove-current-split').click(removeRow);
|
||||
@ -33,13 +34,32 @@ $(function () {
|
||||
$('input[name$="category]"]').typeahead({source: categories});
|
||||
});
|
||||
|
||||
$.getJSON('json/transaction-journals/' + what).done(function (data) {
|
||||
descriptions = data;
|
||||
$('input[name="journal_description"]').typeahead({source: descriptions});
|
||||
$('input[name$="description]"]').typeahead({source: descriptions});
|
||||
});
|
||||
|
||||
$.getJSON('json/tags').done(function (data) {
|
||||
|
||||
var opt = {
|
||||
typeahead: {
|
||||
source: data,
|
||||
afterSelect: function () {
|
||||
this.$element.val("");
|
||||
}
|
||||
}
|
||||
};
|
||||
$('input[name="tags"]').tagsinput(
|
||||
opt
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
$('input[name$="][amount]"]').on('input', calculateSum);
|
||||
|
||||
// add auto complete:
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
function removeRow(e) {
|
||||
"use strict";
|
||||
var rows = $('table.split-table tbody tr');
|
||||
@ -75,6 +95,9 @@ function cloneRow() {
|
||||
if (categories.length > 0) {
|
||||
source.find('input[name$="category]"]').typeahead({source: categories});
|
||||
}
|
||||
if (descriptions.length > 0) {
|
||||
source.find('input[name$="description]"]').typeahead({source: descriptions});
|
||||
}
|
||||
|
||||
$('.split-table tbody').append(source);
|
||||
|
@ -307,6 +307,5 @@
|
||||
</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/split/journal/from-store.js"></script>
|
||||
<script type="text/javascript" src="js/ff/transactions/split/edit.js"></script>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user