@extends('layouts.app')

@section('content')
<div class="container-xxl flex-grow-1 container-p-y">
    <div class="card">
        <div class="card-header">
            <h5 class="mb-0">Course Details</h5>
            <hr/>
        </div>

        <div class="card-body">
            <p><b>ID:</b> {{ $course->id }}</p>
            <p><b>Title:</b> {{ $course->title }}</p>
            <p><b>Category:</b> {{ $course->category?->name }}</p>
            <p><b>Teacher:</b> {{ $course->teacher?->name }}</p>
            <p><b>Status:</b> {{ ucfirst($course->status) }}</p>
            <p><b>Start Date:</b> {{ $course->start_date?->format('Y-m-d') ?? 'N/A' }}</p>
            <p><b>Expire Date:</b> {{ $course->expire_date?->format('Y-m-d') ?? 'N/A' }}</p>
            <p>
                <b>Course Window:</b>
                @if($course->isExpired())
                    <span class="badge bg-danger">Expired</span>
                @elseif($course->isWithinScheduledWindow())
                    <span class="badge bg-success">Active</span>
                @else
                    <span class="badge bg-warning text-dark">Upcoming</span>
                @endif
            </p>
            <p><b>Description:</b> {{ $course->description }}</p>

            <a href="{{ route('courses.index') }}" class="btn btn-secondary">Back</a>
        </div>
    </div>
</div>
@endsection
