aboutsummaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/css/calculator.less1
-rw-r--r--public/js/report.coffee25
2 files changed, 14 insertions, 12 deletions
diff --git a/public/css/calculator.less b/public/css/calculator.less
index d06af884..c97dec0a 100644
--- a/public/css/calculator.less
+++ b/public/css/calculator.less
@@ -1,5 +1,6 @@
@import "bootstrap.min.css";
@import "bootstrap-responsive.min.css";
+@import "jquery-ui-1.9.0.custom.min.css";
body { text-align: center; }
body { font-size: 100%; line-height: 100%; }
diff --git a/public/js/report.coffee b/public/js/report.coffee
index d11df706..06c99050 100644
--- a/public/js/report.coffee
+++ b/public/js/report.coffee
@@ -7,24 +7,25 @@ g = exports ? this
$(->
$('#from').val(moment().subtract('days', 7).format("MM/DD/YYYY"))
$('#to').val(moment().format("MM/DD/YYYY"))
- $('.date').datepicker(onClose: ->
- transactions = $.grep(g.transactions, (e, i) ->
- from = moment($('#from').val(), "MM/DD/YYYY")
- to = moment($('#to').val(), "MM/DD/YYYY")
- d = moment(e.date)
-
- return (!from? || d.diff(from) >= 0) && (!to? || d.diff(to) <= 0)
- )
-
- display(transactions)
- )
-
+ $('.date').datepicker(onClose: filterDates)
$.getJSON('transactions', (data) ->
g.transactions = data.transactions
display(g.transactions)
+ filterDates()
)
)
+filterDates = ->
+ transactions = $.grep(g.transactions, (e, i) ->
+ from = moment($('#from').val(), "MM/DD/YYYY")
+ to = moment($('#to').val(), "MM/DD/YYYY")
+ d = moment(e.date)
+
+ return (!from? || d.diff(from) >= 0) && (!to? || d.diff(to) <= 0)
+ )
+
+ display(transactions)
+
display = (transactions) ->
$('tbody tr').remove()
$.each(transactions, ->