From 9f72404aed8a4a86c8141f9d3314c5f078b4f828 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sat, 6 Apr 2024 18:55:27 +1100 Subject: [PATCH] Fix automatically syncing amounts when editing simple transaction --- .../templates/journal/journal_edit_transaction.html | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drcr/templates/journal/journal_edit_transaction.html b/drcr/templates/journal/journal_edit_transaction.html index a989a5c..c37ac3d 100644 --- a/drcr/templates/journal/journal_edit_transaction.html +++ b/drcr/templates/journal/journal_edit_transaction.html @@ -97,7 +97,7 @@ {{ 'Edit' if transaction and transaction.id else 'New' }} transaction -
+ @@ -220,19 +220,14 @@ } function changeAmount(el) { - let amountInputs = document.querySelectorAll('input[name="amount"]'); + let amountInputs = document.querySelectorAll('#edit-transaction-form 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 + inp.value = el.value; } } - - // Update other input with amount - otherInput.value = el.value; } }