WIP feature/listedArticles #15
|
@ -49,12 +49,17 @@ public class RequestController {
|
|||
return "login";
|
||||
}
|
||||
|
||||
//TODO remove bypass
|
||||
|
||||
/*
|
||||
if (!user.get().validatePassword(password)) {
|
||||
request.setAttribute("error", "Passwort falsch.");
|
||||
response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
|
||||
return "login";
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
session.setAttribute("userId", user.get().getId());
|
||||
|
||||
if (gto != null && gto.startsWith("/")) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.view.RedirectView;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("intern/articles")
|
||||
|
@ -51,22 +52,16 @@ public class InternArticleController {
|
|||
}
|
||||
|
||||
|
||||
@PostMapping("/{id}")
|
||||
public String newEmployee( Model model, @PathVariable String id) {
|
||||
@PostMapping("/{id}/saveChanges")
|
||||
public RedirectView saveChanges() {
|
||||
|
||||
System.out.println("\n------ POST -----\n");
|
||||
|
||||
|
||||
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";
|
||||
return new RedirectView("../");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<nav th:replace="fragments/intern :: sidebar"></nav>
|
||||
<div class="content-width">
|
||||
<h2>Gelisteter Artikel ID <span th:text="${ArticleID.id}"></span></h2>
|
||||
<form class="detailgrid">
|
||||
<form class="detailgrid" action="/intern/articles/5/saveChanges" method="POST">
|
||||
<p class="m">
|
||||
<label for="title">Titel</label>
|
||||
<input class=" full-width" type="text" name="title" th:value="${ArticleID.title}"/>
|
||||
|
@ -104,6 +104,7 @@
|
|||
<div class="l">
|
||||
<button type="submit">Änderungen speichern</button>
|
||||
<button type="reset">Zurücksetzen</button>
|
||||
<button onclick="history.back()">Änderungen verwerfen</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -24,16 +24,15 @@
|
|||
<main class="sidebar-layout content-width">
|
||||
<nav th:replace="fragments/intern :: sidebar"></nav>
|
||||
<div class="content-width">
|
||||
<h2>Artikel Hinzufügen</h2>
|
||||
<p>
|
||||
Weitere Artikel können über Artikelübersicht gelistet werden.
|
||||
<a class="button smaller" th:href="@{/intern/articles/}"> Jetzt Hinzufügen </a>
|
||||
Weitere Artikel können über Artikelübersicht der Lieferanten hinzugefügt werden.
|
||||
<a class="button smaller" th:href="@{/intern/suppliers/articles}"> Jetzt Hinzufügen </a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<table id="main-table">
|
||||
<tr>
|
||||
<th colspan="8">
|
||||
<th colspan="9">
|
||||
<input type="text" placeholder="Filtern" class="smaller jsFilterTable full-width"
|
||||
data-target-id="main-table"></input>
|
||||
</th>
|
||||
|
@ -46,8 +45,9 @@
|
|||
<th>(Netto)</th>
|
||||
<th>Kategorien</th>
|
||||
<th>Lagerbestand</th>
|
||||
<th>Angebot</th>
|
||||
<th>ID</th>
|
||||
<th>Angebots ID</th>
|
||||
<th>Artikel ID</th>
|
||||
<th>Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -60,6 +60,7 @@
|
|||
<td><span th:text="${article.stock}"></span></td>
|
||||
<td><a th:href="@{/intern/suppliers/articles/{id}(id = ${article.offer_id})}" th:text="${article.offer_id}"></a></td>
|
||||
<td><a th:href="@{/intern/articles/{id}(id = ${article.id})}" th:text="${article.id}"></a></td>
|
||||
<td><form th:action="@{/intern/articles/{id}(id = ${article.id})}"><input type="submit" value="Bearbeiten" /></form></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Reference in New Issue