mirror of
https://github.com/seigler/govobject-proposal
synced 2025-07-27 06:46:10 +00:00
bugfix and refactor total amount calculation
This commit is contained in:
parent
f95f0cc29b
commit
ac7a8eac01
1 changed files with 13 additions and 12 deletions
25
index.html
25
index.html
|
@ -61,6 +61,15 @@
|
|||
return gov;
|
||||
};
|
||||
|
||||
var updateTotal = function() {
|
||||
paymentCycle.selectedPeriods = $('#end_epoch').find(':selected').data('index');
|
||||
|
||||
var payment_amount = parseInt($('#payment_amount').val());
|
||||
var periods = parseInt((paymentCycle.selectedPeriods+1)-paymentCycle.selectedStartIndex);
|
||||
|
||||
$('#total_amount').text(payment_amount * periods);
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var gov = init('testnet', testnetProvider); // default network;
|
||||
|
@ -71,24 +80,16 @@
|
|||
$('#start_epoch').change(function() {
|
||||
paymentCycle.selectedStartIndex = $('#start_epoch').find(':selected').data('index');
|
||||
paymentCycle.updateEndEpoch();
|
||||
|
||||
updateTotal();
|
||||
});
|
||||
|
||||
$('#end_epoch').change(function() {
|
||||
paymentCycle.selectedPeriods = $('#end_epoch').find(':selected').data('index');
|
||||
|
||||
var payment_amount = parseInt($('#payment_amount').val());
|
||||
var periods = parseInt(paymentCycle.selectedPeriods+1);
|
||||
|
||||
$('#total_amount').text(payment_amount * periods);
|
||||
updateTotal();
|
||||
});
|
||||
|
||||
$('#payment_amount').change(function() {
|
||||
paymentCycle.selectedPeriods = $('#end_epoch').find(':selected').data('index');
|
||||
|
||||
var payment_amount = parseInt($('#payment_amount').val());
|
||||
var periods = parseInt(paymentCycle.selectedPeriods+1);
|
||||
|
||||
$('#total_amount').text(payment_amount * periods);
|
||||
updateTotal();
|
||||
});
|
||||
|
||||
$("#time").val(Math.floor((new Date).getTime() / 1000));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue