Changeset e278ff8
- Timestamp:
- 01/06/23 19:28:09 (2 years ago)
- Branches:
- main
- Children:
- 497d129
- Parents:
- 154b74c
- Location:
- FullyStocked/src/main
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
FullyStocked/src/main/java/com/bazi/fullystocked/Controller/WorkerController.java
r154b74c re278ff8 1 1 package com.bazi.fullystocked.Controller; 2 2 3 import com.bazi.fullystocked.Models.SqlViews.ArticlesReport; 4 import com.bazi.fullystocked.Models.StoredArticles; 5 import com.bazi.fullystocked.Models.User; 3 6 import com.bazi.fullystocked.Models.Workers; 7 import com.bazi.fullystocked.Services.StoredArticlesService; 4 8 import org.springframework.stereotype.Controller; 5 9 import org.springframework.ui.Model; 6 10 import org.springframework.web.bind.annotation.GetMapping; 11 import org.springframework.web.bind.annotation.PathVariable; 7 12 import org.springframework.web.bind.annotation.RequestMapping; 8 13 9 14 import javax.servlet.http.HttpServletRequest; 15 import java.util.List; 16 import java.util.Optional; 10 17 11 18 @Controller 12 19 @RequestMapping(value ="/worker") 13 20 public class WorkerController { 21 private final StoredArticlesService storedArticlesService; 22 23 public WorkerController(StoredArticlesService storedArticlesService) { 24 this.storedArticlesService = storedArticlesService; 25 } 26 14 27 @GetMapping 15 28 public String getWorkerPage() … … 18 31 return "homeWorker"; 19 32 } 33 @GetMapping("/articles") 34 public String getArticles(HttpServletRequest request, Model model) 35 { 36 Workers u= (Workers) request.getSession().getAttribute("user"); 37 List<ArticlesReport> articlesReport=storedArticlesService.findByLocation(u.getLocation().getLocationid()); 38 model.addAttribute("articles",articlesReport); 39 return "articles"; 40 } 41 @GetMapping("/articles/details/{id}") 42 public String getDetails(@PathVariable Integer id,Model model) 43 { 44 if(this.storedArticlesService.findById(id).isPresent()) 45 { 46 ArticlesReport articlesReport=this.storedArticlesService.findById(id).get(); 47 model.addAttribute("article",articlesReport); 48 return "detailsArticle"; 49 } 50 return "redirect:/articles?error=ArticleNotFound"; 51 } 20 52 } -
FullyStocked/src/main/java/com/bazi/fullystocked/Models/SqlViews/ArticlesReport.java
r154b74c re278ff8 20 20 private String locationname; 21 21 private Integer locationid; 22 23 public Integer getSarticleid() { 24 return sarticleid; 25 } 26 27 public Integer getArticleid() { 28 return articleid; 29 } 30 31 public String getArticlename() { 32 return articlename; 33 } 34 35 public String getDescription() { 36 return description; 37 } 38 39 public String getImageurl() { 40 return imageurl; 41 } 42 43 public int getQuantity() { 44 return quantity; 45 } 46 47 public String getLocationname() { 48 return locationname; 49 } 50 51 public Integer getLocationid() { 52 return locationid; 53 } 22 54 } -
FullyStocked/src/main/java/com/bazi/fullystocked/Services/Implementations/StoredArticlesServiceImpl.java
r154b74c re278ff8 62 62 return articlesReportRepository.findAllByLocationid(locationId); 63 63 } 64 public Optional<ArticlesReport> findById(Integer id) 65 { 66 return articlesReportRepository.findById(id); 67 } 64 68 } -
FullyStocked/src/main/java/com/bazi/fullystocked/Services/StoredArticlesService.java
r154b74c re278ff8 12 12 Optional<StoredArticles> updateFromOrder(Integer oarticleid); 13 13 List<ArticlesReport> findByLocation(Integer locationId); 14 Optional<ArticlesReport> findById(Integer id); 15 14 16 } -
FullyStocked/src/main/resources/templates/homeManager.html
r154b74c re278ff8 11 11 <nav class="navbar navbar-expand-md navbar-dark bg-dark"> 12 12 <div class="container"> 13 <a class="navbar-brand" href="/ ">FULLYSTOCKED</a>13 <a class="navbar-brand" href="/homeManager">FULLYSTOCKED</a> 14 14 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" 15 15 aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> -
FullyStocked/src/main/resources/templates/homeSupplier.html
r154b74c re278ff8 11 11 <nav class="navbar navbar-expand-md navbar-dark bg-dark"> 12 12 <div class="container"> 13 <a class="navbar-brand" href="/ ">FULLYSTOCKED</a>13 <a class="navbar-brand" href="/homeSupplier">FULLYSTOCKED</a> 14 14 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" 15 15 aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> -
FullyStocked/src/main/resources/templates/homeWorker.html
r154b74c re278ff8 11 11 <nav class="navbar navbar-expand-md navbar-dark bg-dark"> 12 12 <div class="container"> 13 <a class="navbar-brand" href="/ ">FULLYSTOCKED</a>13 <a class="navbar-brand" href="/homeWorker">FULLYSTOCKED</a> 14 14 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" 15 15 aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> … … 20 20 <ul class="navbar-nav m-auto"> 21 21 <li class="nav-item m-auto"> 22 <a class="nav-link active" href=" #">Преглед на магацинот</a>22 <a class="nav-link active" href="/worker/articles">Преглед на магацинот</a> 23 23 </li> 24 24 <li class="nav-item m-auto">
Note:
See TracChangeset
for help on using the changeset viewer.