fixed bug where insert cset did not show it in menu until a full reload
This commit is contained in:
4
BUGS
4
BUGS
@@ -1,7 +1,3 @@
|
|||||||
* Add a cset, and it does not appear in the compare_to menu until another reload
|
|
||||||
- main.py:119 -- need insert_cset to return id, name, and the 200 success,
|
|
||||||
and then the jscript can insert the option into the select
|
|
||||||
|
|
||||||
* with future bills - recalculate bills button blows away growth!
|
* with future bills - recalculate bills button blows away growth!
|
||||||
- BUT, I think just loading the bills page puts it back -- need to validate and fix if so
|
- BUT, I think just loading the bills page puts it back -- need to validate and fix if so
|
||||||
|
|
||||||
|
|||||||
5
main.py
5
main.py
@@ -117,8 +117,9 @@ def index():
|
|||||||
|
|
||||||
@app.route('/save', methods=['POST'])
|
@app.route('/save', methods=['POST'])
|
||||||
def save():
|
def save():
|
||||||
insert_cset( request.get_json() )
|
cset_id=insert_cset( request.get_json() )
|
||||||
return "200"
|
name = request.get_json()['vars']['name']
|
||||||
|
return jsonify( cset_id=cset_id, name=name )
|
||||||
|
|
||||||
@app.route('/update', methods=['POST'])
|
@app.route('/update', methods=['POST'])
|
||||||
def update():
|
def update():
|
||||||
|
|||||||
@@ -230,7 +230,12 @@
|
|||||||
$(function() { $('[data-bs-toggle="popover"]').popover(); });
|
$(function() { $('[data-bs-toggle="popover"]').popover(); });
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
$('#Sell_shares').val( {{finance['Sell_shares']}} )
|
$('#Sell_shares').val( {{finance['Sell_shares']}} )
|
||||||
|
{% if finance['compare_to'] %}
|
||||||
$('#compare_to').val( {{finance['compare_to']}} )
|
$('#compare_to').val( {{finance['compare_to']}} )
|
||||||
|
{% else %}
|
||||||
|
// set this to Nothing by default
|
||||||
|
$('#compare_to').val( 0 )
|
||||||
|
{% endif %}
|
||||||
$('#Ioniq6_future').val( {{finance['Ioniq6_future']}} )
|
$('#Ioniq6_future').val( {{finance['Ioniq6_future']}} )
|
||||||
|
|
||||||
if( $("#Ioniq6_future option:selected"). text() == 'lease' )
|
if( $("#Ioniq6_future option:selected"). text() == 'lease' )
|
||||||
@@ -434,13 +439,17 @@
|
|||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||||
<button type="button" class="btn btn-info"
|
<button type="button" class="btn btn-info"
|
||||||
onClick="
|
onClick="
|
||||||
vars['name']=$('#save_name').val();
|
vars['name'] = $('#save_name').val();
|
||||||
$.ajax( {
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/save',
|
url: '/save',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
data: JSON.stringify( { 'vars': vars, 'savings_data' :savingsData } ),
|
data: JSON.stringify({ 'vars': vars, 'savings_data': savingsData }),
|
||||||
success: function() { $('#save_modal').modal('hide'); } } )"
|
success: function(resp) {
|
||||||
|
$('#save_modal').modal('hide');
|
||||||
|
$('#compare_to').append($('<option>', { value: resp.cset_id, text: resp.name }));
|
||||||
|
}
|
||||||
|
});"
|
||||||
>Save</button>
|
>Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user