source: src/main/resources/templates/products.html

main
Last change on this file was d14176d, checked in by HristijanMitic00 <hristijan.mitic.01@…>, 12 months ago

First commit

  • Property mode set to 100644
File size: 3.7 KB
Line 
1<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="">
2 <section class="jumbotron text-center">
3 <div class="container">
4 <h1 class="jumbotron-heading">Food Market Online</h1>
5 <h3 class="jumbotron-heading">All products</h3>
6 </div>
7 </section>
8<!--//th:method="GET" th:action="@{/products}"-->
9 <div class="container mb-4" >
10 <div class="row">
11 <div class="col-12" th:if="${products.size() > 0}">
12 <div class="table-responsive">
13 <table class="table table-striped">
14 <thead>
15 <tr>
16 <th scope="col">Product name</th>
17 <th scope="col">Price</th>
18 <th scope="col">Category</th>
19
20 </tr>
21 </thead>
22 <tbody>
23 <tr th:each="product : ${products} " class="product">
24 <td th:text="${product.getIme()}" ></td>
25 <td th:each="price: ${prices}" th:if="${price.getIdProdukt()} == ${product.getIdProdukt()}"
26 th:text="${price.getIznos()}">Cena</td>
27 <td th:each="category: ${categories}" th:if="${category.getIdProdukt()} == ${product.getIdProdukt()}"
28 ><span th:each="k:${kat}" th:if="${k.getIdKategorija()} == ${category.getIdKategorija()}"
29 th:text="${k.getIme()}"></span></td>
30 <td class="text-right">
31 <th:block sec:authorize="hasRole('ROLE_ADMIN')">
32 <form th:action="@{'/products/delete/{id}' (id=${product.getIdProdukt()})}"
33 th:method="DELETE">
34 <button type="submit"
35 class="btn btn-sm btn-danger delete-product">
36 <i class="fa fa-trash">Delete</i>
37 </button>
38 </form>
39 </th:block>
40 <th:block sec:authorize="hasRole('ROLE_ADMIN')">
41 <a th:href="@{'/products/edit-form/{id}' (id=${product.getIdProdukt()})}"
42 class="btn btn-sm btn-info edit-product">
43 <i class="fa fa-trash">Edit</i>
44 </a>
45 </th:block>
46 <form th:method="GET" th:action="@{'/products/{id}' (id=${product.getIdProdukt()})}">
47 <button type="submit"
48 class="btn btn-sm btn-primary cart-product" sec:authorize="hasRole('ROLE_USER')">
49 <i class="fa fa-trash">Add product to cart</i>
50 </button>
51 </form>
52 </td>
53 </tr>
54 </tbody>
55 </table>
56 </div>
57 </div>
58 <div class="col mb-3">
59 <div class="row">
60 <div class="col-sm-12 col-md-12" sec:authorize="hasRole('ROLE_ADMIN')">
61 <a href="/products/add-form" class="btn btn-block btn-dark add-product-btn">
62 Add new product
63 </a>
64 </div>
65 </div>
66 </div>
67 </div>
68 </div>
69</div>
Note: See TracBrowser for help on using the repository browser.