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 @@ + + +@foreach($piggyBanks as $piggyBank) + + + + + + + + + + + + + +@endforeach + +
+ + + +
+ + +
+
+ {{{$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 +
\ No newline at end of file diff --git a/resources/views/piggy-banks/index.blade.php b/resources/views/piggy-banks/index.blade.php index 72c7505e41..81e187779d 100644 --- a/resources/views/piggy-banks/index.blade.php +++ b/resources/views/piggy-banks/index.blade.php @@ -8,81 +8,94 @@

-
-@foreach($piggyBanks as $piggyBank) -
+ +
+
-
- - {{{$piggyBank->name}}} +
Piggy banks
+ @include('list.piggy-banks') +
+
+
- -
-
- - -
-
+{{-- +
+ @foreach($piggyBanks as $piggyBank) +
+
+ -
-
- -
- @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->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 +
+
+ {!! Amount::format($piggyBank->savedSoFar,true) !!} +
+
+ {!! Amount::format($piggyBank->targetamount,true) !!} +
+
+ @if($piggyBank->leftToSave > 0) + {!! Amount::format($piggyBank->leftToSave) !!} + @endif +
-
-@endforeach + @endforeach
+--}} +