Ignore:
Timestamp:
01/06/23 21:08:03 (23 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/java/com/example/autopartz
Files:
7 added
1 deleted
3 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}
Note: See TracChangeset for help on using the changeset viewer.