@extends('adminlte::page') @section('title', 'Savings Management') @section('content')

Savings Account

Current Balance
KSh {{ number_format($totalCurrentSavings, 0) }}
Active & matured
Monthly Growth
{{ $monthlyNetGrowth >= 0 ? '+' : '' }}KSh {{ number_format(abs($monthlyNetGrowth), 0) }}
{{ date('M Y') }} change
Active Accounts
{{ $activeAccounts }}
{{ $activeAccounts > 0 ? 'Currently active' : 'No active' }}
Recent Activity
{{ $recentTransactions }}
Last 30 days
Top Saver
@if($topSaver) {{ Str::limit($topSaver->user->full_name, 15) }} @else No Data @endif
@if($topSaver) KSh {{ number_format($topSaver->calculated_balance, 0) }} @else N/A @endif
Recent Saver
@if($mostRecentSaver) {{ Str::limit($mostRecentSaver->user->full_name, 15) }} @else No Activity @endif
@if($mostRecentSaver && $mostRecentSaver->transactions->last()) {{ $mostRecentSaver->transactions->last()->transaction_date->format('M j') }} @else N/A @endif
Total Withdrawn
KSh {{ number_format($totalWithdrawnAmount, 0) }}
From {{ $withdrawnAccounts }} accounts
Top Withdrawer
@if($topWithdrawer) {{ Str::limit($topWithdrawer->user->full_name, 15) }} @else No Withdrawals @endif
@if($topWithdrawer) KSh {{ number_format($topWithdrawerAmount, 0) }} @else N/A @endif

Member Savings Accounts

@forelse($savings as $saving) @empty @endforelse
ID Member Initial Balance Type Status Maturity Created Actions
{{ $saving->id }}
{{ Str::limit($saving->user->full_name ?? 'N/A', 18) }}
KSh {{ number_format($saving->amount, 0) }} KSh {{ number_format($saving->current_balance, 0) }} @if($saving->current_balance != $saving->amount && $saving->status !== 'withdrawn')
{{ $saving->current_balance > $saving->amount ? '+' : '' }}{{ number_format($saving->current_balance - $saving->amount, 0) }} @endif
{{ $saving->type_label }} {{ $saving->status_label }} {{ $saving->maturity_date ? $saving->maturity_date->format('d M Y') : 'N/A' }} {{ $saving->created_at->format('d M Y') }}
@if($saving->status === 'active')
@csrf @method('PATCH')
@if($saving->type === 'fixed' && $saving->maturity_date && $saving->maturity_date->isPast())
@csrf @method('PATCH')
@endif @endif
@csrf @method('DELETE')
No Savings Accounts Yet

Start by adding your first savings account to the system.

Add First Savings Account
@if($savings->hasPages()) @endif
@push('js') @if(session('success')) Swal.fire({ icon: 'success', title: 'Success!', text: '{{ session("success") }}', timer: 3000, showConfirmButton: false }); @endif @if(session('error')) Swal.fire({ icon: 'error', title: 'Error!', text: '{{ session("error") }}', timer: 3000, showConfirmButton: false }); @endif @endpush> @stop