11<!DOCTYPE html>
22< html lang ="en " xmlns:th ="http://www.thymeleaf.org ">
33< head >
4+ < link rel ='stylesheet ' href ='/webjars/bootstrap/css/bootstrap.min.css '>
5+
46 < meta charset ="UTF-8 ">
57 < title > Restaurants</ title >
68</ head >
7- < body >
8- < h1 > Restaurants</ h1 >
9+ < body class ="container ">
10+
11+ < div th:replace ="fragments/header :: header (title='Restaurants') "> </ div >
912
13+ < br >
1014< form th:action ="@{/search} ">
11- Search by:
12- < select id ="field " name ="field ">
13- < option th:selected ="${field == 'name'} " value ="name "> Name</ option >
14- < option th:selected ="${field == 'cuisine'} " value ="cuisine "> Cuisine</ option >
15- < option th:selected ="${field == 'delivery-fee'} " value ="delivery-fee "> Delivery Fee</ option >
16- </ select >
17- < input placeholder ="Your search query " th:name ="query " th:value ="${query} " type ="text "/>
18- < input type ="submit " value ="Search ">
15+ < div class ="card mb-auto ">
16+ < div class ="card-header ">
17+ < h4 > Filter Restaurants</ h4 >
18+ </ div >
19+ < div class ="card-body ">
20+ < div class ="form-group row ">
21+ < label for ="field " class ="col-sm-4 col-form-label "> Search by</ label >
22+ < select class ="form-control col-sm-8 " id ="field " name ="field ">
23+ < option th:selected ="${field == 'name'} " value ="name "> Name</ option >
24+ < option th:selected ="${field == 'cuisine'} " value ="cuisine "> Cuisine</ option >
25+ < option th:selected ="${field == 'delivery-fee'} " value ="delivery-fee "> Delivery Fee</ option >
26+ </ select >
27+ </ div >
28+ < div class ="form-group row ">
29+ < label for ="query " class ="col col-sm-4 "> Your search query</ label >
30+ < input id ="query " class ="form-control col-sm-8 " placeholder ="<empty> " th:name ="query " th:value ="${query} " type ="text "/>
31+ </ div >
32+ < div class ="form-group row ">
33+ < div class ="col col-sm-4 "> </ div >
34+ < input class ="btn btn-primary col col-sm-8 " type ="submit " value ="Submit ">
35+ </ div >
36+ </ div >
37+ </ div >
1938</ form >
2039
2140< br > < br >
2241
23- < table >
42+ < table class =" table table-striped table-bordered " >
2443 < thead >
25- < tr bgcolor =" #d3d3d3 " >
26- < td > Name</ td >
27- < td > Address</ td >
28- < td > Delivery Fee</ td >
29- < td > Cuisine</ td >
44+ < tr >
45+ < th > Name</ th >
46+ < th > Address</ th >
47+ < th > Delivery Fee</ th >
48+ < th > Cuisine</ th >
3049 </ tr >
3150 </ thead >
3251 < tr th:each ="restaurant : ${restaurants} ">
33- < td style ="cursor: pointer; background-color: aquamarine "
34- th:onclick ="'window.location.href=\'/restaurants/' + ${restaurant.getId()} + '\'' "
35- th:text ="${restaurant.getName()} "> </ td >
52+ < td >
53+ < button
54+ class ="btn btn-primary "
55+ th:text ="${restaurant.getName()} "
56+ th:onclick ="'window.location.href=\'/restaurants/' + ${restaurant.getId()} + '\'' "> </ button > </ td >
3657 < td th:text ="${restaurant.getAddress()} "> </ td >
3758 < td th:text ="${restaurant.getDeliveryFee()} "> </ td >
3859 < td th:text ="${restaurant.getCuisine().getName()} "> </ td >
@@ -42,5 +63,7 @@ <h1>Restaurants</h1>
4263 </ tbody >
4364</ table >
4465
66+ < script src ="/webjars/jquery/jquery.min.js "> </ script >
67+ < script src ="/webjars/bootstrap/js/bootstrap.min.js "> </ script >
4568</ body >
46- </ html >
69+ </ html >
0 commit comments