mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Edit JS file for split transaction
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user