aboutsummaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/js/report.coffee29
1 files changed, 16 insertions, 13 deletions
diff --git a/public/js/report.coffee b/public/js/report.coffee
index 650e25b4..e045454e 100644
--- a/public/js/report.coffee
+++ b/public/js/report.coffee
@@ -1,29 +1,32 @@
+#= require jquery-1.8.2.min.js
+#= require jquery-ui-1.9.0.custom.min.js
+
$(->
$('.date').datepicker()
$.getJSON('transactions', (data) ->
$.each(data.transactions, ->
- keys = Object.keys(this)
- transaction = this
-
- $.each(keys, (i,v) ->
- $('tbody tr:last td:eq(' + i + ')').html(transaction[v])
- })
-
- $('tbody:last').append($('tbody tr:last').clone())
- })
- $('tbody tr:last').remove()
+ $('tbody').append("""
+ <tr>
+ <td>#{this.date}</td>
+ <td>#{this.address}</td>
+ <td>#{this.exchange}</td>
+ <td>#{this.received}</td>
+ <td>#{(this.received * this.exchange).toFixed(2)}</td>
+ </tr>
+ """)
+ )
btc = 0
$('td:nth-child(4)').each(->
btc += parseFloat($(this).html())
- })
+ )
$('#btc').html(btc)
cad = 0
$('td:nth-child(5)').each(->
cad += parseFloat($(this).html())
- })
+ )
$('#cad').html(cad)
- })
+ )
)