Also in create form.

This commit is contained in:
James Cole 2023-01-15 07:21:51 +01:00
parent 7111aec101
commit 7e6ce7c3e8
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
2 changed files with 21 additions and 0 deletions

View File

@ -30,4 +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);
}
}

View File

@ -84,6 +84,10 @@
</form>
{% endblock %}
{% block scripts %}
<script type="text/javascript" nonce="{{ JS_NONCE }}">
var iAmOwed = '{{ 'i_am_owed_amount'|_|escape('js') }}';
var iOwe = '{{ 'i_owe_amount'|_|escape('js') }}';
</script>
<script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>