@if(empty($pageLoaded))
@include('skeletons.book-sessions')
@else
@include('skeletons.book-sessions')
@php $show_all = false; $showAll = array(); @endphp

{{ __('tutor.book_session') }}

{{ __('tutor.tooltip_text') }}
@for ($date = $currentDate->copy()->startOfWeek($startOfWeek); $date->lte($currentDate->copy()->endOfWeek(getEndOfWeek($startOfWeek))); $date->addDay()) {{-- @endfor @for ($date = $currentDate->copy()->startOfWeek($startOfWeek); $date->lte($currentDate->copy()->endOfWeek(getEndOfWeek($startOfWeek))); $date->addDay()) @php $active_date = $date->toDateString(); $slots = $availableSlots[$active_date] ?? []; @endphp @endfor
$date->isToday()])> --}} $selectedDate === $date->toDateString()])>
{{ $date->format('j M') }} {{ $date->format('D') }}
@if(!empty($slots)) @foreach ($slots as $index => $slot) @php $subject = $slot?->subjectGroupSubjects?->subject?->name; $group = $slot?->subjectGroupSubjects?->userSubjectGroup?->group?->name ?? ''; $total_spaces = $slot->spaces ?? 0; $total_booked = $slot->total_booked ?? 0; $available_slot = $total_spaces - $total_booked; $show_all = $index > 3; $cartItemIds = array_column(array_column($cartItems?->toArray() ?? [], 'options'), 'slot_id'); $tooltipClass = Arr::random(['warning', 'pending', 'ready', 'success']); $discountedFee = 0; if(isActivePackage('kupondeal')){ $coupon = $slot?->subjectGroupSubjects?->coupons?->first(); if(!empty($coupon)){ $discountedFee = getDiscountedTotal($slot->session_fee, $coupon->discount_type, $coupon->discount_value); } } @endphp
$index > 3, 'am-slot-selected' => in_array($slot->id, $cartItemIds), 'am-weekly-slots_card', 'am-slot-'.$tooltipClass]) id="sessionslot-{{ $slot->id}}"> @if(!empty($group))
{{ $group }} @if(in_array($slot->id, $cartItemIds))
@endif
@endif @if(!empty($subject))
{{ $subject }}
@endif
{{ parseToUserTz($slot->start_time, $timezone)->format('h:i a') }} - {{ parseToUserTz($slot->end_time, $timezone)->format('h:i a') }} @if(isActivePackage('kupondeal') && !empty($slot?->subjectGroupSubjects?->coupons?->first()))
{{ formatAmount($slot->session_fee) }} {{ formatAmount($discountedFee) }} {{ __('tutor.per_session') }}
@else {{ formatAmount($slot->session_fee) }} {{ __('tutor.per_session') }} @endif @if($slot->spaces == '1' && !in_array($slot->id, $cartItemIds)) {{ __('calendar.private_session') }} @else {{ __('calendar.no_slots_left', ['count' => $available_slot]) }} @endif
@if(((Auth::check() && Auth()->user()->role == 'student') && !in_array($slot->id, $cartItemIds) && $available_slot > 0) && $slot->bookings->isEmpty()) @endif
@endforeach @else {{ __('calendar.no_sessions') }} @endif
@for ($date = $currentDate->copy()->startOfWeek($startOfWeek); $date->lte($currentDate->copy()->endOfWeek(getEndOfWeek($startOfWeek))); $date->addDay()) @php $active_date = $date->toDateString(); $slots = $availableSlots[$active_date] ?? []; $showAll[$active_date] = false; @endphp
@if(!empty($slots)) @foreach ($slots as $index => $slot) @php $subject = $slot?->subjectGroupSubjects?->subject?->name; $group = $slot?->subjectGroupSubjects?->userSubjectGroup?->group?->name ?? ''; $total_spaces = $slot->spaces ?? 0; $total_booked = $slot->total_booked ?? 0; $available_slot = $total_spaces - $total_booked; $showAll[$active_date] = $index > 4; $cartItemIds = array_column(array_column($cartItems?->toArray() ?? [], 'options'), 'slot_id'); $tooltipClass = Arr::random(['warning', 'pending', 'ready', 'success']) @endphp
$index > 4, 'am-slot-selected' => in_array($slot->id, $cartItemIds), 'am-weekly-slots_card', 'am-slot-'.$tooltipClass]) id="sessionslot-{{ $slot->id}}"> @if(!empty($group))
{{ $group }} @if(in_array($slot->id, $cartItemIds))
@endif
@endif @if(!empty($subject))
{{ $subject }}
@endif
{{ parseToUserTz($slot->start_time, $timezone)->format('h:i a') }} - {{ parseToUserTz($slot->end_time, $timezone)->format('h:i a') }} {{ formatAmount($slot->session_fee) }}{{ __('tutor.per_session') }} {{ __('calendar.no_slots_left', ['count' => $available_slot]) }}
@if((Auth::check() && Auth()->user()->role == 'student') && !in_array($slot->id, $cartItemIds) && $available_slot > 0) @endif
@endforeach @else {{ __('calendar.no_sessions') }} @endif
@if($showAll[$active_date] && $selectedDate == $active_date)
@endif @endfor
@if($show_all)
@endif
@endif
@push('styles') @vite([ 'public/css/flatpicker-month-year-plugin.css', ]) @endpush @push('scripts') @endpush