v0.10.11a - Made hide filter, filter washing machine search semi done, and texts fixs

This commit is contained in:
Neerholt 2020-08-20 14:59:22 +02:00
parent 4f9cf41656
commit 89276c5af1
10 changed files with 115 additions and 14 deletions

View File

@ -250,6 +250,7 @@ class EventController extends Controller
"</tr>";
$events = DB::table('events')->orderBY('date' , 'asc')->where('name', 'LIKE',$request->search.'%')
->orWhere('date','LIKE', $request->search.'%')
->orWhere('accountable','LIKE', $request->search.'%')
->get();//Job is here dude :9
if(count($events) !== 0){

View File

@ -163,4 +163,54 @@ class LocationController extends Controller
return 1;
}
}
public function search(Request $request){
if($request->ajax()){
$output = "<tr>".
"<th>Navn</th>".
"<th>Lokation</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>";
if($request) {
$locations = Location::query()->orderBy('created_at', 'desc')->where('name', '=', $request->option)->get();
//$machines = WashingMachine::query()->where('created_at', '=', $locations->created_at)->get();
}
elseif($request->option == "all"){
$locations = Location::all();
}
if(count($locations) !== 0){
foreach ($locations as $key => $location){
$output.='<tr>'.
//'<td>' . $location->name . '</td>'.
'<td><p>Test data</p></td>'.
'<td>' . $location->name . '</td>'.
'<td><form method="post" action="' .route("locations.destroy", [ "location" => $location ]). '" class="w-100 nostyle">'.
'<td><form method="post" action="' .route("locations.edit", [ "location" => $location ]). '" class="w-100 nostyle">'.
csrf_field().
method_field("delete").
'<button class="w-100 nostyle" onclick="return confirm(\'Are you sure you want to delete?\');" type="submit"><img class="w-100 cursor-pointer" src="'. asset('/images/icons/trashcan-dark.svg') . '" alt="Delete"></button>'.
'</form>'.
'</td>'.
'</tr>';
}
}else{
$output.='<tr>'.
'<td>Det er ikke blivet oprettet nogen vaskmaskine på denne lokation i nu</td>'.
'<td></td>'.
'<td></td>'.
'<td></td>'.
'</tr>';
}
return Response($output);
}
}
}

View File

@ -16,4 +16,9 @@ class WashingMachine extends Model
protected $fillable = [
'name', 'location_id'
];
public function washingMachine()
{
return $this->hasMany('App\locations');
}
}

View File

@ -15,9 +15,12 @@
<form method="post" action="{{ route("users.store") }}">
@csrf
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg på navn,titel,email,tf"></input>
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg på navn,titel,email,tf">
</form>
<button id="filterButton" type="button" class="btn btn-sde-blue mb-0">Filter</button>
</div>
<div id="showHideCheckbox" class="mt-1 ">
<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">
@ -26,9 +29,8 @@
<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>
<div id="showHideCheckboxs" style="margin-bottom: -38px">
</div>
<table class="tbl mt-2">
<tr>
@ -90,6 +92,18 @@
}
});
});
//Show hide search filter
$('#showHideCheckbox').hide();
$('#showHideCheckboxs').hide();
$("#filterButton").click(function(){
$('#showHideCheckbox').toggle();
$('#showHideCheckboxs').toggle();
});
</script>

View File

@ -27,7 +27,7 @@
<form method="post" action="{{ route("events.store") }}" enctype="multipart/form-data">
@csrf
<label for="name">Aktivitet Navn:</label>
<label hidden id="error" for="errormesseages">Dette Aktivitet navn findes allerede</label>
<label hidden id="error" for="errormesseages">Dette navn findes allerede</label>
<input type="text" name="name" id="name" max="60" required>
<label for="accountable">Aktivitet Ansvarlig:</label>
<input type="text" name="accountable" id="accountable" required>

View File

@ -15,7 +15,7 @@
<form method="post" action="{{ route("events.store") }}">
@csrf
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg på Navn, Dato"></input>
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg på Navn, Ansvarlig, Dato"></input>
</form>
</div>

View File

@ -17,10 +17,10 @@
@csrf
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg efter navn,email,tlf"><br>
</form>
<button id="filterButton" type="button" class="btn btn-sde-blue">Søg filter</button>
<button id="filterButton" type="button" class="btn btn-sde-blue mb-0">Filter</button>
</div>
<div id="showHideCheckbox">
<div id="showHideCheckbox" class="mt-1 ">
<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">
@ -32,6 +32,8 @@
<input class="checkbox-inline" type="checkbox" id="rolle" name="checkbox"value="rolle">
<label for="rolle">Rolle</label>
</div>
<div id="showHideCheckboxs" style="margin-bottom: -38px">
</div>
<table class="tbl mt-2">
<tr>
@ -96,9 +98,10 @@
<script>
$(document).ready(function(){
var $box;
$("input:checkbox").on('click', function() {
var $box = $(this);
$box = $(this);
if ($box.is(":checked")) {
var group = "input:checkbox[name='" + $box.attr("name") + "']";
$(group).prop("checked", false);
@ -107,16 +110,18 @@
$box.prop("checked", false);
}
});
});
//Show hide search filter
$('#showHideCheckbox').hide();
$('#showHideCheckboxs').hide();
$("#filterButton").click(function(){
$('#showHideCheckbox').toggle();
$('#showHideCheckboxs').toggle();
});
</script>

View File

@ -12,6 +12,14 @@
@section("content")
<div class="row align-items-center">
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('washing-machines.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Vaskemaskine</a>
<div class="mt-1 ml-1">
<select name="risRosName" id="locationID">
<option selected="selected" name="all" value="all">Alle</option>
@foreach(\App\Location::query()->get() as $location)
<option value="{{$location->name}}">{{$location->name}}</option>
@endforeach
</select> <label>Vælg bygning</label>
</div>
</div>
<table class="tbl mt-2">
<tr>
@ -35,4 +43,21 @@
</tr>
@endforeach
</table>
<script>
$('#locationID').change(function () {
$value = $('#locationID').find(":selected").val();
// alert($value);
$.ajax({
type: 'get',
url: '{{route('locations.search')}}',
data: {'option':$value},
success:function (data) {
$('tbody').html(data);
},
error:function (data) {
console.log(data);
}
});
})
</script>
@endsection

View File

@ -1,7 +1,7 @@
<html style="padding: 0; margin: 0; width: 100%; height: 100%;" lang="">
<head style="padding: 0; margin: 0; width: 100%; height: 100%;">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Title</title>
<title>Menuplan_uge_{{$menuPlan->week}}</title>
</head>
<style>
@page { margin: 0; }

View File

@ -49,6 +49,7 @@ Route::get("/rolesapi", "RolesController@search")->name("roles.search");
Route::get("/userapi", "UserController@search")->name("users.search");
Route::get("/vaskeapi", "WashingReservationController@search")->name("washing-reservations.search");
Route::get("/risrosapi", "FeedbackController@search")->name("feedbacks.search");
Route::get("/locationapi", "LocationController@search")->name("locations.search");
//Cookies
Route::get("/languages", "UserController@setLanguages")->name("users.setLanguages");