@extends('layouts.app')

@section('title', 'Add Lesson Plan | Curriculum')

@section('sidebar-menu')
    @include('teacher.partials.sidebar')
@endsection

@section('breadcrumb')
    <span><a href="{{ route('teacher.dashboard') }}">Home</a></span> / 
    <span><a href="{{ route('teacher.curriculum.index') }}">Curriculum</a></span> / 
    <span class="active-page">Add Lesson Plan</span>
@endsection

@section('content')
<div class="row justify-content-center">
    <div class="col-md-8">
        <div class="card shadow-sm">
            <div class="card-header">Add New Lesson Plan</div>
            <div class="card-body">
                @if($errors->any())
                    <div class="alert alert-danger">
                        <ul class="mb-0">
                            @foreach($errors->all() as $error)
                                <li>{{ $error }}</li>
                            @endforeach
                        </ul>
                    </div>
                @endif
                <form action="{{ route('teacher.curriculum.store') }}" method="POST">
                    @csrf
                    <div class="row mb-3">
                        <div class="col-md-6">
                            <label class="form-label">Class</label>
                            <select name="school_class_id" class="form-control" required>
                                <option value="">Select a class...</option>
                                @foreach($classes as $c)
                                    <option value="{{ $c->id }}">{{ $c->name }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label">Subject</label>
                            <select name="subject_id" class="form-control" required>
                                <option value="">Select a subject...</option>
                                @foreach($subjects as $s)
                                    <option value="{{ $s->id }}">{{ $s->name }}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">Lesson Title</label>
                        <input type="text" name="title" class="form-control" required placeholder="e.g. Introduction to Algebra">
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-6">
                            <label class="form-label">Target Date</label>
                            <input type="date" name="date" class="form-control" required>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label">Status</label>
                            <select name="status" class="form-control" required>
                                <option value="pending">Pending</option>
                                <option value="completed">Completed</option>
                            </select>
                        </div>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">Description / Objectives</label>
                        <textarea name="description" class="form-control" rows="4" placeholder="Enter lesson objectives and outline..."></textarea>
                    </div>
                    <div class="text-end">
                        <a href="{{ route('teacher.curriculum.index') }}" class="btn btn-secondary">Cancel</a>
                        <button type="submit" class="btn btn-primary">Save Lesson Plan</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@endsection
