From 3d255b6d72725553a9c032e3b32b6fe0fafc3521 Mon Sep 17 00:00:00 2001 From: snogcel Date: Sun, 18 Dec 2016 19:28:40 -0700 Subject: [PATCH] adjust payment cycle selectors --- index.html | 9 +++++++-- js/paymentCycle.js | 20 ++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 6747f18..744bd00 100755 --- a/index.html +++ b/index.html @@ -65,9 +65,14 @@ paymentCycle.selectedPeriods = $('#end_epoch').find(':selected').data('index'); var payment_amount = parseInt($('#payment_amount').val()); + if (isNaN(payment_amount)) payment_amount = 0; + var periods = parseInt((paymentCycle.selectedPeriods+1)-paymentCycle.selectedStartIndex); + var label = $('#end_epoch').find(':selected').data('label'); + $('#total_amount').text(payment_amount * periods); + $('#total_amount_due').text(" with a final payment on " + label); }; $(document).ready(function() { @@ -299,7 +304,7 @@
- +
@@ -336,7 +341,7 @@
- 0 DASH + 0 DASH
diff --git a/js/paymentCycle.js b/js/paymentCycle.js index 4d6296b..8741bf4 100755 --- a/js/paymentCycle.js +++ b/js/paymentCycle.js @@ -100,12 +100,17 @@ PaymentCycle.prototype.updateDropdowns = function() { var superblock = this.getNextSuperblock(blockHeight); var timestamp = this.getBlockTimestamp(superblock); + var before = this.getBlockTimestamp((superblock-(this.paymentCycle/2))); + var after = this.getBlockTimestamp((superblock+(this.paymentCycle/2))); + var label = new Date(timestamp).toLocaleDateString(); if (this.network == 'testnet') label += " @ " + new Date(timestamp).toLocaleTimeString(); var superblockDate = { superblock: superblock, timestamp: timestamp, + before: before, + after: after, label: label }; this.startDate.push(superblockDate); @@ -115,8 +120,8 @@ PaymentCycle.prototype.updateDropdowns = function() { } - this.endDate.shift(); // remove first element of endDate - this.startDate.pop(); // remove last element of startDate to keep length even + // this.endDate.shift(); // remove first element of endDate + // this.startDate.pop(); // remove last element of startDate to keep length even var now = Math.floor(Date.now()); @@ -132,7 +137,7 @@ PaymentCycle.prototype.updateDropdowns = function() { var eta = self.getTimeDifference(opts, now, this.timestamp); var time = this.timestamp - now; - var option = $("