@extends('frontend.maintemplate.maintemplate') @section('title', 'Checkout' . ' :: AgeLess Institute') @section('content')
@csrf

Checkout

You have {{ count(session()->get('cart', [])) }} items in your cart
@foreach ($courses as $course)
{{ $course->subcategory->name??"" }}
({{ $course->name }})
@php $totalPracticalHours = $course->courseTopics->sum( function ($courseTopic) { return optional( $courseTopic->topic, )->practical_hours; }, ); @endphp

Flying Hours : {{ $totalPracticalHours }} Hrs

₹{{ number_format(session('cart')[$course->id]['total_price'] ?? $course->current_fee, 0, '.', ',') }}
@php $cartTopics = $cart[$course->id]['topics'] ?? []; $cartTopicIds = array_keys($cartTopics); $hasCartTopics = !empty($cartTopics); if (!empty($cartTopics)) { $customeTopicId = array_keys($cartTopics); $filteredCourseTopics = \App\Models\Topic::whereIn( 'id',$customeTopicId) ->orderByRaw('FIELD(id, ' . implode(',', $customeTopicId) . ')') ->get(); } else { $filteredCourseTopics = collect($course->courseTopics->sortBy('sequence_number')); } // If cart topics exist, filter course topics accordingly if ($hasCartTopics) { $filteredCourseTopics = $filteredCourseTopics->filter( function ($courseTopic) use ($cartTopicIds) { return in_array( $courseTopic->id, $cartTopicIds, ); }, ); } @endphp @forelse($filteredCourseTopics as $courseTopic) @if ($hasCartTopics) @else @endif @empty @endforelse
Topics Types
{{ $courseTopic->title ?? '' }} @php $type = $cartTopics[$courseTopic->id] ?? ''; if ($type === 'practical') { $displayType = 'Theory + Practical'; } elseif ($type === 'demo') { $displayType = 'Theory + Demo'; } else { $displayType = 'Theory Only'; } @endphp {{ $displayType }} {{ $courseTopic->topic->title ?? '' }} @php $types = is_array($courseTopic->types) ? $courseTopic->types : json_decode($courseTopic->types,true,); if (in_array('practical', $types)) { $displayTypes = 'Theory + Practical'; } elseif (in_array('demo', $types)) { $displayTypes = 'Theory + Demo'; } else { $displayTypes = 'Theory Only'; } @endphp {{-- {{ $types ? implode(' + ', $types) : '' }} --}} {{ $displayTypes }}
No topics available.
@endforeach
Order Summary
{{--
Total Price: {{ number_format(session('cart')[$course->id]['total_price'] ?? $courses->sum('current_fee'), 0, '.', ',') }}
Total: {{ number_format(session('cart')[$course->id]['total_price'] ?? $courses->sum('current_fee'), 0, '.', ',') }}
--}} @php $totalPrice = 0; foreach ($courses as $course) { $totalPrice += session('cart')[$course->id]['total_price'] ?? $course->current_fee; } @endphp
Total Price: ₹{{ number_format($totalPrice, 0, '.', ',') }}
Total: ₹{{ number_format($totalPrice, 0, '.', ',') }}

Billing Details

Personal Details
Address
{{-- --}}
{{-- --}}
{{-- --}}
@endsection