{{--
--}}
{{--
Expiry date : 09/12/25
Next payment due : 11/12/25
Access blocked
Expiry date : 09/12/25
Next payment due :
Access blocked
--}}
Analytics
Total payments to date
${{ number_format($totalPayments, 2) }}
Pending payments
${{ number_format($pendingPayments, 2) }}
Next payment due
{{ $nextPaymentDue ? \Carbon\Carbon::parse($nextPaymentDue)->format('d/m/Y') : '-' }}
Courses completed
{{ $completedCoursesCount }}
Thrive in Practice
Amount paid : 10/12/25 Purchase date : 09/10/24 Last accessed: 11/12/24 1:00pm
50%
Module & Marketing
1.1 What is your why?
1.2 What is success?
1.1 What is your why?
1.2 What is success?
1.1 What is your why?
1.2 What is success?
1.1 What is your why?
1.2 What is success?
1.1 What is your why?
1.2 What is success?
Practice Name
Amount paid : 10/12/25 Purchase date : 09/10/24 Last accessed: 11/12/24 1:00pmPayment failed
50%
Module & Marketing
1.1 What is your why?
1.2 What is success?
1.1 What is your why?
1.2 What is success?
1.1 What is your why?
1.2 What is success?
1.1 What is your why?
1.2 What is success?
1.1 What is your why?
1.2 What is success?
@foreach ($coursesAnalytics as $courseIndex => $courseData)
@php
$grant = $courseData['grant'];
$invoice = $grant->courseInvoice ?? null;
// ✅ If course was purchased with a payment plan, use plan->amount_paid
if ($invoice && !empty($invoice->payment_plan_purchase_id)) {
$plan = \App\Models\PaymentPlansPurchaseDetails::find($invoice->payment_plan_purchase_id);
$amountPaid = $plan ? (float)$plan->amount_paid : 0;
} else {
// ✅ Otherwise use amount_paid from the grant itself (normal one-time purchase)
$amountPaid = (float)($grant->amount_paid ?? 0);
}
$grant = $courseData['grant'];
$course = $grant->course;
$modules = $courseData['modules'];
$progress = $courseData['progress_percent'];
// Mock extra details as placeholder (update if you have real data)
//$amountPaid = $grant->amount_paid ?? '';
$purchaseDate = $grant->purchaseDate ?? '';
//$lastAccessed = $grant->last_access ? \Carbon\Carbon::parse($grant->last_access)->format('d/m/Y') : '';
// $expiryDate = empty($grant->course_expiry_date) || $grant->course_expiry_date == '0000-00-00'
// ? 'Ongoing'
// : \Carbon\Carbon::parse($grant->course_expiry_date)->format('d/m/y');
$isOngoing = empty($grant->course_expiry_date) || $grant->course_expiry_date == '0000-00-00';
$expiryDisplay = $isOngoing ? 'Ongoing' : \Carbon\Carbon::parse($grant->course_expiry_date)->format('d/m/Y');
$accessType = $isOngoing ? 'ongoing' : 'custom';
$rawExpiryDate = $isOngoing ? '' : \Carbon\Carbon::parse($grant->course_expiry_date)->format('d/m/Y'); // for JS datepicker
$nextPaymentDue = $grant->next_payment_due ?? '';
$accessBlocked = $grant->lock_status ?? 0;
@endphp
Expiry date: {{ $expiryDisplay }}
{{--
Next payment due: {{ is_string($nextPaymentDue) ? $nextPaymentDue : 'Payment failed' }}
--}}
{{ $accessBlocked ? 'Access blocked' : 'Access granted' }}
@endif
@endforeach
{{ $course->course_name }}
Amount paid: ${{ number_format($amountPaid, 2) }} @if($grant->showPurchaseAndAccess) Purchase date: {{ $purchaseDate ?? '' }} @endif Last accessed: {{ $grant->lastAccessed ?? '' }} @if($grant->showPurchaseAndAccess)
{{ $progress }}%
{{--
--}}
@foreach ($modules as $moduleIndex => $module)
@php
// Check if all lessons in this module are completed
$isCompletedModule = true;
foreach ($module->lessons as $lesson) {
$lessonStatus = $courseData['lesson_progress'][$lesson->id] ?? '';
if ($lessonStatus !== 'completed') {
$isCompletedModule = false;
break;
}
}
@endphp
@endforeach
{{ $course->course_name }}
@foreach ($module->lessons as $lesson)
@php
$lessonStatus = $courseData['lesson_progress'][$lesson->id] ?? '';
$isCompleted = $lessonStatus === 'completed';
@endphp
{{--
@endforeach