@php $headerOption = [ 'title' => 'Payment Collections', 'header_buttons' => [], 'filters' => [], 'data' => [] ]; $sponsorship = $sponsorship ?? null; $installments = $installments ?? collect(); $beneficiaryName = $beneficiaryName ?? 'N/A'; $sponsorName = $sponsorName ?? 'N/A'; @endphp @extends('admin.layouts.layout', $headerOption) @push('page_css') @endpush @section('content')

Payment Collections

{{ $beneficiaryName }} - {{ $sponsorship->offer_title ?? 'N/A' }}

{!! \App\Helpers\Helper::price($totalCollected ?? 0, $sponsorship->currency ?? 'USD') !!}
Total Collected From sponsor
All payments received
{!! \App\Helpers\Helper::price($adminFees ?? 0, $sponsorship->currency ?? 'USD') !!}
Admin Fees ({{ $adminFeePercent ?? \Config::get('settings.admin_transaction_fees', 10) }}%)
Platform revenue
{!! \App\Helpers\Helper::price($totalPayable ?? 0, $sponsorship->currency ?? 'USD') !!}
Total Payable To recipient
Net amount after fees
{!! \App\Helpers\Helper::price($pendingAmount ?? 0, $sponsorship->currency ?? 'USD') !!}
Pending Transfers
{{ $pendingCount ?? 0 }} pending
@forelse($installments as $installment) @php $isPaid = $installment->payment_status === \App\Models\Users\SponsorshipInstallment::STATUS_PAID; $isApprovedAndReleased = $installment->payment_status === \App\Models\Users\SponsorshipInstallment::STATUS_APPROVED_AND_RELEASED; $isPending = $installment->payment_status === \App\Models\Users\SponsorshipInstallment::STATUS_PENDING; $isDisputed = $installment->payment_status === \App\Models\Users\SponsorshipInstallment::STATUS_DISPUTE; $isSubmitted = $installment->payment_status === \App\Models\Users\SponsorshipInstallment::STATUS_SUBMITTED_FOR_APPROVAL; // Check if already transferred (has vendor_payout_transaction_id) $isTransferred = !empty($installment->vendor_payout_transaction_id); // Only "Approved and Released" milestones without vendor_payout_transaction_id can be checked // All others (pending, disputed, transferred, etc.) are disabled $canCheck = $isApprovedAndReleased && !$isTransferred; // Transferred installments are checked and disabled // Disputed and other statuses are disabled and unchecked $adminFeePercent = $adminFeePercent ?? \Config::get('settings.admin_transaction_fees', 10); $adminFee = $installment->installment_amount * ($adminFeePercent / 100); $payable = $installment->installment_amount - $adminFee; $installmentDate = $installment->installment_date ? \App\Helpers\Helper::showdate($installment->installment_date, false) : 'N/A'; // Get transfer date from vendor payout transaction if exists, otherwise from paid_at or approval_release_date $transferDate = 'N/A'; if ($installment->vendorPayoutTransaction && $installment->vendorPayoutTransaction->transaction_date) { $transferDate = \App\Helpers\Helper::showdate($installment->vendorPayoutTransaction->transaction_date, false); } elseif ($installment->paid_at) { $transferDate = \App\Helpers\Helper::showdate($installment->paid_at, false); } elseif ($installment->approval_release_date) { $transferDate = \App\Helpers\Helper::showdate($installment->approval_release_date, false); } // Get transaction ID from vendor payout transaction if exists, otherwise from payment_reference $transactionId = 'N/A'; if ($installment->vendorPayoutTransaction) { $transactionId = $installment->vendorPayoutTransaction->transaction_id ?? 'N/A'; } elseif (!empty($installment->payment_reference) && $installment->payment_reference !== 'N/A') { $transactionId = $installment->payment_reference; } $milestoneName = $installment->fund_purpose ?? 'Milestone ' . $installment->installment_number; $statusName = $installment->statuses[$installment->payment_status]['name'] ?? 'Unknown'; $statusClass = 'badge-secondary'; if ($isTransferred) { $statusName = 'Transferred'; $statusClass = 'badge-success'; } elseif ($isApprovedAndReleased && !$isTransferred) { $statusName = 'Pending Transfer'; $statusClass = 'badge-warning'; } elseif ($isPending) { $statusName = 'Pending'; $statusClass = 'badge-warning'; } elseif ($isDisputed) { $statusName = 'Dispute'; $statusClass = 'badge-danger'; } elseif ($isSubmitted) { $statusName = 'Submitted for Approval'; $statusClass = 'badge-secondary'; } elseif ($isDisputed) { $statusName = 'Dispute'; $statusClass = 'badge-danger'; } // Beneficiary initials for avatar $beneficiaryInitials = strtoupper(substr($beneficiaryName, 0, 2)); if (strpos($beneficiaryName, ' ') !== false) { $nameParts = explode(' ', $beneficiaryName); $beneficiaryInitials = strtoupper(substr($nameParts[0], 0, 1) . substr($nameParts[count($nameParts) - 1], 0, 1)); } @endphp @empty @endforelse
DATE SPONSORSHIP RECIPIENT MILESTONE AMOUNT ADMIN FEE ({{ $adminFeePercent ?? \Config::get('settings.admin_transaction_fees', 10) }}%) PAYABLE TRANSACTION ID TRANSFER DATE STATUS ACTION
{{ $installmentDate }}
{{ $sponsorship->offer_title ?? 'N/A' }}
{{ $sponsorName }}
{{ $beneficiaryInitials }}
{{ $beneficiaryName }}
{{ ucfirst($sponsorship->beneficiary_type ?? 'N/A') }}
{{ $milestoneName }} {!! \App\Helpers\Helper::price($installment->installment_amount, $sponsorship->currency ?? 'USD') !!} {!! \App\Helpers\Helper::price($adminFee, $sponsorship->currency ?? 'USD') !!} {!! \App\Helpers\Helper::price($payable, $sponsorship->currency ?? 'USD') !!} {{ $transactionId }} {{ $transferDate }} {{ $statusName }} @php $vendorPayout = $installment->vendorPayoutTransaction ?? null; @endphp @if($isTransferred && $vendorPayout) @else @endif
No transactions found

Transaction Summary

Total Collected
{!! \App\Helpers\Helper::price($totalCollected ?? 0, $sponsorship->currency ?? 'USD') !!}
Total Admin Fees
{!! \App\Helpers\Helper::price($adminFees ?? 0, $sponsorship->currency ?? 'USD') !!}
Total Payable
{!! \App\Helpers\Helper::price($totalPayable ?? 0, $sponsorship->currency ?? 'USD') !!}
Total Transferred
{!! \App\Helpers\Helper::price($totalPayable ?? 0, $sponsorship->currency ?? 'USD') !!}
Pending Transfers
{!! \App\Helpers\Helper::price($pendingAmount ?? 0, $sponsorship->currency ?? 'USD') !!}
@endsection @push('page_script') @include('admin.components.date-time-picker') @endpush