@php $paidAmount=number_format($loan->payments()->sum('paid_amount')); @endphp @extends('layouts.app') @section('title','Loan Payments'.' - '.$loan->installation->customerVehicle->user->first_name.' '.$loan->installation->customerVehicle->user->last_name) @section('main-content')

{{$loan->installation->customerVehicle->user->first_name}} {{$loan->installation->customerVehicle->user->last_name}}

Required Amount


{{number_format($loan->loan_required_amount)}} Tshs

Amount Paid


{{$paidAmount}} Tshs

Remaining Amount


{{number_format($loan->loan_required_amount -$loan->payments()->sum('paid_amount')) }} Tshs

Payment Progress
@php $totalAmount = $loan->loan_required_amount; $paidAmount = $loan->payments->sum('paid_amount'); $progressPercentage = $totalAmount > 0 ? ($paidAmount / $totalAmount) * 100 : 0; @endphp
{{ number_format($progressPercentage) }}%
@unless(count($loan->payments)==0) @foreach ($loan->payments as $payment) @endforeach
Date of Payment Amount Paid Payment Method
{{\Carbon\Carbon::parse($payment->payment_date)->format('d F Y')}} {{number_format($payment->paid_amount)}} Tsh {{Str::title($payment->payment_method)}}
@else

No Record Found

@endunless
@endsection @section('scripts') @endsection