aboutsummaryrefslogtreecommitdiffstats
path: root/public/js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2014-08-15 10:54:33 -0700
committerAdam Soltys <[email protected]>2014-08-15 10:54:33 -0700
commitd28440e3c830c4f77e1a4359f3fc42fc958a2e7c (patch)
treebd95e1ba29afdd35d159c47fb5f5914c3908382f /public/js
parenta0e14381e11d4a4178cd5c88a5e580ee28a14bf5 (diff)
downloadcoinos-server-d28440e3c830c4f77e1a4359f3fc42fc958a2e7c.tar.gz
coinos-server-d28440e3c830c4f77e1a4359f3fc42fc958a2e7c.zip
Fade in transactions report
Diffstat (limited to 'public/js')
-rw-r--r--public/js/report.coffee53
1 files changed, 27 insertions, 26 deletions
diff --git a/public/js/report.coffee b/public/js/report.coffee
index 7bcfb8c3..90b7c0aa 100644
--- a/public/js/report.coffee
+++ b/public/js/report.coffee
@@ -48,37 +48,38 @@ filterDates = ->
display(transactions)
display = (transactions) ->
- $('.alert').remove()
$('.report tbody tr').remove()
- $('.report').show()
if transactions.length is 0
- $('.report').before("<p class='alert alert-warning'>No transactions were found for the specified time period</p>")
$('.report').hide()
+ $('.alert').fadeIn()
+ else
+ $('.alert').hide()
+ $.each(transactions, ->
+ exchange = parseFloat(this.exchange)
+ received = parseFloat(this.received)
+ amount = received * exchange
- $.each(transactions, ->
- exchange = parseFloat(this.exchange)
- received = parseFloat(this.received)
- amount = received * exchange
+ $('.report tbody').append("""
+ <tr>
+ <td>#{moment(this.date, 'YYYY-MM-DD h:mm:ss').format('MMM D h:mma')}</td>
+ <td>#{exchange.toFixed(2)}</td>
+ <td>#{received.toFixed(5)}</td>
+ <td>#{amount.toFixed(2)}</td>
+ </tr>
+ """)
+ )
- $('.report tbody').append("""
- <tr>
- <td>#{moment(this.date, 'YYYY-MM-DD h:mm:ss').format('MMM D h:mma')}</td>
- <td>#{exchange.toFixed(2)}</td>
- <td>#{received.toFixed(5)}</td>
- <td>#{amount.toFixed(2)}</td>
- </tr>
- """)
- )
+ btc = 0
+ $('table.report tbody td:nth-child(3)').each(->
+ btc += parseFloat($(this).html())
+ )
+ $('#btc').html(btc.toFixed(5))
- btc = 0
- $('table.report tbody td:nth-child(3)').each(->
- btc += parseFloat($(this).html())
- )
- $('#btc').html(btc.toFixed(5))
+ cad = 0
+ $('table.report tbody td:nth-child(4)').each(->
+ cad += parseFloat($(this).html())
+ )
+ $('#cad').html(cad.toFixed(2))
- cad = 0
- $('table.report tbody td:nth-child(4)').each(->
- cad += parseFloat($(this).html())
- )
- $('#cad').html(cad.toFixed(2))
+ $('.report').fadeIn()