make radio button for min / avg / max growth value be pushed into which_growth in the DB for bill_type row, then also delete estimated bills for that bill_type, and then calling /bills, causes the estimated bills to be filled back in based on the new chosen growth model
This commit is contained in:
@@ -54,18 +54,21 @@
|
||||
<script>$('#bill-type-freq-{{bt.id}}').val( {{bt.freq}} );</script>
|
||||
<div class="px-0 col-2">
|
||||
<div class="btn-group w-100" role="group">
|
||||
<input type="radio" class="btn-check" name="bill-type-growth-{{bt.id}}" id="bill-type-growth-min-{{bt.id}}" autocomplete="off" value=min-g-{{bt.id}}>
|
||||
<label class="btn btn-outline-secondary" for="bill-type-growth-min-{{bt.id}}">
|
||||
<input type="radio" class="btn-check" name="growth-{{bt.id}}" id="min-{{bt.id}}" autocomplete="off"
|
||||
onChange="UseGrowth({{bt.id}}, 'min')" {% if bt.which_growth == 'min' %}checked{% endif %}>
|
||||
<label class="btn btn-outline-secondary" for="min-{{bt.id}}">
|
||||
{% if bt.ann_growth_min < 10 %} {% endif %}
|
||||
{{'%.2f'|format(bt.ann_growth_min)}}
|
||||
</label>
|
||||
<input type="radio" class="btn-check" name="bill-type-growth-{{bt.id}}" id="bill-type-growth-avg-{{bt.id}}" autocomplete="off" checked value=avg-g-{{bt.id}}>
|
||||
<label class="btn btn-outline-secondary" for="bill-type-growth-avg-{{bt.id}}">
|
||||
<input type="radio" class="btn-check" name="growth-{{bt.id}}" id="avg-{{bt.id}}" autocomplete="off"
|
||||
onChange="UseGrowth({{bt.id}}, 'avg')" {% if bt.which_growth == 'avg' %}checked{% endif %}>
|
||||
<label class="btn btn-outline-secondary" for="avg-{{bt.id}}">
|
||||
{% if bt.ann_growth_avg < 10 %} {% endif %}
|
||||
{{'%.2f'|format(bt.ann_growth_avg)}}
|
||||
</label>
|
||||
<input type="radio" class="btn-check" name="bill-type-growth-{{bt.id}}" id="bill-type-growth-max-{{bt.id}}" autocomplete="off" value=max-g-{{bt.id}}>
|
||||
<label class="btn btn-outline-secondary" for="bill-type-growth-max-{{bt.id}}">
|
||||
<input type="radio" class="btn-check" name="growth-{{bt.id}}" id="max-{{bt.id}}" autocomplete="off"
|
||||
onChange="UseGrowth({{bt.id}}, 'max')" {% if bt.which_growth == 'max' %}checked{% endif %}>
|
||||
<label class="btn btn-outline-secondary" for="max-{{bt.id}}">
|
||||
{% if bt.ann_growth_max < 10 %} {% endif %}
|
||||
{{'%.2f'|format(bt.ann_growth_max)}}
|
||||
</label>
|
||||
@@ -310,6 +313,12 @@
|
||||
data: JSON.stringify( { 'id': id } ), success: function() { window.location='bills' } } )
|
||||
}
|
||||
|
||||
function UseGrowth( bt, which )
|
||||
{
|
||||
$.ajax( { type: 'POST', url: '/usegrowth', contentType: 'application/json',
|
||||
data: JSON.stringify( { 'bill_type': bt, 'which_growth': which } ), success: function() { window.location='bills' } } )
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
// if amount has enter key in it then save, but dont do this for other fields in new bill
|
||||
$("#new-bill-data-amount").keyup(function(event){ if(event.which == 13){ $("#save-bill").click(); } event.preventDefault(); });
|
||||
|
||||
Reference in New Issue
Block a user