@extends('layouts.admin') @section('title', 'Edit Course') @section('heading', 'Edit Course') @section('header-actions') ← Back to Courses @endsection @section('content') @php $semesterCount = $course->type === 'diploma' ? 6 : 2; $unitsBySemester = $course->units->groupBy('semester'); @endphp
{{-- ── Course Details ── --}}
@csrf @method('PUT')

Course Details

@error('title')

{{ $message }}

@enderror
@error('code')

{{ $message }}

@enderror

Used in certificate numbers

@error('type')

{{ $message }}

@enderror
@error('duration_weeks')

{{ $message }}

@enderror
@error('fee')

{{ $message }}

@enderror
@error('description')

{{ $message }}

@enderror
is_active ? '1' : '0') === '1' ? 'checked' : '' }} class="w-4 h-4 accent-gold rounded">
Cancel
{{-- ── Curriculum (Units by Semester) ── --}}

Curriculum

{{ $semesterCount }} semesters · {{ $course->units->count() }} {{ Str::plural('unit', $course->units->count()) }} added

@for ($sem = 1; $sem <= $semesterCount; $sem++) @php $semUnits = $unitsBySemester->get($sem, collect()); @endphp
{{-- Semester toggle button --}} {{-- Semester body --}}
{{-- Existing units list --}} @if($semUnits->count())
@foreach($semUnits as $unit)
@if($unit->unit_code) {{ $unit->unit_code }} @endif
{{ $unit->unit_name }}
@if($unit->description)
{{ $unit->description }}
@endif
@csrf @method('DELETE')
@endforeach
@else

No units added to this semester yet.

@endif {{-- Add unit form --}}
@csrf

Add Unit to Semester {{ $sem }}

@endfor
@push('scripts') @endpush @endsection