Fix automatically syncing amounts when editing simple transaction
This commit is contained in:
parent
ca7cbf6481
commit
9f72404aed
@ -97,7 +97,7 @@
|
||||
{{ 'Edit' if transaction and transaction.id else 'New' }} transaction
|
||||
</h1>
|
||||
|
||||
<form method="POST">
|
||||
<form method="POST" id="edit-transaction-form">
|
||||
<table class="min-w-full">
|
||||
<thead>
|
||||
<tr class="border-b border-gray-300">
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user