@php $unitData = $this->getUnitData(); @endphp @if($unitData) @php $unit = $unitData['unit']; @endphp {{-- Header --}}

@if($unit->isActive()) @lang('app.Active Now') @elseif($unit->isUpcoming()) @lang('app.Upcoming') @else @lang('app.Past') @endif {{ $unit->short_name }}

{{ $unit->start_date->translatedFormat('M j') }} - {{ $unit->end_date->translatedFormat('M j, Y') }} @if($unit->isUpcoming()) · {{ __('app.Starts in :days days', [ 'days' => ceil(now()->diffInDays($unit->start_date)) ]) }} @elseif($unit->isActive()) · {{ __('app.:days days remaining', ['days' => ceil(now()->diffInDays($unit->end_date))]) }} @endif

{{ __('app.:selected of :total slots selected', ['selected' => $unitData['selected_count'], 'total' => $unitData['total_slots']]) }}

{{-- Deadline Warning --}} @if($unit->choice_deadline) @php $daysUntilDeadline = now()->diffInDays($unit->choice_deadline, false); $deadlinePassed = $unit->hasChoiceDeadlinePassed(); $showWarning = $deadlinePassed || $daysUntilDeadline <= 7; @endphp {{-- TODO: Show deadline warning only if some slots are unselected --}} @if($showWarning && false)
@if($deadlinePassed) @lang('app.Choice deadline passed!') {{ __('app.Deadline was :date', ['date' => $unit->choice_deadline->translatedFormat('M j, Y')]) }} @else @lang('app.Make your choices soon!') {{ __('app.Deadline is :date (:days days away)', ['date' => $unit->choice_deadline->translatedFormat('M j, Y'), 'days' => abs($daysUntilDeadline)]) }} @endif
@endif @endif {{-- Slots List --}}
@foreach($unitData['slots'] as $slotData) @php $slot = $slotData['slot']; $isModule = $slot->slot_type === 'module'; @endphp
{{-- Slot Header --}}
{{-- Slot Type Icon --}}
@if($isModule) @else @endif
{{-- Slot Info --}}
{{ $slot->name }}
{{ $slot->slot_type }} @if($slot->location) · {{ $slot->location }} @endif
{{-- Status Badge --}} @if($slotData['status'] === 'selected') @lang('app.Selected') @elseif($slotData['can_choose']) @lang('app.Ready to Choose') @elseif($slotData['status'] === 'waiting') @lang('app.Pending') @endif
{{-- Slot Body --}} @if($slotData['status'] === 'selected')
{{-- Selected Instance Info --}}
@lang('app.Your Selection'):
{{ $slotData['selected_instance']->toHumanString() }}
{{-- Change Option (if allowed) --}} @if($slotData['can_change'] && count($slotData['available_instances']) > 0)
@foreach($slotData['available_instances'] as $instance) @if($instance['id'] !== $slotData['selected_instance']->id) @endif @endforeach
@endif {{-- Observable Behaviors Section (for challenges) --}} @if($slotData['is_challenge'] && $slotData['observable_behaviors_data']) @php $observableBehaviorsData = $slotData['observable_behaviors_data']; @endphp

@lang('app.Observable Behaviors')

{{ count($observableBehaviorsData['selected_behaviors']) }} / {{ $observableBehaviorsData['max_behaviors'] }} selected
{{-- Selected Behaviors --}} @if(count($observableBehaviorsData['selected_behaviors']) > 0)
@foreach($observableBehaviorsData['selected_behaviors'] as $behavior)
{{ $behavior['title'] }}
@if($behavior['is_required']) @lang('app.Required') @endif
{{-- Feedback and Portfolio Status --}}
@if($behavior['has_feedback']) @lang('app.View Feedback') @endif @lang('app.Add Portfolio Entry') @if($behavior['portfolio_entries_count'] > 0) {{ __('app.View Portfolio (:count)', ['count' => $behavior['portfolio_entries_count']]) }} @endif
@if(!$behavior['is_required']) @endif
{{-- Submit Portfolio Modal --}}

@lang('app.Submit Portfolio Entry')

{{ $behavior['title'] }}

{{ $this->portfolioForm }}
@lang('app.Cancel') @lang('app.Submit Portfolio Entry')
{{-- View Portfolio Entries Modal --}} @if($behavior['portfolio_entries_count'] > 0)

@lang('app.Portfolio Entries')

{{ $behavior['title'] }}

@foreach($behavior['portfolio_entries'] as $entry)
@if($entry['text_submission'])
{{ $entry['text_submission'] }}
@elseif($entry['file_url']) @php $fileUrl = route('portfolio-entry.file', $entry['id']); $fileName = basename($entry['file_url']); @endphp @if (in_array(pathinfo($fileName, PATHINFO_EXTENSION), ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg']))
Portfolio Entry Image
@endif @endif
@lang('app.Submitted') {{ $entry['created_at']->diffForHumans() }}
@endforeach
@lang('app.Close')
@endif {{-- View Feedback Modal --}} @if($behavior['has_feedback'])

@lang('app.Teacher Feedback')

{{ $behavior['title'] }}

@if($behavior['feedback']['rating'] === 'already_excellent') ✓ @lang('app.Already Excellent') @else ⚡ @lang('app.Needs Improvement') @endif
{{ $behavior['feedback']['comment'] }}
@lang('app.From') {{ $behavior['feedback']['teacher_name'] }} · {{ $behavior['feedback']['created_at']->diffForHumans() }}
@lang('app.Close')
@endif @endforeach
@endif {{-- Add Behavior Option --}} @if($observableBehaviorsData['can_add_more'] && count($observableBehaviorsData['available_behaviors']) > 0)
@foreach($observableBehaviorsData['available_behaviors'] as $availableBehavior) @endforeach @lang('app.Add')

{{ __('app.You can add up to :count more behavior(s)', [ 'count' => $observableBehaviorsData['max_behaviors'] - count($observableBehaviorsData['selected_behaviors']) ]) }}

@endif
@endif
@elseif($slotData['can_choose']) @if($slotData['deadline_passed']) {{-- Deadline Passed --}}
{{ $slotData['status_message'] }}
@endif {{-- Show Selection Dropdown --}}
@if(count($slotData['available_instances']) > 0)
@foreach($slotData['available_instances'] as $instance) @endforeach
@else
@lang('app.No options available yet. Please check back later.')
@endif
@else {{-- Show Status Message --}}
{{ $slotData['status_message'] }}
@endif
@endforeach
{{-- Completion Message --}} @if($unitData['completion_percentage'] === 100)
@lang('app.All Slots Complete!')
@lang('app.You\'ve successfully selected all your options for this unit.')
@endif
@else {{-- No Unit Available --}}

@lang('app.No Unit Available')

@if($unitSelection === 'next') @lang('app.There is no next unit available at this time.') @else @lang('app.There are no units available for selection.') @endif

@endif