From 54c28a395db853c601d3592c967f322c7f09e1d4 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 12 Nov 2012 23:25:09 -0800 Subject: Making progress on transactions report --- public/js/report.coffee | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'public') 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(""" + + #{this.date} + #{this.address} + #{this.exchange} + #{this.received} + #{(this.received * this.exchange).toFixed(2)} + + """) + ) 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) - }) + ) ) -- cgit v1.2.3