Changeset 37966cf


Ignore:
Timestamp:
01/07/23 12:24:12 (18 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
84652fb
Parents:
ed7ef92
Message:

Filtered parts fixed

Location:
src/main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/autopartz/controller/HomeController.java

    red7ef92 r37966cf  
    129129            model.addAttribute("filtered", tmp);
    130130        }
     131        model.addAttribute("selectedCar","Previously selected : "+cartype);
     132        model.addAttribute("selectedCategory","Previously selected : " + category);
     133        model.addAttribute("cars",carService.findAll());
     134        model.addAttribute("categories",categoryService.findAll());
    131135        model.addAttribute("bodyContent","filteredParts");
    132136        return "master-template";
  • src/main/resources/templates/filteredParts.html

    red7ef92 r37966cf  
    22<h1 class="mt-3 mb-3">Резултат од филтерот</h1>
    33<a th:href="${'/products'}">Врати се на сите производи</a>
     4<form th:action="@{/filtered}">
     5    <label for="cartype"></label><select id="cartype" class="form-control w-25 d-inline mr-3" required name="cartype">
     6    <option value="" disabled selected th:text="${selectedCar}"></option>
     7    <option  th:each="car : ${cars}"
     8             th:text="${car.getCartype()}"
     9             th:value="${car.getCartype()}">
     10    </option>
     11</select>
     12    <label for="category"></label><select id="category" class="form-control w-25 d-inline mr-3" required name="category">
     13    <option value="" disabled selected th:text="${selectedCategory}"></option>
     14    <option  th:each="cat : ${categories}"
     15             th:text="${cat.getCname()}"
     16             th:value="${cat.getCname()}">
     17    </option>
     18</select>
     19    <button class="btn btn-lg btn-block btn-primary w-25 d-inline" type="submit">Филтрирај</button>
     20</form>
    421    <h3 th:if="${hasError}" th:text="${error}"></h3>
    522    <div th:if="${!hasError}">
Note: See TracChangeset for help on using the changeset viewer.