@extends('backend.master') @section('content') @php $u = $loan->user; $pi = $u?->personalInformation; $plan = $loan->loanPlan; $avatar = $pi?->selfie_path ? asset('storage/' . $pi->selfie_path) : null; $phone = trim(($u?->country_code ?? '') . ' ' . ($u?->phone ?? '')); $statusClass = match($loan->status) { 'submitted' => 'bg-yellow-50 text-yellow-700 border border-yellow-200', 'security_approved' => 'bg-green-50 text-green-700 border border-green-200', 'approved' => 'bg-blue-50 text-blue-700 border border-blue-200', 'rejected' => 'bg-red-50 text-red-700 border border-red-200', default => 'bg-gray-100 text-gray-700 border border-gray-200', }; $totalPayable = $loan->total_payable ?? ((float) $loan->monthly_installment * (int) $loan->term_months); $docs = [ 'ID Front' => $pi?->id_front_path, 'ID Back' => $pi?->id_back_path, 'Selfie' => $pi?->selfie_path, 'Signature' => $pi?->signature_path, ]; @endphp
{{-- Header --}}

Loan Details

View complete Erin loan and user information

Back @if($loan->disbursed_at === null) @endif Deposit Requests
{{-- Alerts --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @if(session('info'))
{{ session('info') }}
@endif @if($errors->any())
@endif {{-- User Summary --}}
@if($avatar) User Photo @else
@endif

{{ $u?->name ?? 'N/A' }}

{{ $phone ?: 'No phone' }}
{{ $u?->email ?? 'No email' }}
{{ ucfirst(str_replace('_', ' ', $loan->status)) }} Loan ID: #{{ $loan->id }} @if($loan->disbursed_at) Balance Added @endif
{{-- Loan Information --}}
Loan Information
Requested Amount
৳{{ number_format((float) $loan->requested_amount, 0) }}
Monthly Installment
৳{{ number_format((float) $loan->monthly_installment, 2) }}
Duration
{{ (int) $loan->term_months }} Months
Interest Rate
{{ number_format((float) $loan->interest_rate_annual, 2) }}%
Total Payable
৳{{ number_format((float) $totalPayable, 0) }}
Custom Fee
৳{{ number_format((float) $loan->fee_custom, 2) }}
Plan
@if($plan) {{ $plan->term_months }} Months / ৳{{ number_format((float) $plan->amount, 0) }} @else N/A @endif
User Balance
৳{{ number_format((float) ($u?->balance ?? 0), 0) }}
Submitted At
{{ $loan->submitted_at ? $loan->submitted_at->format('d M Y, h:i A') : 'N/A' }}
Security Approved At
{{ $loan->security_approved_at ? $loan->security_approved_at->format('d M Y, h:i A') : 'N/A' }}
Approved At
{{ $loan->approved_at ? $loan->approved_at->format('d M Y, h:i A') : 'N/A' }}
Disbursed At
{{ $loan->disbursed_at ? $loan->disbursed_at->format('d M Y, h:i A') : 'N/A' }}
@if($loan->message_custom)
Custom Message
{{ $loan->message_custom }}
@endif @if($loan->notes)
Admin Notes
{{ $loan->notes }}
@endif
{{-- Personal Info --}}
User Information
Full Name
{{ $pi?->full_name ?? $u?->name ?? 'N/A' }}
Phone
{{ $phone ?: 'N/A' }}
Email
{{ $u?->email ?? 'N/A' }}
Occupation
{{ $pi?->occupation ?? 'N/A' }}
Monthly Income
{{ $pi?->monthly_income ? '৳' . number_format((float) $pi->monthly_income, 0) : 'N/A' }}
Loan Purpose
{{ $pi?->loan_purpose ?? 'N/A' }}
Education Level
{{ $pi?->education_level ?? 'N/A' }}
Family Members
{{ $pi?->family_members_count ?? 'N/A' }}
Expat
{{ $pi?->is_expat ? 'Yes' : 'No' }}
Has House
{{ $pi?->has_house ? 'Yes' : 'No' }}
Has Car
{{ $pi?->has_car ? 'Yes' : 'No' }}
Present Address
{{ $pi?->present_address ?? 'N/A' }}
Permanent Address
{{ $pi?->permanent_address ?? 'N/A' }}
{{-- Nominee + Bank --}}
Nominee Information
Nominee Name
{{ $pi?->nominee_name ?? 'N/A' }}
Relation
{{ $pi?->nominee_relation ?? 'N/A' }}
Phone
{{ $pi?->nominee_phone ?? 'N/A' }}
Bank Information
Account Holder Name
{{ $pi?->account_holder_name ?? 'N/A' }}
Bank Name
{{ $pi?->bank_name ?? 'N/A' }}
Account Number
{{ $pi?->account_number ?? 'N/A' }}
Branch Name
{{ $pi?->branch_name ?? 'N/A' }}
{{-- Verification --}}
Verification Information
ID Name
{{ $pi?->id_name ?? 'N/A' }}
ID Number
{{ $pi?->id_number ?? 'N/A' }}
@foreach($docs as $label => $path)
{{ $label }}
@if($path) {{ $label }} View @else
No file
@endif
@endforeach
{{-- Actions --}}
Loan Actions
@if($loan->status === 'submitted')
@csrf
@endif @if($loan->status === 'security_approved')
@csrf
@endif Certificate @if($loan->status === 'approved') Agreements @endif @if(!($loan->status === 'approved' && $loan->disbursed_at !== null))
@csrf @method('DELETE')
@endif
@include('admin.loans.partials.modals') @endsection