Made washing-reservations search

This commit is contained in:
2020-07-29 15:27:07 +02:00
parent 0dd262d50c
commit 4826725e07
3 changed files with 114 additions and 1 deletions
@@ -13,11 +13,20 @@
<div class="row align-items-center">
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('washing-reservations.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Reservation</a>
<form method="post" action="{{ route("users.store") }}">
<form method="post" action="{{ route("washing-reservations.store") }}">
@csrf
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg på Navn, Telefon"></input>
</form>
<input class="checkbox-inline" type="checkbox" name="checkbox" id="vaskemaskine" value="vaskemaskine">
<label for="navn">Vaskemaskine</label>
<input class="checkbox-inline" type="checkbox" name="checkbox" id="tidspunkt" value="tidspunkt">
<label for="efternavn">Tispunkt</label>
<input class="checkbox-inline" type="checkbox" name="checkbox" id="bruger" value="bruger">
<label for="email">Bruger</label>
</div>
<table class="tbl mt-2">
<tr>
@@ -45,4 +54,45 @@
</table>
{{ $reservations->links() }}
<script>
$('#search').on('keyup', function () {
$value = $(this).val();
$checkboxValue = $( "input:checked" ).val();
$.ajax({
type: 'get',
url: '{{route('washing-reservations.search')}}',
data: {'search':$value, 'isCheck': $checkboxValue},
success:function (data) {
console.log($checkboxValue);
$('tbody').html(data);
},
error:function (data) {
console.log(data);
}
});
})
</script>
<script>
$(document).ready(function(){
$("input:checkbox").on('click', function() {
var $box = $(this);
if ($box.is(":checked")) {
var group = "input:checkbox[name='" + $box.attr("name") + "']";
$(group).prop("checked", false);
$box.prop("checked", true);
} else {
$box.prop("checked", false);
}
});
});
</script>
@endsection