<form class="row g-3 auto-width" action="{{ route('bed-group.update', $group->id)}}" method="post" enctype='multipart/form-data' id="source_form">
    @csrf
    @method("PATCH")
    <div class="col-md-12">
        <label for="name" class="form-label">Name <span class="text-danger"><b>*</b></span></label>
        <input type="text" class="form-control" id="name" name="name" aria-describedby="inputGroupPrepend" required value="{{$group->name}}">
        <span class="text-danger error_name" style="display:none;">This field is required.</span>
    </div>
     {{-- code --}}
     <div class="col-md-12">
        <label for="code" class="form-label">code </label>
        <input readonly type="code" class="form-control" id="code" name="code" aria-describedby="inputGroupPrepend" required value="{{$group->code}}">
        <span class="text-danger error_code" style="display:none;">This field is required.</span>
    </div>
    {{-- Color --}}
    <div class="col-md-6">
        <label for="color" class="form-label">Color <span class="text-danger"><b>*</b></span></label>
        <input type="color" class="form-control" id="color" name="color" aria-describedby="inputGroupPrepend" required value="{{$group->color}}">
        <span class="text-danger error_color" style="display:none;">This field is required.</span>
    </div>
    {{-- Floor --}}
    {{-- <div class="col-md-5">
        <div>
            <label for="floor_id" class="form-label">Floor <span class="text-danger"><b>*</b></span></label>
        </div>
        <div class="input-group">
            <select class="single-select form-control" name="floor_id" id="floor_id">
                @foreach ($floor as $list)
                <option value="{{ $list->id }}" {{ $list->id == $group->floor_id ? 'selected' : '' }}>
                    {{ $list->name }}
                @endforeach
            </select>
            <span class="text-danger error_floor_id" style="display: none;">This field is required.</span>
        </div>
    </div> --}}
    {{-- Building --}}
    {{-- <div class="col-md-5">
        <div>
            <label for="building_id" class="form-label">Building <span class="text-danger"><b>*</b></span></label>
        </div>
        <div class="input-group">
            <select class="single-select form-control" name="building_id" id="building_id">
                @foreach ($building as $list)
                <option value="{{ $list->id }}" {{ $list->id == $group->building_id ? 'selected' : '' }}>
                    {{ $list->name }}
                @endforeach
            </select>
            <span class="text-danger error_building_id" style="display: none;">This field is required.</span>
        </div>
    </div> --}}
    {{-- Priority --}}
    <div class="col-md-6">
        <label for="priority" class="form-label">Priority </label>
        <input type="number" class="form-control" name="priority" aria-describedby="inputGroupPrepend" required value="{!! $group->priority !!}">
        <span class="text-danger error_priority" style="display:none;">This field is required.</span>
    </div>
    {{-- Description --}}
    <div class="col-md-12">
        <label for="description" class="form-label">Description</label>
        <textarea class="form-control" max=100 id="description" name="description">{{$group->description}}</textarea>
        <span class="text-danger description" style="display:none;">This field is required.</span>
    </div>
</form>
<script>
    // $(document).ready(function() {
    //     $('#building_id').change(function() {
    //         getFloors(); // Call the function when the "building" dropdown changes
    //     });

    //     function getFloors() {
    //         let building_id = $('#building_id').val();

    //         $.ajax({
    //             type: "POST",
    //             url: "{{ route('getFloor') }}", // Use the route function
    //             data: {
    //                 building_id: building_id
    //             },
    //             success: function(data) {
    //                 $('#floor_id').html(data);
    //             },
    //             error: function(data) {
    //                 console.log(data);
    //             }
    //         });
    //     }
    // });
</script>
