@extends('layouts.app') @section('title', 'My Dashboard') @section('page-title', 'My Account') @section('content')
Welcome, {{ explode(' ', auth()->user()->name)[0] }} ๐Ÿ‘‹
Member ID: {{ auth()->user()->member_id }} ยท {{ now()->format('l, F j, Y') }}
Apply for Loan
{{-- Balance Cards --}}
${{ number_format($member->savings_balance, 2) }}
Savings Balance
+${{ number_format($thisMonthSavings, 2) }} this month
${{ number_format($loanBalance, 2) }}
Loan Outstanding
@if($activeLoan)
{{ $activeLoan->term_months - $activeLoan->repaymentSchedules()->where('status','paid')->count() }} payments remaining
@else
No active loan
@endif
${{ number_format($totalRepaid, 2) }}
Total Repaid
Lifetime repayments
{{-- Active Loan Card --}}
@if($activeLoan)
Active Loan
Details
Loan Amount
${{ number_format($activeLoan->amount, 2) }}
Monthly Installment
${{ number_format($activeLoan->monthly_installment, 2) }}
Outstanding Balance
${{ number_format($activeLoan->outstanding_balance, 2) }}
Due Date
{{ $activeLoan->due_date?->format('M Y') ?? 'โ€”' }}
@php $pct = $activeLoan->amount > 0 ? min(100, ($activeLoan->amount_paid / $activeLoan->amount) * 100) : 0; @endphp
Repayment Progress ยท {{ round($pct) }}% paid
@php $nextSchedule = $activeLoan->repaymentSchedules()->where('status','pending')->orderBy('due_date')->first(); @endphp @if($nextSchedule)
Next Payment Due: {{ $nextSchedule->due_date->format('M d, Y') }} โ€” ${{ number_format($nextSchedule->amount, 2) }}
@endif
@else
๐Ÿ’ณ
No Active Loan
You can apply for a loan at any time
Apply for a Loan
@endif {{-- Recent Transactions --}}
Recent Transactions
View All
@forelse($recentTransactions as $txn) @empty @endforelse
TypeAmountBalanceDate
{{ ucfirst($txn->type) }} {{ $txn->type === 'deposit' ? '+' : '-' }}${{ number_format($txn->amount, 2) }} ${{ number_format($txn->balance_after, 2) }} {{ $txn->created_at->format('M d, Y') }}
No transactions yet
{{-- Quick info --}}
{{-- Loan Applications --}}
My Loan Applications
All
@forelse($member->loans()->latest()->take(4)->get() as $loan)
{{ $loan->loan_number }}
{{ $loan->loan_type_label ?? ucfirst($loan->loan_type) }} ยท {{ $loan->created_at->format('M Y') }}
${{ number_format($loan->amount, 2) }}
{{ ucfirst($loan->status) }}
@empty
No loan applications
@endforelse
{{-- Account Info --}}
Account Details
@foreach([ ['Member ID', $member->member_id], ['Department', $member->department ?? 'โ€”'], ['Monthly Contribution', '$'.number_format($member->monthly_contribution, 2)], ['Member Since', $member->created_at->format('F Y')], ['Status', ucfirst($member->status)], ] as [$label, $value])
{{ $label }} {{ $value }}
@endforeach
@endsection