diff options
| author | Adam Soltys <[email protected]> | 2012-11-12 23:25:09 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2012-11-12 23:25:09 -0800 |
| commit | 54c28a395db853c601d3592c967f322c7f09e1d4 (patch) | |
| tree | 5e5ccd511daa0eabe82b5591298918c015d2eb14 /public | |
| parent | 5bba3395bc0bb84dcd24a7ade0c855a6beb6dbef (diff) | |
| download | coinos-server-54c28a395db853c601d3592c967f322c7f09e1d4.tar.gz coinos-server-54c28a395db853c601d3592c967f322c7f09e1d4.zip | |
Making progress on transactions report
Diffstat (limited to 'public')
| -rw-r--r-- | public/js/report.coffee | 29 |
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) - }) + ) ) |
