Browse Source

first iteration of search functionality - likely to fail hard

master
jk 3 years ago
parent
commit
e9d9d069ba
  1. 3
      app/Http/Controllers/SearchController.php
  2. 70
      resources/views/search/results.blade.php

3
app/Http/Controllers/SearchController.php

@ -83,6 +83,7 @@ class SearchController extends Controller
default:
$msg = "You fucked up somehow!";
}
return view('search.results')->with('results',$results);
$data = array('results'=>$results, 'table'=>$table);
return view('search.results')->with($data);
}
}

70
resources/views/search/results.blade.php

@ -7,29 +7,55 @@
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> {{ __('Search Results') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>
<div class="card-body">
<table class="table table-striped table-dark" id="table-programs">
<!-- This piece of code is for error messages display purposes -->
@include('inc.messages')
<thead>
<tr>
<th scope="col">@sortablelink('name')</th>
<th scope="col">@sortablelink('brewery')</th>
<th scope="col" class="hideable">@sortablelink('type', 'Style')</th>
</tr>
</thead>
<tbody>
@foreach ($results as $result)
<tr>
<td><a href="/beer/{{$result->beer_id}}">{{$result->name}}</a> </td>
<td><a href="/brewery/{{$result->brewery_id}}">{{$result->brewery}}</a> </td>
<td class="hideable">{{$result->type}} </td>
</tr>
@endforeach
</tbody>
</table>
@if ($table == "summarie")
<div role="tabpanel">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#home1" aria-controls="home" role="tab" data-toggle="tab">Overview</a>
</li>
<li role="presentation" class="active">
<a href="#home2" aria-controls="home" role="tab" data-toggle="tab">Stats</a>
</li>
<li role="presentation" class="active">
<a href="#home3" aria-controls="home" role="tab" data-toggle="tab">Ingredients</a>
</li>
<li role="presentation" class="active">
<a href="#home4" aria-controls="home" role="tab" data-toggle="tab">Mash & Boil</a>
</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home1">
<ul>
<li>
<table class="table table-striped table-dark" id="table-programs">
<!-- This piece of code is for error messages display purposes -->
@include('inc.messages')
<thead>
<tr>
<th scope="col">@sortablelink('name', 'Beer')</th>
<th scope="col">Brewery</th>
<th scope="col" class="hideable">@sortablelink('type', 'Style')</th>
</tr>
</thead>
<tbody>
@foreach ($results as $result)
<tr>
<td><a href="/beer/{{$result->beer_id}}">{{$result->name}}</a> </td>
<td><a href="/brewery/{{$result->brewery_id}}">{{$result->brewery}}</a> </td>
<td class="hideable">{{$result->type}} </td>
</tr>
@endforeach
</tbody>
</table>
</li>
</ul>
</div>
<div role="tabpanel" class="tab-pane" id="home2"></div>
<div role="tabpanel" class="tab-pane" id="home3"></div>
<div role="tabpanel" class="tab-pane" id="home4"></div>
</div>
@endif
</div>
</div>
</div>

Loading…
Cancel
Save