Show BSB lookup on claim page
This commit is contained in:
parent
10f0cd4121
commit
b2913eac9d
@ -87,7 +87,12 @@
|
||||
</div>
|
||||
<div class="item">
|
||||
<i class="building icon"></i>
|
||||
<div class="content">BSB: {{ claim.payee_bsb }}</div>
|
||||
<div class="content">
|
||||
BSB: {{ claim.payee_bsb }}
|
||||
{% if bsb_lookedup %}
|
||||
({{ bsb_lookedup }})
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<i class="dollar sign icon"></i>
|
||||
|
@ -122,7 +122,12 @@
|
||||
</div>
|
||||
<div class="item">
|
||||
<i class="building icon"></i>
|
||||
<div class="content">BSB: {{ claim.payee_bsb }}</div>
|
||||
<div class="content">
|
||||
BSB: {{ claim.payee_bsb }}
|
||||
{% if bsb_lookedup %}
|
||||
({{ bsb_lookedup }})
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<i class="dollar sign icon"></i>
|
||||
|
@ -520,10 +520,13 @@ def claim_view(request, claim):
|
||||
except models.Budget.DoesNotExist:
|
||||
budget = None
|
||||
|
||||
bsb_lookedup = do_bsb_lookup(claim.payee_bsb)
|
||||
|
||||
return render(request, 'sstreasury/claim_view.html', {
|
||||
'claim': claim,
|
||||
'budget': budget,
|
||||
'history': history
|
||||
'history': history,
|
||||
'bsb_lookedup': bsb_lookedup
|
||||
})
|
||||
|
||||
@login_required
|
||||
@ -537,9 +540,12 @@ def claim_print(request, claim):
|
||||
except models.Budget.DoesNotExist:
|
||||
budget = None
|
||||
|
||||
bsb_lookedup = do_bsb_lookup(claim.payee_bsb)
|
||||
|
||||
return render(request, 'sstreasury/claim_print.html', {
|
||||
'claim': claim,
|
||||
'budget': budget
|
||||
'budget': budget,
|
||||
'bsb_lookedup': bsb_lookedup
|
||||
})
|
||||
|
||||
@login_required
|
||||
@ -728,12 +734,14 @@ def claim_processing(request):
|
||||
|
||||
@login_required
|
||||
def bsb_lookup(request):
|
||||
bsb = request.GET.get('bsb', '').replace('-', '').replace(' ', '')
|
||||
if len(bsb) != 6:
|
||||
return JsonResponse({'result': None})
|
||||
return JsonResponse({'result': do_bsb_lookup(bsb[:3] + '-' + bsb[-3:])})
|
||||
return JsonResponse({'result': do_bsb_lookup(request.GET.get('bsb', ''))})
|
||||
|
||||
def do_bsb_lookup(bsb):
|
||||
bsb = (bsb or '').replace('-', '').replace(' ', '')
|
||||
if len(bsb) != 6:
|
||||
return None
|
||||
bsb = '{}-{}'.format(bsb[:3], bsb[-3:])
|
||||
|
||||
with open(settings.BSB_FILE_PATH, 'r', newline='') as f:
|
||||
reader = csv.reader(f)
|
||||
for line in reader:
|
||||
|
Loading…
Reference in New Issue
Block a user