Made it so they can now make there own dynamic guide

This commit is contained in:
Neerholt 2020-08-04 15:29:08 +02:00
parent 210aa00fc6
commit 9dd09f2205
4 changed files with 46 additions and 7 deletions

View File

@ -146,6 +146,18 @@ class ContactController extends Controller
"<th style=\"width: 1em;\"><img class=\"w-100\" src=\"http://127.0.0.1:8000/images/icons/pencil.svg\" alt=\"Update\"></th>".
"<th style=\"width: 1em;\"><img class=\"w-100\" src=\"http://127.0.0.1:8000/images/icons/trashcan.svg\" alt=\"Delete\"></th>".
"</tr>";
if($request->isCheck === "navn")
$users = Contact::query()->where('contactname', 'LIKE',$request->search.'%')->get();
elseif ($request->isCheck === "titel")
$users = Contact::query()->where('title', 'LIKE',$request->search.'%')->get();
elseif ($request->isCheck === "email")
$users = Contact::query()->where('email', 'LIKE',$request->search.'%')->get();
elseif ($request->isCheck === "tf")
$users = Contact::query()->where('phone', 'LIKE',$request->search.'%')->get();
else
$users = DB::table('contacts')->where('contactname', 'LIKE',$request->search.'%')
->orWhere('title','LIKE', $request->search.'%')
->orWhere('phone','LIKE', $request->search.'%')
@ -170,7 +182,7 @@ class ContactController extends Controller
}
}else{
$output.='<tr>'.
'<td>Din søgning matchede ikke nogen personer</td>'.
'<td>Intet match</td>'.
'<td></td>'.
'<td></td>'.
'<td></td>'.

View File

@ -231,7 +231,6 @@ class WashingReservationController extends Controller
'<td></td>'.
'<td></td>'.
'<td></td>'.
'<td></td>'.
'</tr>';
}
return Response($output);

View File

@ -2,7 +2,7 @@
@extends("admin.layout.header")
@section("title")
Events - Vis
Kontakt - Vis
@endsection
@section("path")
@ -15,9 +15,18 @@
<form method="post" action="{{ route("users.store") }}">
@csrf
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg på Navn, Email, Telefon"></input>
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg på navn,titel,email,tf"></input>
</form>
<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="titel" value="titel">
<label for="efternavn">Titel</label>
<input class="checkbox-inline" type="checkbox" name="checkbox" id="email" value="email">
<label for="efternavn">Email</label>
<input class="checkbox-inline" type="checkbox" name="checkbox" id="tf" value="tf">
<label for="efternavn">Telefon</label>
<p></p>
</div>
@ -51,11 +60,13 @@
<script>
$('#search').on('keyup', function () {
$value = $(this).val();
$checkboxValue = $( "input:checked" ).val();
$.ajax({
type: 'get',
url: '{{route('contacts.search')}}',
data: {'search':$value},
data: {'search':$value, 'isCheck': $checkboxValue},
success:function (data) {
console.log($checkboxValue);
$('tbody').html(data);
},
error:function (data) {
@ -66,5 +77,22 @@
</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

View File

@ -15,14 +15,14 @@
<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>
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg på vaskemaskine, tid"></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>
<label for="efternavn">Tidspunkt</label>
<input class="checkbox-inline" type="checkbox" name="checkbox" id="bruger" value="bruger">
<label for="email">Bruger</label>