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

This commit is contained in:
2020-08-20 14:59:22 +02:00
parent 4f9cf41656
commit 89276c5af1
10 changed files with 115 additions and 14 deletions
@@ -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);
}
}
}