Initial Commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<div class="mb-3 row">
|
||||
<label for="room_input" class="col-2 col-form-label fw-bold">@lang('room') : </label>
|
||||
<datalist id="rooms">
|
||||
@foreach($rooms as $room)
|
||||
<option data-room-id="{{$room->id}}">{{$room->building->name}} - {{$room->name}}</option>
|
||||
@endforeach
|
||||
</datalist>
|
||||
<div class="col-10">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="room"
|
||||
id="room_input"
|
||||
list="rooms"
|
||||
placeholder="@lang('room')"
|
||||
value="{{old('room')}}"
|
||||
required
|
||||
oninput="room_change(this)"
|
||||
>
|
||||
</div>
|
||||
<input type="hidden" name="room_id" id="room_id_input">
|
||||
</div>
|
||||
<script>
|
||||
function room_change(elem){
|
||||
let room_input = $("#room_input");
|
||||
|
||||
let room_id = $('#rooms option').filter(function() {
|
||||
return this.value == room_input.val();
|
||||
}).data('room-id');
|
||||
|
||||
if(room_id == null || typeof room_id === "undefined"){
|
||||
$("#room_id_input").val(0);
|
||||
}
|
||||
else{
|
||||
$("#room_id_input").val(room_id);
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user