Made filter search

This commit is contained in:
2020-07-29 09:49:54 +02:00
parent fd3f2de668
commit 26c28d8e54
3 changed files with 64 additions and 4 deletions
@@ -20,7 +20,24 @@
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg efter navn,email,tf"></input>
</form>
</div>
<div id="filterSearch">
<form action="" method="POST">
<input class="checkbox-inline" type="checkbox" name="checkbox" id="navn" value="navn">
<label for="navn">Navn</label>
<input class="checkbox-inline" type="checkbox" name="checkbox" id="efternavn" value="efternavn">
<label for="efternavn">Efternavn</label>
<input class="checkbox-inline" type="checkbox" name="checkbox" id="email" value="email">
<label for="efternavn">Email</label>
<input class="gem" type="checkbox" id="telefon" name="checkbox" value="telefon">
<label for="telefon">Telefon</label>
<input class="gem" type="checkbox" id="rolle" name="checkbox"value="rolle">
<label for="rolle">Rolle</label>
</form>
</div>
<table class="tbl mt-2">
<tr>
<th>Fornavn</th>
@@ -63,13 +80,14 @@
<script>
$('#search').on('keyup', function () {
$value = $(this).val();
$checkboxValue = $( "input:checked" ).val();
$.ajax({
type: 'get',
url: '{{route('users.search')}}',
data: {'search':$value},
data: {'search':$value, 'isCheck': $checkboxValue},
success:function (data) {
console.log($checkboxValue);
$('tbody').html(data);
console.log(data);
},
error:function (data) {
console.log(data);
@@ -80,4 +98,21 @@
<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