Implement BSB lookup on claim edit page
This commit is contained in:
parent
b2913eac9d
commit
e7e39ef66f
@ -76,10 +76,14 @@
|
||||
<label class="three wide column">Payee name</label>
|
||||
<input class="eleven wide column" type="text" name="payee_name" value="{{ claim.payee_name }}">
|
||||
</div>
|
||||
<div class="ui required inline grid field">
|
||||
<div class="ui required inline grid field" style="margin-bottom: 0.5em;">
|
||||
<label class="three wide column">Payee BSB</label>
|
||||
<input class="eleven wide column" type="text" name="payee_bsb" value="{{ claim.payee_bsb }}">
|
||||
</div>
|
||||
<div class="ui inline grid field" style="margin-top: 0.5em;">
|
||||
<div class="three wide column" style="padding-top: 0; padding-bottom: 0;"></div>
|
||||
<div class="eleven wide column" style="padding-top: 0; padding-bottom: 0;" id="bsb_lookedup">{% if bsb_lookedup %}{{ bsb_lookedup }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="ui required inline grid field">
|
||||
<label class="three wide column">Payee account number</label>
|
||||
<input class="eleven wide column" type="text" name="payee_account" value="{{ claim.payee_account }}">
|
||||
@ -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('');
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user