diff --git a/drcr/templates/general_journal/general_journal_edit.html b/drcr/templates/general_journal/general_journal_edit.html index 0530ec7..7a4f1d9 100644 --- a/drcr/templates/general_journal/general_journal_edit.html +++ b/drcr/templates/general_journal/general_journal_edit.html @@ -57,7 +57,7 @@
$
- +
@@ -66,7 +66,7 @@
$
- +
{% endif %} @@ -89,7 +89,7 @@
$
- +
@@ -111,7 +111,7 @@
$
- +
@@ -149,12 +149,29 @@ let trPosting = el.parentNode.parentNode.parentNode; let sign = trPosting.querySelector('select').value; // Use same sign as row clicked - let inputAmount = '
$
'; + let inputAmount = '
$
'; // Add new posting row let trNew = document.createElement('tr'); trNew.innerHTML = '
' + (sign === 'dr' ? ('' + inputAmount + '') : '') + (sign === 'cr' ? ('' + inputAmount + '') : '') + ''; trPosting.after(trNew); } + + function changeAmount(el) { + let amountInputs = document.querySelectorAll('input[name="amount"]'); + if (amountInputs.length === 2) { + // Get other input + let otherInput; + for (inp of amountInputs) { + if (inp !== el) { + otherInput = inp; + break; + } + } + + // Update other input with amount + otherInput.value = el.value; + } + } {% endblock %}