@extends('layouts.app') @section('title', 'Modifier la réservation #' . $reservation->id) @section('content')

Modifier la réservation #{{ $reservation->id }}

{{ $hostel->name }}

← Retour aux réservations
@if($errors->has('error'))
{{ $errors->first('error') }}
@endif @if($errors->any() && !$errors->has('error'))
@endif
@csrf @method('PUT') {{-- 1. Informations réservation --}}
1 Informations réservation
{{-- 2. Guests & Affectations --}}
2 Guests & Affectations

Guests

    {{-- ✅ 3. Extras (optionnel) --}}
    3 Extras (optionnel)
    @if(isset($extras) && $extras->count() > 0)
    @foreach($extras as $extra) @php $isTracked = in_array($extra->stock_mode, ['consumable', 'rentable']); $existingQty = $existingExtras[$extra->id] ?? 0; $stock = $extra->stock_quantity + $existingQty; // stock réel + quantité déjà allouée $isAvailable = !$isTracked || $stock > 0; @endphp

    {{ $extra->name }}

    @if($extra->description)

    {{ $extra->description }}

    @endif
    @if($isTracked) {{ $stock > 0 ? "Stock : {$stock}" : 'Rupture' }} @else ∞ Illimité @endif
    @endforeach
    @else

    🛒 Aucun extra disponible pour cet hostel.

    @endif
    {{-- 4. Récapitulatif --}}
    4 Récapitulatif tarification
    Guest Affectation Prix saisi Devise ≈ TND
    Chargement...
    Total TND0.000
    Total EUR0.000
    Total USD0.000
    @php $eurRate = $rates->get('EUR'); $usdRate = $rates->get('USD'); $eurSell = $eurRate ? number_format((float)$eurRate->sell_rate_to_tnd, 4, '.', '') : null; $eurBuy = $eurRate ? number_format((float)$eurRate->buy_rate_to_tnd, 4, '.', '') : null; $usdSell = $usdRate ? number_format((float)$usdRate->sell_rate_to_tnd, 4, '.', '') : null; $usdBuy = $usdRate ? number_format((float)$usdRate->buy_rate_to_tnd, 4, '.', '') : null; @endphp

    Taux de change (vente)

    EUR Vente : {{ $eurSell ?? '—' }}  |  Achat : {{ $eurBuy ?? '—' }} USD Vente : {{ $usdSell ?? '—' }}  |  Achat : {{ $usdBuy ?? '—' }}
    {{-- 5. Confirmation --}}
    5 Confirmation & Sécurité

    Le mot de passe doit être validé pour appliquer les modifications.

    @php $jsEurSell = $eurRate ? (float)$eurRate->sell_rate_to_tnd : 0; $jsEurBuy = $eurRate ? (float)$eurRate->buy_rate_to_tnd : 0; $jsUsdSell = $usdRate ? (float)$usdRate->sell_rate_to_tnd : 0; $jsUsdBuy = $usdRate ? (float)$usdRate->buy_rate_to_tnd : 0; @endphp @endsection