Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp
This commit is contained in:
commit
faec1f66c5
|
@ -171,12 +171,13 @@ class EventController extends Controller
|
|||
"<th>Event Navn</th>".
|
||||
"<th>Event Beskrivelse</th>".
|
||||
"<th>Event Dato</th>".
|
||||
"<th style=\"width: 1em;\"><img class=\"w-100\" src=\"http://127.0.0.1:8000/images/icons/eye.svg\" alt=\"Update\"></th>".
|
||||
"<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>";
|
||||
$events = DB::table('events')->where('name', 'LIKE',$request->search.'%')
|
||||
->orWhere('date','LIKE', $request->search.'%')
|
||||
->get();
|
||||
->get();//Job is here dude :9
|
||||
|
||||
if(count($events) !== 0){
|
||||
foreach ($events as $key => $event){
|
||||
|
@ -184,6 +185,7 @@ class EventController extends Controller
|
|||
'<td>' . $event->name . '</td>'.
|
||||
'<td>' . $event->description .'</td>'.
|
||||
'<td>' . $event->date .'</td>'.
|
||||
'<td><a href="'. route("events.signups", [ "event" => $event->id ]).'"><img class="w-100" src="'. asset('/images/icons/eye-dark.svg') .'" alt="Update"></a></td>'.
|
||||
'<td><a href="'. route("events.edit", [ "event" => $event->id ]) . '"><img class="w-100" src="'. asset('/images/icons/pencil-dark.svg') . '" alt="Update"></a></td>'.
|
||||
'<td><form method="post" action="' .route("events.destroy", [ "event" => $event->id ]). '" class="w-100 nostyle">'.
|
||||
csrf_field().
|
||||
|
@ -201,6 +203,7 @@ class EventController extends Controller
|
|||
'<td></td>'.
|
||||
'<td></td>'.
|
||||
'<td></td>'.
|
||||
'<td></td>'.
|
||||
'</tr>';
|
||||
}
|
||||
return Response($output);
|
||||
|
|
|
@ -288,13 +288,35 @@ class UserController 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>";
|
||||
$users = User::query()->where('name_first', 'LIKE',$request->search.'%')
|
||||
|
||||
|
||||
//filter search
|
||||
if($request->isCheck === "navn")
|
||||
$users = User::query()->where('name_first', 'LIKE',$request->search.'%')->get();
|
||||
elseif ($request->isCheck === "efternavn")
|
||||
$users = User::query()->where('name_last', 'LIKE',$request->search.'%')->get();
|
||||
elseif ($request->isCheck === "email")
|
||||
$users = User::query()->where('email', 'LIKE',$request->search.'%')->get();
|
||||
elseif ($request->isCheck === "telefon")
|
||||
$users = User::query()->where('phone', 'LIKE',$request->search.'%')->get();
|
||||
else
|
||||
$users = User::query()->where('name_first', 'LIKE',$request->search.'%')
|
||||
->orWhere('name_last','LIKE', $request->search.'%')
|
||||
->orWhere('phone','LIKE', $request->search.'%')
|
||||
->orWhere('email','LIKE',$request->search. '%')
|
||||
->orWhere('name','LIKE',$request->search. '%')
|
||||
->get();
|
||||
|
||||
|
||||
|
||||
|
||||
//Dont delete
|
||||
/*elseif ($request->isCheck === "rolle")
|
||||
$users = User::query()->where('rolle', 'LIKE',$request->search.'%');*/
|
||||
|
||||
|
||||
|
||||
|
||||
if(count($users) !== 0){
|
||||
foreach ($users as $key => $user){
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue