{{-- Subscription accordion shared by the full-page history and the AJAX report fragment. $packageHistory - PackageProfile collection with packageHistory eager loaded $packages, $packages_price - lookups keyed by package id --}} @if ($packageHistory->isEmpty()) @else
@foreach ($packageHistory as $subscription) @php $panelId = 'subscription-'.$subscription->id; $paidSoFar = $subscription->packageHistory->sum('paid'); @endphp
first) hidden @endif>
Package price
{{ number_format($packages_price[$subscription->package_id] ?? 0, 2) }}
Amount
{{ number_format($subscription->amount, 2) }}
Discount
{{ number_format($subscription->discount, 2) }}
Paid / Due
{{ number_format($subscription->total_paid, 2) }} / {{ number_format($subscription->total_due, 2) }}
@if ($subscription->packageHistory->isEmpty())

No payments recorded against this subscription.

@else
@foreach ($subscription->packageHistory as $payment) @endforeach
Payment date Paid Due
{{ date('d M Y', strtotime($payment->payment_date)) }} {{ number_format($payment->paid, 2) }} {{ number_format($payment->due, 2) }}
Total paid {{ number_format($paidSoFar, 2) }}
@endif
@endforeach
@endif