@extends('layout.main') @section('content')

PAYMENT DETAILS

@if (Auth::user()->can('loans-create')) Add Payment Details @endif @if (Auth::user()->can('loans-show')) View Loan Details @endif
{{-- Payments Details --}}

Total Payments

{{ $loan->loanDeposits->count() }}

Amount Paid

{{ formatCurrencyDecimals($loan->loanDeposits->sum('amount')) }}

Remaining Balance

@php $remainingBalance = $loan->loan_amount - $loan->loanDeposits->sum('amount'); @endphp

{{ formatCurrencyDecimals(max(0, $remainingBalance)) }}

{{ __('Receipt No') }} {{ __('Deposit Date') }} {{ __('Amount') }} ({{ getCurrencyCode() }}) {{ __('Deposited By') }} {{ __('Actions') }} @forelse ($loan->loanDeposits as $payment) {{ $payment->slug ?? 'N/A' }} {{ \Carbon\Carbon::parse($payment->deposit_date)->format('d M, Y') }} {{ formatAmount($payment->amount) }} {{ $payment->createdBy->name ?? 'System' }} @empty

No payments found

This loan has no payment records yet.

@endforelse
{{-- Client Information --}}
Avatar Fullname Gender Phone ID No Location @if ($loan->loan_category_id == \App\Constants\LoanConstants::INDIVIDUAL_LOAN)
Profile Picture
{{ $loan->individualClient->client->fullname }} {{ $loan->individualClient->client->gender }} {{ $loan->individualClient->client->phone }} {{ $loan->individualClient->client->idnumber }} {{ $loan->individualClient->client->location }}
@else @foreach ($loan->groupClients as $groupClient)
Profile Picture
{{ $groupClient->client->fullname }} {{ $groupClient->client->gender }} {{ $groupClient->client->phone }} {{ $groupClient->client->idnumber }} {{ $groupClient->client->location }}
@endforeach @endif
{{-- Loan Information --}}
{{ __('Loan Code') }} {{ $loan->loan_code }} {{ __('Principal Amount') }} {{ formatCurrencyDecimals($loan->principal_amount) }} {{ __('Interest Rate') }} {{ number_format($loan->interest_rate) }} % {{ __('Loan + Interest') }} {{ formatCurrencyDecimals($loan->loan_amount) }} {{ __('Interest Amount') }} {{ formatCurrencyDecimals($loan->interest_amount) }} {{ __('Installments') }} {{ number_format($loan->installments) }} {{ __('Loan Type') }} {{ $loan->loanType->product_name }} {{ __('No. of Installments') }} {{ number_format($loan->installments) }} {{ __('Interest Type') }} {{ \App\Constants\LoanConstants::getInterestTypeName($loan->loanType->interest_method) }} {{ __('First Installment Date') }} {{ date('d M , Y. D', strtotime($loan->first_installment_date)) }}
@endsection