@extends("admin.layout.base")
@extends("admin.layout.header")

@section("title")
    Vaske Reservationer - Rediger
@endsection

@section("path")
    <a href="{{ route('washing-reservations.edit', ['washing_reservation' => $washing_reservation]) }}" class="text-white">Rediger Vaske Reservationer</a> /
@endsection

@section("content")
    <h1>Rediger Booking:</h1>
    <form method="post" action="{{ route('washing-reservations.update', ['washing_reservation' => $washing_reservation ]) }}">
        @csrf
        @method("put")
        <label for="time">Tidspunkt:</label>
        <input type="datetime-local" name="time" id="time" value="{{ $washing_reservation->time }}" required>
        <label for="machine">Vaskemaskine:</label>
        <select name="machine" id="machine" required>
            <option disabled value> -- Vælg Vaskemaskine -- </option>
            @foreach($machines as $machine)
                @if($machine->id == $washing_reservation->machine)
                    <option selected value="{{ $machine->id }}">{{ $machine->name }}</option>
                @else
                    <option value="{{ $machine->id }}">{{ $machine->name }}</option>
                @endif
            @endforeach
        </select>
        <input type="submit" class="btn btn-dark text-white" value="Rediger">
    </form>
@endsection
@section("scripts")
    <script>
        $(function() {
            $('form').areYouSure(
                {
                    message: 'It looks like you have been editing something. '
                        + 'If you leave before saving, your changes will be lost.'
                }
            );
        });
    </script>
@endsection
