From a9a9537fed646400b273842fe99c19f7de8c0fc6 Mon Sep 17 00:00:00 2001 From: Satinder Grewal Date: Thu, 2 Feb 2017 21:04:04 +1300 Subject: [PATCH] 2 Important Bugs fixed in send transaction screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - if user hit on confirm button twice the same amount of transaction goes twice! Even while the transaction is being processed at the time! It is fixed. - Second bug I found while testing is if I send a transaction and it completes. And I’m still on that same send transaction screen. I make second transaction. When I confirm to send this transaction, not just this transaction is processed to send, but the previous transaction as well!!! It is also fixed. --- assets/scripts/dashboard.js | 76 ++++++++++++++++++++++++++---------- assets/scripts/iguana_api.js | 6 +-- index.html | 53 +++++++++++++++++++++---- 3 files changed, 103 insertions(+), 32 deletions(-) diff --git a/assets/scripts/dashboard.js b/assets/scripts/dashboard.js index 6535a4e..356f5eb 100644 --- a/assets/scripts/dashboard.js +++ b/assets/scripts/dashboard.js @@ -1,6 +1,11 @@ var RunTotalFiatValue = ''; var ExecuteShowCoinHistory = ''; +var active_edexcoin = ''; +var tmp_send_to_addr = ''; +var tmp_send_total_amount = ''; +var edexcoin_send_form_validator = ''; + var Dashboard = function() { @@ -74,7 +79,6 @@ var Dashboard = function() { var handle_edex_send = function() { $('#btn_edexcoin_send').click(function() { - var active_edexcoin = $('[data-edexcoin]').attr("data-edexcoin"); //console.log(active_edexcoin); sessionStorage.setItem('edexTmpRefresh', "stop"); @@ -154,7 +158,7 @@ var Dashboard = function() { } }); - $('.edexcoin-send-form').validate({ + edexcoin_send_form_validator = $('.edexcoin-send-form').validate({ //errorElement: 'span', //default input error message container //errorClass: 'help-block', // default input error message class //focusInvalid: false, // do not focus the last invalid input @@ -212,7 +216,7 @@ var Dashboard = function() { $('#mdl_confirm_currency_sendfrom_total_dedcut').text($('#edexcoin_total_value').text()); $('#mdl_confirm_currency_coinname_total').text($('[data-edexcoin]').attr("data-edexcoin")); - $('#SendCoinModelStep2').modal('show') + //$('#SendCoinModelStep2').modal('show') console.log('==> Before confirming tx to send') console.log($('[data-edexcoin]').attr("data-edexcoin")) @@ -224,28 +228,58 @@ var Dashboard = function() { //var tmp_send_from_addr = $('#edexcoin_send_from').val(); var tmp_send_to_addr = $('#edexcoin_sendto').val(); var tmp_send_total_amount = $('#edexcoin_total_value').text(); - $('.edexcoin-send-form')[0].reset(); - - $('#edexcoin_send_coins_btn').click(function() { - $('#edexcoin_send_coins_btn').prop('disabled', true); - console.log('==> After confirming tx to send') - console.log(active_edexcoin) - console.log(tmp_send_to_addr) - console.log(tmp_send_total_amount) - var tmp_json_data = {'coin':active_edexcoin,'sendtoaddr':tmp_send_to_addr,'amount':tmp_send_total_amount}; - console.log(tmp_json_data); - var tmp_sendtoaddr_output = EDEXSendToAddr(tmp_json_data); - //console.log(tmp_sendtoaddr_output); - //console.log(tmp_sendtoaddr_output[0]); - $('#SendCoinModelStep2').modal('hide') - var edexcoin_sendto_result_tbl = ''; - edexcoin_sendto_result_tbl += 'InfoThe transaction submitted is processing. Once processed the transaction details will be displayed here.'; - $('#edexcoin_sendto_result tbody').html(edexcoin_sendto_result_tbl); - }); + $('#edexcoin-send-screen').hide(); + $('#edexcoin-send-confirm-screen').show(); NProgress.done(); } }); + $('#edexcoin_send_coins_btn').click(function() { + $('#edexcoin_send_coins_btn').prop('disabled', true); + console.log('==> After confirming tx to send') + var active_edexcoin = $('[data-edexcoin]').attr("data-edexcoin"); + //var tmp_send_from_addr = $('#edexcoin_send_from').val(); + var tmp_send_to_addr = $('#edexcoin_sendto').val(); + var tmp_send_total_amount = $('#edexcoin_total_value').text(); + console.log(active_edexcoin) + console.log(tmp_send_to_addr) + console.log(tmp_send_total_amount) + + var edexcoin_sendto_result_tbl = ''; + edexcoin_sendto_result_tbl += 'InfoThe transaction submitted is processing. Once processed the transaction details will be displayed here.'; + $('#edexcoin_sendto_result tbody').html(edexcoin_sendto_result_tbl); + + var tmp_json_data = {'coin':active_edexcoin,'sendtoaddr':tmp_send_to_addr,'amount':tmp_send_total_amount}; + console.log(tmp_json_data); + EDEXSendToAddr(tmp_json_data); + //console.log(tmp_sendtoaddr_output); + //console.log(tmp_sendtoaddr_output[0]); + //$('#SendCoinModelStep2').modal('hide') + $('.edexcoin-send-form')[0].reset(); + $('#edexcoin_total_value').text('0.000'); + + $('#edexcoin-send-confirm-screen').hide(); + $('#edexcoin-send-txdetails-screen').show(); + edexcoin_send_form_validator.resetForm(); + }); + + $('#edexcoin_send_coins_back_btn').click(function() { + $('#edexcoin-send-confirm-screen').hide(); + $('#edexcoin-send-txdetails-screen').hide(); + $('#edexcoin-send-screen').show(); + var active_edexcoin = ''; + var tmp_send_to_addr = ''; + var tmp_send_total_amount = ''; + edexcoin_send_form_validator.resetForm(); + }); + $('#edexcoin_send_coins_anothertx_btn').click(function() { + $( "#edexcoin_send_coins_back_btn" ).trigger( "click" ); + var active_edexcoin = ''; + var tmp_send_to_addr = ''; + var tmp_send_total_amount = ''; + edexcoin_send_form_validator.resetForm(); + }); + $('.edexcoin_sendto_result').on('click', '.edexcoin_sendto_output_result', function(e){ var selected_coin = $(this).data('edexcoin') var selected_coin_mode = sessionStorage.getItem('edexTmpMode'); diff --git a/assets/scripts/iguana_api.js b/assets/scripts/iguana_api.js index 744e584..98084e6 100644 --- a/assets/scripts/iguana_api.js +++ b/assets/scripts/iguana_api.js @@ -673,18 +673,18 @@ function EDEXSendToAddr(data) { var edexcoin_sendto_result_tbl = ''; if ( SendToAddrData.error !== undefined ) { - //console.log(SendToAddrData.error); toastr.error("Sent Transaction failed. Please check send Transaction page for details.", "Wallet Notification"); edexcoin_sendto_result_tbl += 'error' + SendToAddrData.error + ''; + $('#edexcoin_sendto_result tbody').html(edexcoin_sendto_result_tbl); } if ( SendToAddrData.complete !== undefined ) { - toastr.info("Transaction sent successfully. Please check send Transaction page for details.", "Wallet Notification"); + toastr.success("Transaction sent successfully. Check send section for details.", "Wallet Notification"); edexcoin_sendto_result_tbl += 'complete' + SendToAddrData.complete + '' edexcoin_sendto_result_tbl += 'result' + SendToAddrData.result + '' edexcoin_sendto_result_tbl += 'sendrawtransaction' + SendToAddrData.sendrawtransaction + '' edexcoin_sendto_result_tbl += 'signedtx' + SendToAddrData.signedtx + '' + $('#edexcoin_sendto_result tbody').html(edexcoin_sendto_result_tbl); } - $('#edexcoin_sendto_result tbody').html(edexcoin_sendto_result_tbl); var active_edexcoin = $('[data-edexcoin]').attr("data-edexcoin"); var selected_coinmode = sessionStorage.getItem('edexTmpMode') diff --git a/index.html b/index.html index 10595cf..4a8abda 100755 --- a/index.html +++ b/index.html @@ -830,8 +830,8 @@ - -
+ +

Send

+
+ +
+ +
-
+
@@ -953,7 +990,7 @@ -
-
+
-->