From e7e39ef66f8cad2b668989dfb35bb6f1c0728a69 Mon Sep 17 00:00:00 2001 From: Yingtong Li Date: Tue, 16 Jun 2020 12:28:07 +1000 Subject: [PATCH] Implement BSB lookup on claim edit page --- sstreasury/jinja2/sstreasury/claim_edit.html | 16 +++++++++++++++- sstreasury/views.py | 5 ++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sstreasury/jinja2/sstreasury/claim_edit.html b/sstreasury/jinja2/sstreasury/claim_edit.html index 28efb97..6cc60bd 100644 --- a/sstreasury/jinja2/sstreasury/claim_edit.html +++ b/sstreasury/jinja2/sstreasury/claim_edit.html @@ -76,10 +76,14 @@ -
+
+
+
+
{% if bsb_lookedup %}{{ bsb_lookedup }}{% endif %}
+
@@ -193,5 +197,15 @@ return el.classList.contains('totalrow'); } }); + + $('input[name="payee_bsb"]').blur(function() { + $.get('{{ url('bsb_lookup') }}?bsb=' + this.value, function(data, status, xhr) { + if (data.result) { + $('#bsb_lookedup').text(data.result); + } else { + $('#bsb_lookedup').text(''); + } + }); + }) {% endblock %} diff --git a/sstreasury/views.py b/sstreasury/views.py index af809e0..4cedc83 100644 --- a/sstreasury/views.py +++ b/sstreasury/views.py @@ -585,8 +585,11 @@ def claim_edit(request, claim): else: return redirect(reverse('claim_edit', kwargs={'id': claim.id})) else: + bsb_lookedup = do_bsb_lookup(claim.payee_bsb) + return render(request, 'sstreasury/claim_edit.html', { - 'claim': claim + 'claim': claim, + 'bsb_lookedup': bsb_lookedup }) @login_required