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

Edit Savings Account #{{ $saving->id }}

@csrf @method('PUT')
@error('user_id') {{ $message }} @enderror
Initial amount set when account was created. Use deposits/withdrawals to change balance. @error('amount') {{ $message }} @enderror
@error('type') {{ $message }} @enderror
@error('status') {{ $message }} @enderror
@error('notes') {{ $message }} @enderror
Current Account Information
Account ID #{{ $saving->id }}
Created Date {{ $saving->created_at->format('d M Y') }}
Current Balance KSh {{ number_format($saving->current_balance, 2) }}
Total Deposits KSh {{ number_format($saving->transactions()->where('type', 'deposit')->sum('amount'), 2) }}
Total Withdrawals KSh {{ number_format($saving->transactions()->where('type', 'withdrawal')->sum('amount'), 2) }}
Transaction Count {{ $saving->transactions()->count() }}
Days Active {{ $saving->created_at->diffInDays(now()) }}
@if($saving->transactions()->count() > 0)
Recent Transactions
@foreach($saving->transactions()->latest()->take(5) as $transaction) @endforeach
Date Type Amount Balance After
{{ $transaction->transaction_date->format('d M Y') }} {{ ucfirst($transaction->type) }} KSh {{ number_format($transaction->amount, 2) }} KSh {{ number_format($transaction->balance_after, 2) }}
@endif
@stop @push('js') @endpush