diff --git a/prototype/data/img/product-1.jpg b/prototype/data/img/product-1.jpg new file mode 100644 index 0000000..8ea7598 Binary files /dev/null and b/prototype/data/img/product-1.jpg differ diff --git a/prototype/data/img/product-2.jpg b/prototype/data/img/product-2.jpg new file mode 100644 index 0000000..427b2f0 Binary files /dev/null and b/prototype/data/img/product-2.jpg differ diff --git a/prototype/data/img/product-3.jpg b/prototype/data/img/product-3.jpg new file mode 100644 index 0000000..dbc1b2e Binary files /dev/null and b/prototype/data/img/product-3.jpg differ diff --git a/prototype/data/img/product-4.jpg b/prototype/data/img/product-4.jpg new file mode 100644 index 0000000..8f2d857 Binary files /dev/null and b/prototype/data/img/product-4.jpg differ diff --git a/prototype/data/img/product-5.jpg b/prototype/data/img/product-5.jpg new file mode 100644 index 0000000..5e0a406 Binary files /dev/null and b/prototype/data/img/product-5.jpg differ diff --git a/prototype/data/img/product-6.jpg b/prototype/data/img/product-6.jpg new file mode 100644 index 0000000..05d78c0 Binary files /dev/null and b/prototype/data/img/product-6.jpg differ diff --git a/prototype/data/img/product-7.jpg b/prototype/data/img/product-7.jpg new file mode 100644 index 0000000..220140c Binary files /dev/null and b/prototype/data/img/product-7.jpg differ diff --git a/prototype/data/img/product-8.jpg b/prototype/data/img/product-8.jpg new file mode 100644 index 0000000..cdb829d Binary files /dev/null and b/prototype/data/img/product-8.jpg differ diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/InternArticleController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/InternArticleController.java index c79cc6d..c1cfbbd 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/intern/InternArticleController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/InternArticleController.java @@ -13,8 +13,7 @@ import org.springframework.web.bind.annotation.*; @Controller @RequestMapping("intern/listedArticles") -public class InternArticleController -{ +public class InternArticleController { @Autowired private final ArticleRepository articleRepository = null; @@ -22,15 +21,13 @@ public class InternArticleController private final WarehouseBookingPositionSlotEntryRepository warehouseEntryRepository = null; @GetMapping("/") - public String internListedArticles(Model model) - { + public String internListedArticles(Model model) { List totals = new ArrayList(); for (Article article : articleRepository.findAll()) { ListedArticlesListTotals tmp = new ListedArticlesListTotals(); - tmp.addListedArticle(article, - warehouseEntryRepository.getArticleStock(article.id).orElse(0)); + tmp.addListedArticle(article, warehouseEntryRepository.getArticleStock(article.id).orElse(0)); totals.add(tmp); } @@ -39,13 +36,21 @@ public class InternArticleController } @GetMapping("/{id}") - public String internListedArticlesId() - { + public String internListedArticlesId(Model model, @PathVariable String id) { + + int articleid = Integer.parseInt(id); + + ListedArticlesListIdTotal total = new ListedArticlesListIdTotal(); + + total.addArticle(articleRepository.findArticleById(articleid), + warehouseEntryRepository.getArticleStock(articleid).orElse(0)); + + model.addAttribute("ArticleID", total); + return "intern/listedArticles/id"; } - public static class ListedArticlesListTotals - { + public static class ListedArticlesListTotals { public String imgPath; @@ -63,14 +68,11 @@ public class InternArticleController public long id; - void addListedArticle(Article article, int stock) - { + void addListedArticle(Article article, int stock) { this.imgPath = article.image.path; this.title = article.title; - this.price_netto = String.format("%.2f", - ((float) article.shopPricePerUnitNetCent / 100)); - this.price = String.format("%.2f", - ((float) article.getPriceGross() / 100)); + this.price_netto = String.format("%.2f", ((float) article.shopPricePerUnitNetCent / 100)); + this.price = String.format("%.2f", ((float) article.getPriceGross() / 100)); this.categorie = article.getCategories(); this.stock = stock; this.offer_id = article.related.id; @@ -78,4 +80,35 @@ public class InternArticleController } } + public static class ListedArticlesListIdTotal { + + public String imgPath; + public String title; + public String price; + public String price_netto; + public int reorderMaxPrice; + public String categorie; + public int stock; + public long offer_id; + public long id; + public boolean shouldReorder; + public int warehouseUnitsPerSlot; + public String description; + + void addArticle(Article article, int stock) { + this.imgPath = article.image.path; + this.title = article.title; + this.price_netto = String.format("%.2f", ((float) article.shopPricePerUnitNetCent / 100)); + this.price = String.format("%.2f", ((float) article.getPriceGross() / 100)); + this.categorie = article.getCategories(); + this.stock = stock; + this.offer_id = article.related.id; + this.id = article.id; + this.reorderMaxPrice = article.reorderMaxPrice; + this.shouldReorder = article.shouldReorder; + this.warehouseUnitsPerSlot = article.warehouseUnitsPerSlot; + this.description = article.description; + } + } + } diff --git a/prototype/src/main/resources/templates/intern/listedArticles/id.html b/prototype/src/main/resources/templates/intern/listedArticles/id.html index 20b64c3..7097249 100644 --- a/prototype/src/main/resources/templates/intern/listedArticles/id.html +++ b/prototype/src/main/resources/templates/intern/listedArticles/id.html @@ -5,7 +5,7 @@ - Gelistete Artikel + Bearbeiten: Artikel @@ -15,7 +15,7 @@