{{-- ========================================================= ROOM / SEAT AREA ========================================================== --}}
@php $rooms = collect($rooms ?? []); /* |-------------------------------------------------------------------------- | Exam Wide Assignments |-------------------------------------------------------------------------- | | একটি seat বর্তমান class/section/group ছাড়াও | একই exam plan-এর অন্য scope-এ occupied থাকতে পারে। | */ $examWideAssignments = collect($exam_wide_assignments ?? []); $isFinal = isset($batch) && $batch->status === 'final'; @endphp {{-- ===================================================== NO ROOM ====================================================== --}} @if($rooms->isEmpty())
No active rooms found. Create rooms first.
@else
{{-- ================================================= ROOM LOOP ================================================== --}} @foreach($rooms as $room) @php $columns = collect( $room['columns'] ?? [] ); $matrix = $room['matrix'] ?? []; $roomLoopIndex = $loop->index; $roomDomId = ($room['id'] ?? 0) . '-' . $roomLoopIndex; $roomCollapseId = 'seat-room-collapse-' . $roomDomId; /* |-------------------------------------------------------------------------- | First room expanded by default |-------------------------------------------------------------------------- */ $isRoomExpanded = $loop->first; @endphp
{{-- ================================================= ROOM HEADER ================================================== --}}
{{ $room['name'] ?? 'Room' }}
{{ $room['code'] ?? '' }}
{{-- Room Statistics --}}
Columns: {{ $room['columns_count'] ?? 0 }} | Rows: {{ $room['rows_count'] ?? 0 }}
Capacity: {{ $room['capacity'] ?? 0 }} | Assigned: {{ $room['assigned_count'] ?? 0 }} | Remaining: {{ $room['remaining_count'] ?? 0 }}
{{-- Final Status --}} @if($isFinal) Final @endif {{-- Collapse Button --}}
{{-- ================================================= COLLAPSIBLE BODY ================================================== --}}
{{-- ============================================= ROOM CONFIGURATION WARNING ============================================== --}} @if(!($room['has_valid_configuration'] ?? true))
This room has missing or invalid seat configuration.
@endif {{-- ============================================= TOOL SECTION ============================================== --}} @if(!$isFinal)
{{-- ================================= COLUMN CONTROL ================================== --}}
Select Columns
@forelse($columns as $column) @php $columnNo = $column['column_no'] ?? $loop->iteration; $columnInputId = 'col-' . $roomDomId . '-' . $columnNo; @endphp
@empty No columns available @endforelse
{{-- COLUMN BUTTONS --}}
{{-- Fill --}} {{-- Remove --}}
{{-- ================================= ROW CONTROL ================================== --}}
Select Rows
@for( $row = 1; $row <= max( 1, (int) ($room['rows_count'] ?? 1) ); $row++ ) @php $rowInputId = 'row-' . $roomDomId . '-' . $row; @endphp
@endfor
{{-- ROW BUTTONS --}}
{{-- Fill --}} {{-- Remove --}}
@endif {{-- ============================================= SEAT GRID ============================================== --}}
@forelse($matrix as $rowCells) @foreach($rowCells ?? [] as $cell) @php /* |-------------------------------------------------------------------------- | Seat |-------------------------------------------------------------------------- */ $seat = $cell['seat'] ?? null; /* |-------------------------------------------------------------------------- | Assignment |-------------------------------------------------------------------------- | | First: | Current payload assignment. | | Fallback: | Exam-wide assignment. | */ $assignment = $cell['assignment'] ?? ( $seat ? $examWideAssignments->get( $seat->id ) : null ); /* |-------------------------------------------------------------------------- | Scope Status |-------------------------------------------------------------------------- */ $isCurrentBatch = $cell[ 'is_current_scope_assignment' ] ?? false; $isOccupiedOtherScope = $cell[ 'is_occupied_by_other_scope' ] ?? false; /* |-------------------------------------------------------------------------- | Safety fallback |-------------------------------------------------------------------------- | | যদি exam-wide fallback দিয়ে assignment পাওয়া যায় | এবং service অন্য-scope flag না পাঠায়, | assignment-এর batch check করা হবে। | */ if ( $assignment && isset($batch) && !$isCurrentBatch && !$isOccupiedOtherScope ) { if ( (int) $assignment ->exam_seat_plan_batch_id !== (int) $batch->id ) { $isOccupiedOtherScope = true; } } $occupied = !is_null( $assignment ); /* |-------------------------------------------------------------------------- | Student / Registration |-------------------------------------------------------------------------- */ $registration = $assignment ?->registration; $student = $assignment ?->student ?? $registration ?->student; @endphp {{-- ================================= REAL SEAT ================================== --}} @if($seat)
{{-- Seat Position --}} Column {{ $cell['column_label'] ?? '' }} | Row {{ $cell['row_no'] ?? '' }} {{-- ========================= OCCUPIED ========================== --}} @if($occupied)
{{ $student ?->student_name_english ?? $student ?->student_name_bangla ?? 'Unknown Student' }}
{{-- Class / Section --}}
Class: {{ $registration ?->class ?->name ?? '-' }} | Section: {{ $registration ?->section ?->name ?? '-' }}
{{-- Group / Roll --}}
Group: {{ $registration ?->group ?->name ?? '-' }} | Roll: {{ $registration ?->class_roll ?? $assignment ?->class_roll ?? '-' }}
{{-- ===================== OTHER SCOPE ====================== --}} @if($isOccupiedOtherScope)
Occupied (Other Class)
{{-- ===================== CURRENT SCOPE ====================== --}} @else
Assigned
{{-- Single Remove --}} @if(!$isFinal)
@endif @endif {{-- ========================= EMPTY SEAT ========================== --}} @else
Empty Seat
@endif
{{-- ================================= MISSING PHYSICAL SEAT ================================== --}} @else
Column {{ $cell['column_label'] ?? '' }} | Row {{ $cell['row_no'] ?? '' }}
No Seat
@endif @endforeach @empty
No seat matrix found.
@endforelse
@endforeach
@endif
{{-- ========================================================= STUDENT PANEL ========================================================== --}}
@php $students = collect( $unassigned_students ?? [] ); @endphp
{{-- ================================================= STUDENT PANEL HEADER ================================================== --}}
Unassigned Students
@if($isFinal) Seat plan has been finalized @else Select students before assigning seats @endif
{{ $students->count() }}
{{-- ================================================= STUDENT PANEL BODY ================================================== --}}
{{-- Final --}} @if($isFinal)
This seat plan is finalized and read-only.
{{-- Empty --}} @elseif($students->isEmpty())
No unassigned eligible students found.
{{-- Student List --}} @else @foreach($students as $registration)
{{-- Checkbox --}}
{{-- Student Details --}}
{{ $registration ->student ?->student_name_english ?? $registration ->student ?->student_name_bangla ?? 'Unknown Student' }}
Class: {{ $registration ->class ?->name ?? '-' }} | Section: {{ $registration ->section ?->name ?? '-' }} | Roll: {{ $registration ->class_roll ?? '-' }}
@if( $registration ->group ?->name )
Group: {{ $registration ->group ?->name }}
@endif
@endforeach @endif