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

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

@section("path")
    <a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Vaskemaskine Reservation</a> /
@endsection

@section("content")
    <h1>Opret Reservation:</h1>
    <form method="post" action="{{ route("washing-reservations.store") }}">
        @csrf
        <label for="time">Tidspunkt:</label>
            <input type="datetime-local" name="time" id="time" required>
        <label for="machine_id">Vaskemaskine:</label>
        <select name="machine_id" id="machine_id" required>
            <option disabled selected value> -- Vælg Vaskemaskine -- </option>
            @foreach($machines as $machine)
                <option value="{{ $machine->id }}">{{ $machine->name }}</option>
            @endforeach
        </select>
        <label for="user_id">Bruger:</label>
        <select name="user_id" id="user_id" required>
            <option disabled selected value> -- Vælg Bruger -- </option>
            @foreach($users as $user)
                <option value="{{ $user->id }}">{{ ucfirst($user->name_first) }} {{ ucfirst($user->name_last) }}</option>
            @endforeach
        </select>
        <input type="submit" class="btn btn-dark text-white" value="Opret">
    </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
