GET article edit page
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 8.7 KiB |
|
@ -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<ListedArticlesListTotals> totals = new ArrayList<ListedArticlesListTotals>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.75, user-scalable=no">
|
||||
|
||||
<title>Gelistete Artikel</title>
|
||||
<title>Bearbeiten: Artikel</title>
|
||||
<script th:src="@{/js/filterTable.js}"></script>
|
||||
<link rel="stylesheet" th:href="@{/css/ecom.css}"/>
|
||||
</head>
|
||||
|
@ -15,7 +15,7 @@
|
|||
<div class="sidebar-layout content-width">
|
||||
<nav></nav>
|
||||
<div>
|
||||
<h1>Gelisteter Artikel 8450</h1>
|
||||
<h1>Artikel bearbeiten</h1>
|
||||
|
||||
<script th:src="@{/js/back.js}"></script>
|
||||
<div class="back" data-group="intern" data-insert="true"></div>
|
||||
|
@ -24,16 +24,16 @@
|
|||
<main class="sidebar-layout content-width">
|
||||
<nav th:replace="fragments/intern :: sidebar"></nav>
|
||||
<div class="content-width">
|
||||
<h2>Gelisteter Artikel 8450</h2>
|
||||
<h2>Gelisteter Artikel ID <span th:text="${ArticleID.id}"></span></h2>
|
||||
<form class="detailgrid">
|
||||
<p class="m">
|
||||
<label for="title">Titel</label>
|
||||
<input class=" full-width" type="text" name="title" value="Kamera"/>
|
||||
<input class=" full-width" type="text" name="title" th:value="${ArticleID.title}"/>
|
||||
</p>
|
||||
<p class="s">
|
||||
<label for="ref-article">Refernzierter Artikel</label>
|
||||
<input class="" type="text" name="ref-article" value="8405" disabled/>
|
||||
<td><a th:href="@{/intern/articles/#q=%2044048}">Details</a></td>
|
||||
<input class="" type="text" name="ref-article" th:value="${ArticleID.offer_id}" disabled/>
|
||||
<td><a th:href="@{/intern/articles/{id}(id = ${ArticleID.offer_id})}">Details</a></td>
|
||||
</p>
|
||||
<div class="spacer"></div>
|
||||
<div class="m">
|
||||
|
@ -42,26 +42,26 @@
|
|||
<input class="full-width" type="file" name="img"/>
|
||||
</p>
|
||||
<p>
|
||||
<img th:src="@{/img/product-1.jpg}" class="m"/>
|
||||
<img th:src="@{/shop/articles/{id}/image.jpg(id=${ArticleID.id})}" class="m"/>
|
||||
</p>
|
||||
</div>
|
||||
<div class="s">
|
||||
<p>
|
||||
<label for="price">Preis (Netto)</label>
|
||||
<input class="" type="number" step="0.01" name="price" value="84.45"/> EUR <br/>
|
||||
<input class="" type="number" step="0.01" name="price" th:value="${ArticleID.price_netto}"/> EUR <br/>
|
||||
(19% Mwst.)
|
||||
<!-- Info von article ref--> <br/>
|
||||
= 105.98 EUR Brutto
|
||||
= <span th:text="${ArticleID.price}"></span> EUR Brutto
|
||||
</p>
|
||||
<p>
|
||||
<label for="max-price-buy">Maximaler Einkaufspreis (Netto)</label>
|
||||
<input class="" type="number" step="0.01" name="price" value="80.98"/> EUR
|
||||
<input class="" type="number" step="0.01" name="price" th:value="${ArticleID.reorderMaxPrice}"/> EUR
|
||||
</p>
|
||||
<div>
|
||||
<fieldset>
|
||||
<input type="radio" name="autobuy" value="true" id="autobuy-yes" checked required>
|
||||
<input type="radio" name="autobuy" value="true" id="autobuy-yes" th:checked="${ArticleID.shouldReorder}" required>
|
||||
<label for="autobuy-yes"> Automatisch nachbestellen.</label> <br/>
|
||||
<input type="radio" name="autobuy" value="false" id="autobuy-no" required>
|
||||
<input type="radio" name="autobuy" value="false" id="autobuy-no" th:checked="${!ArticleID.shouldReorder}" required>
|
||||
<label for="autobuy-no"> Nicht mehr nachkaufen.</label> <br/>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
@ -72,19 +72,18 @@
|
|||
<p>
|
||||
Bitte jede Kategorien in eine eigene Zeile
|
||||
</p>
|
||||
<textarea name="tags" class="full-width" rows="6">
|
||||
Überwachung
|
||||
Elektronik
|
||||
<textarea name="tags" class="full-width" rows="6"th:inline="text">[[${ArticleID.categorie}]]
|
||||
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<div class="s">
|
||||
<p>
|
||||
<label for="price">Einheiten pro Lagerplatz</label>
|
||||
<input class="" type="number" name="units-per-slot" value="20"/>
|
||||
<input class="" type="number" name="units-per-slot" th:value="${ArticleID.warehouseUnitsPerSlot}"/>
|
||||
</p>
|
||||
<p>
|
||||
<b>Lagerbestand: 12</b>
|
||||
<b>Lagerbestand: <span th:text="${ArticleID.stock}"></span></b>
|
||||
</p>
|
||||
<p>
|
||||
Der Wert wird nur für zukünftige Lagerbuchungen verwendet.
|
||||
|
@ -99,11 +98,7 @@ Elektronik
|
|||
|
||||
<p class="l">
|
||||
<label for="description">Beschreibung</label>
|
||||
<textarea name="description" class="full-width" rows="15">
|
||||
Eine TOLLE Kamera
|
||||
Jaja du denkst jetzt bestimmt: "Bei dem Preis kann sie gar nich sooo TOLL sein".
|
||||
Aber glaub mir, sie is echt echt TOLL!
|
||||
Indianerehrenwort!
|
||||
<textarea name="description" class="full-width" rows="15" th:inline="text">[[${ArticleID.description}]]
|
||||
</textarea>
|
||||
</p>
|
||||
<div class="l">
|
||||
|
|