From 6bfa83400da7c714103e13a39833d7e95b032b50 Mon Sep 17 00:00:00 2001 From: Rob Jackson Date: Fri, 3 Jan 2025 04:30:40 +0000 Subject: [PATCH] On balance overview split users list into active and inacive tabs --- .../Controllers/PaymentBalancesController.php | 6 +- .../views/payment_balances/index.blade.php | 95 +++++++++++++------ 2 files changed, 71 insertions(+), 30 deletions(-) diff --git a/app/Http/Controllers/PaymentBalancesController.php b/app/Http/Controllers/PaymentBalancesController.php index 9e789606..9e5f1a18 100644 --- a/app/Http/Controllers/PaymentBalancesController.php +++ b/app/Http/Controllers/PaymentBalancesController.php @@ -19,7 +19,8 @@ public function index() $inactiveUsersInDebtQty = User::where('active', false)->where('cash_balance', '<', 0)->count(); $inactiveUsersInDebtSum = User::where('active', false)->where('cash_balance', '<', 0)->sum('cash_balance') / 100; - $users = User::where('cash_balance', '!=', 0)->get(); + $activeUsers = User::where('active', true)->where('cash_balance', '!=', 0)->orderBy('cash_balance', 'desc')->get(); + $inactiveUsers = User::where('active', false)->where('cash_balance', '!=', 0)->orderBy('cash_balance', 'desc')->get(); return \View::make('payment_balances.index')->with([ 'activeUsersInCreditQty' => $activeUsersInCreditQty, @@ -30,7 +31,8 @@ public function index() 'inactiveUsersInCreditSum' => $inactiveUsersInCreditSum, 'inactiveUsersInDebtQty' => $inactiveUsersInDebtQty, 'inactiveUsersInDebtSum' => $inactiveUsersInDebtSum, - 'users' => $users, + 'activeUsers' => $activeUsers, + 'inactiveUsers' => $inactiveUsers, ]); } } diff --git a/resources/views/payment_balances/index.blade.php b/resources/views/payment_balances/index.blade.php index 3ed09a96..064a82bc 100644 --- a/resources/views/payment_balances/index.blade.php +++ b/resources/views/payment_balances/index.blade.php @@ -46,32 +46,71 @@ - - - - - - - - - - - @foreach ($users as $user) - - - - - - - @endforeach - -
Member nameMember StatusBalance status (in debt or in credit)Balance amount
- {{ $user->name }} - {!! HTML::statusLabel($user->status) !!} - @if ($user->cash_balance < 0) - In debt - @else - In credit - @endif - {{ $user->present()->cashBalance }}
+ + +
+
+ + + + + + + + + + + @foreach ($activeUsers as $user) + + + + + + + @endforeach + +
Member nameMember StatusBalance status (in debt or in credit)Balance amount
+ {{ $user->name }} + {!! HTML::statusLabel($user->status) !!} + @if ($user->cash_balance < 0) + In debt + @else + In credit + @endif + {{ $user->present()->cashBalance }}
+
+
+ + + + + + + + + + + @foreach ($inactiveUsers as $user) + + + + + + + @endforeach + +
Member nameMember StatusBalance status (in debt or in credit)Balance amount
+ {{ $user->name }} + {!! HTML::statusLabel($user->status) !!} + @if ($user->cash_balance < 0) + In debt + @else + In credit + @endif + {{ $user->present()->cashBalance }}
+
+
@stop