@extends('layouts.admin')
@section('title', 'Creation de rapport d\'audience au rectorat UAC')
<style>
    /* ===== MODERN GLASS CARD ===== */
    .glass-card {
        background: rgba(255, 255, 255, 0.75);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-radius: var(--radius-xl);
        box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.6);
        border: 1px solid rgba(255, 255, 255, 0.35);
    }

    /* Header glass */
    .glass-card .card-header {
        background: transparent;
    }

    /* Footer glass */
    .glass-card .card-footer {
        background: transparent;
    }

    /* Inputs gla font-family: Arial, sans-serifss */
    .glass-card .form-control-modern,
    .glass-card .form-control,
    .glass-card input[type="datetime-local"] {
        background: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(6px);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    .glass-card .form-control-modern:focus,
    .glass-card .form-control:focus {
        background: rgba(255, 255, 255, 0.85);
        border-color: var(--primary-500);
        box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
    }

    /* Summernote glass */
    .glass-card .note-editor {
        background: rgba(255, 255, 255, 0.6);
        border-radius: var(--radius-lg);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    .glass-card .note-toolbar {
        background: rgba(255, 255, 255, 0.7);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
</style>

@section('content')

    <div class="row justify-content-center">
        <div class="col-lg-9">

            <div class="glass-card p-4 mb-4">

                <!-- Header -->
                <div class="mb-4">
                    <h4 class="fw-bold mb-4 text-center">
                        Rédiger le compte-rendu d’audience
                    </h4>
                    <small class="text-muted">
                        Objet  : {{ $appointment->subject ?? '—' }}
                    </small>
                </div>

                <form method="POST" action="{{ route('admin.reports.update', $report) }}">
                    @csrf
                    @method('PUT')

                    <!-- Dates -->
                    <div class="mb-4">
                        <div class="row g-3">

                            <!-- Début -->
                            <div class="col-md-6">
                                <label class="form-label fw-semibold d-block ">
                                    Heure du début de la séance <span class="text-danger">*</span>
                                </label>

                                 <input type="datetime-local" name="start_date" value="{{ old('start_date', $report->start_date) }}">

                                @error('start_date')
                                    <div class="invalid-feedback d-block">{{ $message }}</div>
                                @enderror
                            </div>

                            <!-- Fin -->
                            <div class="col-md-6">
                                <label class="form-label fw-semibold d-block ">
                                    Heure de Fin de la séance <span class="text-danger">*</span>
                                </label>

                               <input type="datetime-local" name="end_date" value="{{ old('end_date', $report->end_date) }}">

                                @error('end_date')
                                    <div class="invalid-feedback d-block">{{ $message }}</div>
                                @enderror
                            </div>

                        </div>
                    </div>


                    <!-- Lieu -->
                    <div class="mb-4">
                        <label class="form-label fw-semibold d-block">
                            Lieu de l’audience
                        </label>
                        <input type="text" name="place" class="form-control border-1 border-black @error('place') is-invalid @enderror"
                            placeholder="Ex : Cabinet du ministre"value="{{ old('place', $report->place) }}">
                        @error('place')
                            <div class="invalid-feedback d-block">{{ $message }}</div>
                        @enderror
                    </div>

                    <!-- Compte rendu -->
                    <div class="mb-4">
                        <label class="form-label fw-semibold">
                            Compte-rendu *
                        </label>
                        <textarea name="content" id="reportContent"
                            class="form-control @error('content') is-invalid @enderror"
                            rows="10">{{ old('content', $report->content) }}</textarea>
                        @error('content')
                            <div class="invalid-feedback d-block">{{ $message }}</div>
                        @enderror
                    </div>

                    <!-- Actions -->
                    <div class="d-flex gap-2 mt-4">
                        <a href="{{ route('admin.appointments.index') }}"
                            class="btn btn-outline-secondary btn-modern flex-grow-1">
                            Annuler
                        </a>

                        <button type="submit" class="btn btn-primary-modern btn-modern flex-grow-1">
                            Enregistrer le compte-rendu
                        </button>
                    </div>

                </form>
            </div>
        </div>
    </div>

@endsection


@section('scripts')
    <script>
        $(document).ready(function () {
            $('#reportContent').summernote({
                height: 500,
                placeholder: 'Rédigez ici le compte-rendu détaillé de la séance…'
            });
        });
    </script>
@endsection