Make sure edit of liability always works.

This commit is contained in:
James Cole
2023-01-15 07:20:58 +01:00
parent 1f9e0b48c9
commit 7111aec101
5 changed files with 31 additions and 3 deletions

View File

@@ -30,5 +30,21 @@ $(document).ready(function () {
}
);
}
// change the 'ffInput_opening_balance' text based on the
// selection of the direction.
$("#ffInput_liability_direction").change(triggerDirection);
triggerDirection();
});
function triggerDirection() {
let obj = $("#ffInput_liability_direction");
let direction = obj.val();
console.log('Direction is now ' + direction);
if('credit' === direction) {
$('label[for="ffInput_opening_balance"]').text(iAmOwed);
}
if('debit' === direction) {
$('label[for="ffInput_opening_balance"]').text(iOwe);
}
}