@extends('layouts.app')
@section('title', 'Nouvelle demande - '.$typeLabel)
@section('content')
<a href="{{ route('partner.requests.index', $type) }}" class="mb-3 d-inline-block">&laquo; Retour</a>
<h3 class="mb-4">{{ $typeLabel }}</h3>

<div class="card p-4" style="max-width:700px;">
    <form method="POST" action="{{ route('partner.requests.store', $type) }}" enctype="multipart/form-data">
        @csrf

        @if($type === 'prelevement')
            <div class="mb-3">
                <label class="form-label">Nombre estime d'echantillons</label>
                <input type="number" name="estimated_quantity" class="form-control" min="1" required>
            </div>
            <div class="mb-3">
                <label class="form-label">Creneau souhaite</label>
                <input type="text" name="requested_slot" class="form-control" placeholder="Ex: aujourd'hui 14h-16h" required>
            </div>
            <div class="mb-3">
                <label class="form-label">Notes (optionnel)</label>
                <textarea name="notes" class="form-control" rows="3"></textarea>
            </div>

        @elseif($type === 'consommable')
            <div class="mb-3">
                <label class="form-label">Consommable souhaite</label>
                <input type="text" name="consumable_name" class="form-control" placeholder="Ex: tubes EDTA, sachets, etiquettes..." required>
            </div>
            <div class="mb-3">
                <label class="form-label">Quantite</label>
                <input type="number" name="estimated_quantity" class="form-control" min="1" required>
            </div>
            <div class="mb-3">
                <label class="form-label">Notes (optionnel)</label>
                <textarea name="notes" class="form-control" rows="3"></textarea>
            </div>

        @elseif($type === 'reclamation')
            <div class="mb-3">
                <label class="form-label">Categorie</label>
                <select name="category" class="form-select" required>
                    <option value="retard">Retard</option>
                    <option value="perte">Perte</option>
                    <option value="casse">Casse</option>
                    <option value="erreur_etiquetage">Erreur d'etiquetage</option>
                    <option value="autre">Autre</option>
                </select>
            </div>
            <div class="mb-3">
                <label class="form-label">Description</label>
                <textarea name="description" class="form-control" rows="4" required></textarea>
            </div>

        @elseif($type === 'resultat')
            <div class="mb-3">
                <label class="form-label">Reference patient / dossier</label>
                <input type="text" name="patient_reference" class="form-control" required>
            </div>
            <div class="mb-3">
                <label class="form-label">Notes (optionnel)</label>
                <textarea name="notes" class="form-control" rows="3"></textarea>
            </div>
        @endif

        <div class="mb-3">
            <label class="form-label">Urgence</label>
            <select name="urgency" class="form-select" required>
                <option value="normal">Normal</option>
                <option value="urgent">Urgent</option>
            </select>
        </div>

        <button class="btn btn-primary">Envoyer la demande</button>
    </form>
</div>
@endsection
