diff --git a/public/js/piggy-banks.js b/public/js/piggy-banks.js index 7cef178001..b9ffc0401c 100644 --- a/public/js/piggy-banks.js +++ b/public/js/piggy-banks.js @@ -5,14 +5,24 @@ $(function () { if (typeof(googleLineChart) === 'function' && typeof(piggyBankID) !== 'undefined') { googleLineChart('chart/piggy-history/' + piggyBankID, 'piggy-bank-history'); } - $('#sortable').sortable( + + $('#sortable tbody').sortable( { + helper: fixHelper, stop: stopSorting, handle: '.handle' } ); }); +// Return a helper with preserved width of cells +var fixHelper = function (e, ui) { + ui.children().each(function () { + $(this).width($(this).width()); + }); + return ui; +}; + function addMoney(e) { var pigID = parseInt($(e.target).data('id')); $('#moneyManagementModal').empty().load('piggy-banks/add/' + pigID, function () { @@ -33,7 +43,7 @@ function removeMoney(e) { function stopSorting() { $('.loadSpin').addClass('fa fa-refresh fa-spin'); var order = []; - $.each($('#sortable>div'), function(i,v) { + $.each($('#sortable>tr'), function(i,v) { var holder = $(v); var id = holder.data('id'); order.push(id); diff --git a/resources/views/list/piggy-banks.blade.php b/resources/views/list/piggy-banks.blade.php new file mode 100644 index 0000000000..279bd70494 --- /dev/null +++ b/resources/views/list/piggy-banks.blade.php @@ -0,0 +1,56 @@ +
+ + + | ++ + | ++ {{{$piggyBank->name}}} + | ++ {!! Amount::format($piggyBank->savedSoFar,true) !!} + | ++ @if($piggyBank->savedSoFar > 0) + + @endif + | + +
+
+
+ percentage == 100)
+ class="progress-bar progress-bar-success"
+ @else
+ class="progress-bar progress-bar-info"
+ @endif
+ role="progressbar" aria-valuenow="{{$piggyBank->percentage}}" aria-valuemin="0" aria-valuemax="100" style="min-width: 40px;width: {{$piggyBank->percentage}}%;">
+ {{$piggyBank->percentage}}%
+
+ |
+
+
+ + @if($piggyBank->leftToSave > 0) + + @endif + | ++ {!! Amount::format($piggyBank->targetamount,true) !!} + @if($piggyBank->leftToSave > 0) + ({!! Amount::format($piggyBank->leftToSave) !!}) + @endif + | +