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