From c3990ac32f0c8e81e50a50a0b685feb08cd76014 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 7 Mar 2015 12:34:03 +0100 Subject: [PATCH] Small updates to icons and code. --- app/Http/Controllers/JsonController.php | 4 ++-- public/js/index.js | 5 +++-- resources/views/partials/boxes.blade.php | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php index 62e0dcd69b..71f1c485de 100644 --- a/app/Http/Controllers/JsonController.php +++ b/app/Http/Controllers/JsonController.php @@ -69,7 +69,7 @@ class JsonController extends Controller // paid a bill in this range? $count = $bill->transactionjournals()->before($range['end'])->after($range['start'])->count(); if ($count == 0) { - $amount += ($bill->amount_max + $bill->amount_min / 2); + $amount += floatval($bill->amount_max + $bill->amount_min / 2); } @@ -104,7 +104,7 @@ class JsonController extends Controller } } - return Response::json(['box' => $box, 'amount' => Amount::format($amount, false)]); + return Response::json(['box' => $box, 'amount' => Amount::format($amount, false),'amount_raw' => $amount]); } /** diff --git a/public/js/index.js b/public/js/index.js index 8b829c290c..bc4148eac5 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -14,8 +14,9 @@ function getBoxAmounts() { for (x in boxes) { var box = boxes[x]; $.getJSON('/json/box', {box: box}).success(function (data) { - "use strict"; - $('#box-' + data.box).html(data.amount); + if(data.amount_raw != 0) { + $('#box-' + data.box).html(data.amount); + } }).fail(function () { console.log('Failed to get box!') }); diff --git a/resources/views/partials/boxes.blade.php b/resources/views/partials/boxes.blade.php index 8e0442362f..2197bf8a8d 100644 --- a/resources/views/partials/boxes.blade.php +++ b/resources/views/partials/boxes.blade.php @@ -5,7 +5,7 @@
- +
{{Amount::format(0,false)}}
@@ -27,7 +27,7 @@
- +
{{Amount::format(0,false)}}
@@ -49,7 +49,7 @@
- +
{{Amount::format(0,false)}}