Changeset cab5859


Ignore:
Timestamp:
01/06/23 21:08:03 (18 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
89865ae
Parents:
9dcbf44
Message:

Added all advanced reports, added bootstrap for every template

Location:
src/main
Files:
11 added
1 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/autopartz/config/WebSecurityConfig.java

    r9dcbf44 rcab5859  
    2828        http.csrf().disable()
    2929                .authorizeRequests()
    30                 .antMatchers("/", "/products", "/services", "/filtered", "/login", "/register","/registerWarehouseman","/finishRegister","/test/*","/access_denied").permitAll()
     30                .antMatchers("/", "/products", "/services", "/filtered", "/login", "/register","/registerWarehouseman","/finishRegister","/test/*","/access_denied","/carCategoryReport","/partManufacturersReport","/mostPurchasedPart").permitAll()
    3131                .antMatchers("/orders","/repairs","/reviews","/part/*","/currentOrder","/addCarSampleForUser","/repairs/addReview/*").hasRole("CLIENT")
    3232                .antMatchers("/viewUsers","/approve/*").hasRole("ADMIN")
  • src/main/java/com/example/autopartz/controller/AdminController.java

    r9dcbf44 rcab5859  
    3737    public String getAllUsers(Model model){
    3838        List<User> pendingList = userService.findAllUsers().stream().filter(u->u.getAuthorities().contains(Role.ROLE_PENDING_DELIVERYMAN) || u.getAuthorities().contains(Role.ROLE_PENDING_WAREHOUSEMAN)).toList();
    39         model.addAttribute("users", pendingList);
     39        if(pendingList.size()==0){
     40            model.addAttribute("hasError",true);
     41        }
     42        else {
     43            model.addAttribute("hasError",false);
     44            model.addAttribute("users", pendingList);
     45        }
    4046        model.addAttribute("bodyContent", "viewUsers");
    4147        return "master-template";
  • src/main/java/com/example/autopartz/controller/HomeController.java

    r9dcbf44 rcab5859  
    3737    private final DeliveryService deliveryService;
    3838    private final PartIsInStockInWarehouseRepository partIsInStockInWarehouseRepository;
     39    private final CarCategoryReportRepository carCategoryReportRepository;
     40    private final PartManufacturersReportRepository partManufacturersReportRepository;
     41    private final MostPurchasedPartRepository mostPurchasedPartRepository;
    3942    public HomeController(LoginService loginService, PartService partService, PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository, CarService carService, CategoryService categoryService, RepairShopReviewSummaryRepository repairShopReviewSummaryRepository, WarehouseRepository warehouseRepository,
    40                           OrderContainsPartRepository orderContainsPartRepository, OrderService orderService, UserService userService, DeliveriesInProgressRepository deliveriesInProgressRepository, DeliveryService deliveryService, PartIsInStockInWarehouseRepository partIsInStockInWarehouseRepository) {
     43                          OrderContainsPartRepository orderContainsPartRepository, OrderService orderService, UserService userService, DeliveriesInProgressRepository deliveriesInProgressRepository, DeliveryService deliveryService, PartIsInStockInWarehouseRepository partIsInStockInWarehouseRepository, CarCategoryReportRepository carCategoryReportRepository, PartManufacturersReportRepository partManufacturersReportRepository, MostPurchasedPartRepository mostPurchasedPartRepository) {
    4144        this.loginService = loginService;
    4245        this.partService = partService;
     
    5255        this.deliveryService = deliveryService;
    5356        this.partIsInStockInWarehouseRepository = partIsInStockInWarehouseRepository;
     57        this.carCategoryReportRepository = carCategoryReportRepository;
     58        this.partManufacturersReportRepository = partManufacturersReportRepository;
     59        this.mostPurchasedPartRepository = mostPurchasedPartRepository;
    5460    }
    5561
     
    231237        return "master-template";
    232238    }
     239    @GetMapping("/carCategoryReport")
     240    public String getCarCategoryInfo(Model model){
     241        model.addAttribute("data",carCategoryReportRepository.findAll());
     242        model.addAttribute("bodyContent","carCategoryReport");
     243        return "master-template";
     244    }
     245    @GetMapping("/partManufacturersReport")
     246    public String getPartManufacturersReport(Model model){
     247        model.addAttribute("data",partManufacturersReportRepository.findAll());
     248        model.addAttribute("bodyContent","partManufacturersReport");
     249        return "master-template";
     250
     251    }
     252    @GetMapping("/mostPurchasedPart")
     253    public String getMostPurchasedPart(Model model){
     254        model.addAttribute("data",mostPurchasedPartRepository.findAll());
     255        model.addAttribute("bodyContent","mostPurchasedPart");
     256        return "master-template";
     257    }
    233258}
  • src/main/resources/templates/addReviewPage.html

    r9dcbf44 rcab5859  
    11<div>
    22    <div>
    3 
    43        <form class="form-signin mt-xl-5" method="post" th:action="@{'/repairs/addReview/{id}' (id=${repair.getId()}) }">
    54            <h2 class="form-signin-heading">Додај критика</h2>
  • src/main/resources/templates/chooseRepairShop.html

    r9dcbf44 rcab5859  
    22  <h1 th:if="${hasError}" th:text="${error}"></h1>
    33  <div th:if="${!hasError}">
    4   <h3>Достава до овластен сервис</h3>
     4  <h3 class="mt-3 mb-3">Достава до овластен сервис</h3>
    55  <form class="form-signin mt-xl-5" method="post" action="/part/chooseRepairShop">
    66    <p>
  • src/main/resources/templates/currentOrder.html

    r9dcbf44 rcab5859  
    22    <h1 th:if="${hasError}" th:text="${error}"></h1>
    33    <div th:if="${!hasError}">
    4         <h3 th:text="${order.getUser().getUsername()}"></h3>
    5         <table>
    6             <thead>
     4        <h3 class="mt-3 mb-3">
     5            Нарачка за корисник : <span th:text="${order.getUser().getUsername()}"></span>
     6        </h3>
     7        <table class="table table-bordered">
     8            <thead class="thead-dark">
    79            <tr>
    810                <th>Name</th>
  • src/main/resources/templates/fragments/header.html

    r9dcbf44 rcab5859  
    1010      <div class="collapse navbar-collapse justify-content-end" id="navbarsExampleDefault">
    1111        <ul class="navbar-nav m-auto">
    12           <li class="nav-item m-auto">
    13             <a class="nav-link active" href="/products">Продукти</a>
    14           </li>
    15           <li class="nav-item m-auto">
    16             <a class="nav-link active" href="/services">Сервиси</a>
    17           </li>
    1812          <th:block sec:authorize="hasAuthority('ROLE_CLIENT')">
    1913          <li class="nav-item m-auto">
    2014            <a class="nav-link active" href="/currentOrder">Моја нарачка</a>
    2115          </li>
     16          </th:block>
     17          <th:block sec:authorize="hasAuthority('ROLE_CLIENT')">
     18            <li class="nav-item m-auto">
     19              <a class="nav-link active" href="/orders">Мои нарачки</a>
     20            </li>
     21          </th:block>
     22          <th:block sec:authorize="hasAuthority('ROLE_CLIENT')">
     23            <li class="nav-item m-auto">
     24              <a class="nav-link active" href="/repairs">Мои поправки</a>
     25            </li>
     26          </th:block>
     27          <th:block sec:authorize="hasAuthority('ROLE_CLIENT')">
     28            <li class="nav-item m-auto">
     29              <a class="nav-link active" href="/reviews">Мои критики</a>
     30            </li>
    2231          </th:block>
    2332          <th:block sec:authorize="hasAuthority('ROLE_CLIENT')">
     
    4655          <th:block th:if="${#request.getRemoteUser() != null}">
    4756          <li class="nav-item">
    48             <a class="btn btn-success btn-sm ml-3" href="/register">
     57            <a class="btn btn-success btn-sm ml-3" href="/">
    4958              <th:block th:text="${#request.getRemoteUser()}"></th:block>
    5059            </a>
  • src/main/resources/templates/home.html

    r9dcbf44 rcab5859  
    11<div>
    2   Почетна страница
     2  <h1>Авто делови AutoPartz.MK - онлајн продавница</h1>
     3  <div class="d-flex">
     4  <div class="d-flex flex-column justify-content-center align-items-center">
     5    <h2>Се за вашиот автомобил</h2>
     6    <h4 class="text-center">Избор од голем број на производители</h4>
     7  </div>
     8  <div class="ml-5">
     9    <img class="img-fluid" src="https://c4.wallpaperflare.com/wallpaper/1022/57/149/sports-car-ferrari-photo-manipulation-engines-wallpaper-preview.jpg" alt="Image">
     10  </div>
    311</div>
     12  <form class="form-signin mt-xl-5" method="get" action="/products">
     13      <button class="btn btn-danger btn-block btn-lg" type="submit">Пребарувај производи</button>
     14  </form>
     15
     16</div>
  • src/main/resources/templates/master-template.html

    r9dcbf44 rcab5859  
    1010  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
    1111</head>
    12 <body>
     12<body class="bg-light">
    1313<header th:replace="fragments/header"></header>
    1414
     
    1616
    1717</section>
     18
     19<footer th:replace="fragments/footer"></footer>
    1820</body>
    1921</html>
  • src/main/resources/templates/myDeliveries.html

    r9dcbf44 rcab5859  
    11<div>
    2     <h1>Мои достави</h1>
     2    <h1 class="mt-3 mb-3">Мои достави</h1>
    33    <form class="form-signin mt-xl-5" method="get" action="/myNextDeliveries">
    4     <button id="submit" class="btn btn-lg btn-primary btn-block" type="submit">Мои следни нарачки</button>
     4    <button id="submit" class="btn btn-lg btn-primary btn-block w-50" type="submit">Мои следни нарачки</button>
    55    </form>
    6     <table>
    7         <thead>
     6    <table class="table table-bordered mt-3">
     7        <thead class="thead-dark">
    88        <tr>
    9             <th>Статус на достава</th>
    10             <th>Адреса на достава</th>
    11             <th>Број на нарачка</th>
    12             <th>Датум на нарачка</th>
     9            <th scope="col">Статус на достава</th>
     10            <th scope="col">Адреса на достава</th>
     11            <th scope="col">Број на нарачка</th>
     12            <th scope="col">Датум на нарачка</th>
    1313        </tr>
    1414        </thead>
  • src/main/resources/templates/myNextDeliveries.html

    r9dcbf44 rcab5859  
    11<div>
    2   <h1>Мои следни нарачки</h1>
     2  <h1 class="mb-3 mt-3">Мои следни нарачки</h1>
    33  <h1 th:if="${hasError}" th:text="${error}"></h1>
    44  <div th:if="${!hasError}">
    5   <table>
    6     <thead>
     5  <table class="table table-bordered">
     6    <thead class="thead-dark">
    77    <tr>
    88      <th>Статус на достава</th>
  • src/main/resources/templates/myWarehouse.html

    r9dcbf44 rcab5859  
    11<div>
    2     <h1>Мој магацин</h1>
    3     <table>
    4         <thead>
     2    <h1 class="mt-3 mb-3">Мој магацин</h1>
     3    <table class="table table-bordered">
     4        <thead class="thead-dark">
    55        <tr>
    66            <th>Магацин</th>
  • src/main/resources/templates/orderInfo.html

    r9dcbf44 rcab5859  
    11<div>
    2   <h1>Нарачка број <span th:text="${o.getOrderid()}"></span></h1>
    3   <table>
    4     <thead>
     2  <h1 class="mt-3 mb-3">Нарачка број <span th:text="${o.getOrderid()}"></span></h1>
     3  <table class="table table-bordered">
     4    <thead class="thead-dark">
    55    <tr>
    66      <th>Име на делот</th>
  • src/main/resources/templates/ordersForUser.html

    r9dcbf44 rcab5859  
    11<div>
    2 <h1>Мои нарачки</h1>
    3 <table>
    4   <thead>
     2<h1 class="mt-3 mb-3">Мои нарачки</h1>
     3<table class="table table-bordered">
     4  <thead class="thead-dark">
    55  <tr>
    66    <th>Датум на нарачка</th>
  • src/main/resources/templates/partinfo.html

    r9dcbf44 rcab5859  
    11<div>
    2     <table class="table table-bordered mt-4">
     2    <h1 class="mt-3 mb-3">Детали за делот</h1>
     3    <a href="/products">Назад кон сите продукти</a>
     4    <table class="table table-bordered mt-3">
    35        <thead class="thead-dark">
    46        <tr>
  • src/main/resources/templates/products.html

    r9dcbf44 rcab5859  
    11<div xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
    22>
    3 <header>
    4     <th:block sec:authorize="hasAuthority('ROLE_CLIENT')">
    5     <a th:href="${'/orders'}">Мои нарачки</a>
    6     <a th:href="${'/repairs'}">Мои поправки</a>
    7     <a th:href="${'/reviews'}">Мои критики</a>
    8     </th:block>
    9 </header>
    103<main>
    114    <h1 class="mt-3 mb-3">Сите производи</h1>
  • src/main/resources/templates/repairsForUser.html

    r9dcbf44 rcab5859  
    11<div>
    2 <h1>Мои поправки</h1>
    3 <table>
    4   <thead>
     2<h1 class="mt-3 mb-3">Мои поправки</h1>
     3<table class="table table-bordered">
     4  <thead class="thead-dark">
    55  <tr>
    66    <th>Број на поправка</th>
  • src/main/resources/templates/reviewsForUser.html

    r9dcbf44 rcab5859  
    11<div>
    2 <h1>Мои критики</h1>
    3 <table>
    4   <thead>
     2<h1 class="mt-3 mb-3">Мои критики</h1>
     3<table class="table table-bordered">
     4  <thead class="thead-dark">
    55  <tr>
    66    <th>Оценка</th>
  • src/main/resources/templates/selectWarehouse.html

    r9dcbf44 rcab5859  
    11<div>
     2  <h1 class="mt-3 mb-3">Одбери овластен сервис</h1>
    23  <form class="form-signin mt-xl-5" method="post" action="/finishRegister">
    34    <label for="location"></label><select class="form-control" id="location" required name="location">
  • src/main/resources/templates/viewUsers.html

    r9dcbf44 rcab5859  
    11<div>
    2   <table>
    3     <thead>
     2  <div th:if="${hasError}">
     3    <h1>Нема корисници за одобрување</h1>
     4  </div>
     5  <div th:if="${!hasError}">
     6  <h1 class="mt-3 mb-3">Корисници за одобрување</h1>
     7  <table class="table table-bordered">
     8    <thead class="thead-dark">
    49    <tr>
    5       <th>Name</th>
    6       <th>Username</th>
    7       <th>Role</th>
    8       <th>Approve</th>
     10      <th>Име</th>
     11      <th>Корисничко име</th>
     12      <th>Улога</th>
     13      <th>Одобри</th>
    914    </tr>
    1015    </thead>
     
    1621      <td>
    1722        <form method="post" th:action="@{'/approve/{id}' (id=${user.getId()}) }">
    18           <button type="submit">Approve</button>
     23          <button type="submit">Одобри</button>
    1924        </form>
    2025      </td>
     
    2227    </tbody>
    2328  </table>
     29  </div>
    2430</div>
Note: See TracChangeset for help on using the changeset viewer.