@extends('layouts.app')
@section('title','New Training Program')
@section('page-title','Training & Development')

@section('content')
<div class="page-header">
    <div class="d-flex align-items-center gap-2">
        <a href="{{ route('training.index') }}" class="btn btn-sm btn-outline-secondary"><i class="bi bi-arrow-left"></i></a>
        <div>
            <h1>New Training Program</h1>
            <nav aria-label="breadcrumb"><ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="{{ route('training.index') }}">Training</a></li>
                <li class="breadcrumb-item active">New</li>
            </ol></nav>
        </div>
    </div>
</div>

<div class="row g-3">
    <div class="col-12 col-lg-8">
        <div class="card">
            <div class="card-header"><i class="bi bi-mortarboard me-2" style="color:var(--ul-primary);"></i>Program Details</div>
            <div class="card-body">
                <form method="POST" action="{{ route('training.store') }}">
                @csrf
                <div class="row g-3">
                    <div class="col-12">
                        <label class="form-label">Program Title *</label>
                        <input type="text" name="title" class="form-control" value="{{ old('title') }}" required placeholder="e.g. Data Analysis with Excel">
                    </div>
                    <div class="col-12">
                        <label class="form-label">Description</label>
                        <textarea name="description" class="form-control" rows="3" placeholder="Brief description of what the program covers…">{{ old('description') }}</textarea>
                    </div>
                    <div class="col-6 col-sm-4">
                        <label class="form-label">Type *</label>
                        <select name="type" class="form-select" required>
                            <option value="">— Select —</option>
                            @foreach(['internal'=>'Internal','external'=>'External','workshop'=>'Workshop','conference'=>'Conference','online'=>'Online'] as $val=>$label)
                            <option value="{{ $val }}" {{ old('type')===$val?'selected':'' }}>{{ $label }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="col-6 col-sm-4">
                        <label class="form-label">Status</label>
                        <select name="status" class="form-select">
                            <option value="scheduled" {{ old('status','scheduled')==='scheduled'?'selected':'' }}>Scheduled</option>
                            <option value="ongoing"   {{ old('status')==='ongoing'?'selected':'' }}>Ongoing</option>
                        </select>
                    </div>
                    <div class="col-6 col-sm-4">
                        <label class="form-label">Max Participants</label>
                        <input type="number" name="max_participants" class="form-control" value="{{ old('max_participants') }}" min="1" placeholder="No limit if blank">
                    </div>
                    <div class="col-6">
                        <label class="form-label">Start Date *</label>
                        <input type="date" name="start_date" class="form-control" value="{{ old('start_date') }}" required>
                    </div>
                    <div class="col-6">
                        <label class="form-label">End Date *</label>
                        <input type="date" name="end_date" class="form-control" value="{{ old('end_date') }}" required>
                    </div>
                    <div class="col-12 col-sm-6">
                        <label class="form-label">Location / Venue</label>
                        <input type="text" name="location" class="form-control" value="{{ old('location') }}" placeholder="e.g. Board Room, Online, Accra Ghana">
                    </div>
                    <div class="col-12 col-sm-6">
                        <label class="form-label">Facilitator / Provider</label>
                        <input type="text" name="facilitator" class="form-control" value="{{ old('facilitator') }}" placeholder="e.g. Dr. Smith, ExcelPro Institute">
                    </div>
                    <div class="col-6">
                        <label class="form-label">Cost (USD)</label>
                        <input type="number" name="cost" class="form-control" value="{{ old('cost') }}" step="0.01" min="0" placeholder="0.00">
                    </div>
                    <div class="col-12 d-flex gap-2 mt-2">
                        <button type="submit" class="btn btn-primary"><i class="bi bi-mortarboard me-1"></i>Create Program</button>
                        <a href="{{ route('training.index') }}" class="btn btn-outline-secondary">Cancel</a>
                    </div>
                </div>
                </form>
            </div>
        </div>
    </div>
</div>
@endsection
