{{-- @extends('front.practitioner.import.template.import') --}} @extends('front.inner-layout.app') @section('content')
{{--

Analytics

--}}
Total payments to date

${{ number_format($totalPayments, 2) }}

cpurse
Pending payments

${{ number_format($pendingPayments, 2) }}

cpurse
Next payment due

{{ $nextPaymentDue ? \Carbon\Carbon::parse($nextPaymentDue)->format('d/m/Y') : '-' }}

cpurse
Courses completed

{{ $completedCoursesCount }}

cpurse
{{--

Thrive in Practice

Amount paid : 10/12/25 Purchase date : 09/10/24 Last accessed: 11/12/24 1:00pm
cpurseExpiry date : 09/12/25 cpurseNext payment due : 11/12/25 cpurseAccess blocked
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:00pm
cpurseExpiry date : 09/12/25 cpurseNext payment due :

Payment failed

cpurseAccess blocked
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

{{ $course->course_name }}

Amount paid: ${{ number_format($amountPaid, 2) }} @if($grant->showPurchaseAndAccess) Purchase date: {{ $purchaseDate ?? '' }} @endif Last accessed: {{ $grant->lastAccessed ?? '' }} @if($grant->showPurchaseAndAccess)
course Expiry date: {{ $expiryDisplay }} {{-- course Next payment due: {{ is_string($nextPaymentDue) ? $nextPaymentDue : 'Payment failed' }} --}} course {{ $accessBlocked ? 'Access blocked' : 'Access granted' }}
@endif
{{ $progress }}%
{{--
{{ $course->course_name }}
--}} @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

@foreach ($module->lessons as $lesson) @php $lessonStatus = $courseData['lesson_progress'][$lesson->id] ?? ''; $isCompleted = $lessonStatus === 'completed'; @endphp
{{--
{{ trim(html_entity_decode(strip_tags($lesson->lesson_title ?? ''))) }}
--}}
{{ trim(html_entity_decode(strip_tags($lesson->lesson_title ?? ''), ENT_QUOTES | ENT_HTML5, 'UTF-8')) }}
@endforeach
@endforeach
@endforeach
@endsection @section('js') @endsection