list suppliers page
This commit is contained in:
parent
1b2e75a82c
commit
c8d3ab3ff0
|
@ -100,11 +100,12 @@ public class RequestController {
|
|||
return "intern/customerOrders/id";
|
||||
}
|
||||
|
||||
/*
|
||||
@GetMapping("/intern/suppliers/")
|
||||
public String internSuppliers() {
|
||||
return "intern/suppliers/index";
|
||||
}
|
||||
|
||||
*/
|
||||
@GetMapping("/intern/suppliers/{id}")
|
||||
public String internSuppliersId() {
|
||||
return "intern/suppliers/id";
|
||||
|
@ -120,15 +121,6 @@ public class RequestController {
|
|||
return "intern/supplierOrders/id";
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@GetMapping("/intern/suppliersOffers")
|
||||
public String internSuppliersOffers() {
|
||||
return "intern/offeredArticles/index";
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@GetMapping("/intern/accounting/")
|
||||
public String accounting() {
|
||||
return "intern/accounting/index";
|
||||
|
|
|
@ -1,8 +1,62 @@
|
|||
package org.hso.ecommerce.controller.intern.suppliers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hso.ecommerce.entities.supplier.Supplier;
|
||||
import org.hso.ecommerce.repos.supplier.SupplierRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
//@RequestMapping("...")
|
||||
@RequestMapping("/intern/")
|
||||
public class SupplierIndexController {
|
||||
|
||||
@Autowired
|
||||
private final SupplierRepository supplierRepository = null;
|
||||
|
||||
@GetMapping("suppliers")
|
||||
public String listSuppliers(Model model) {
|
||||
|
||||
List<UImodelSuppliers> totals = new ArrayList<UImodelSuppliers>();
|
||||
|
||||
for (Supplier supplier : supplierRepository.findAll()) {
|
||||
UImodelSuppliers tmp = new UImodelSuppliers(supplier.id, supplier.name);
|
||||
totals.add(tmp);
|
||||
}
|
||||
|
||||
model.addAttribute("suppliers", totals);
|
||||
return "intern/suppliers/index";
|
||||
}
|
||||
|
||||
public class UImodelSuppliers {
|
||||
long id;
|
||||
String name;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public UImodelSuppliers(long id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
package org.hso.ecommerce.repos.supplier;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hso.ecommerce.entities.supplier.Supplier;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface SupplierRepository extends JpaRepository<Supplier, Long> {
|
||||
|
||||
@Query("SELECT a FROM Supplier a")
|
||||
List<Supplier> findAll();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,63 +1,52 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.75, user-scalable=no">
|
||||
|
||||
<title>Lieferanten</title>
|
||||
<script th:src="@{/js/filterTable.js}"></script>
|
||||
<link rel="stylesheet" th:href="@{/css/ecom.css}"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav th:replace="fragments/header :: header">Header</nav>
|
||||
<div class="sidebar-layout content-width">
|
||||
<nav></nav>
|
||||
<div>
|
||||
<h1>Lieferanten</h1>
|
||||
|
||||
<script th:src="@{/js/back.js}"></script>
|
||||
<div class="back" data-group="intern" data-name="Zurück zur Übersicht der Lieferanten."
|
||||
data-insert="false"></div>
|
||||
</div>
|
||||
</div>
|
||||
<main class="sidebar-layout content-width">
|
||||
<nav th:replace="fragments/intern :: sidebar"></nav>
|
||||
<div class="content-width">
|
||||
<p>
|
||||
<table id="main-table">
|
||||
<tr>
|
||||
<th colspan="7">
|
||||
<input type="text" placeholder="Filtern" class="smaller jsFilterTable full-width"
|
||||
data-target-id="main-table"></input>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nr</th>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>0015</td>
|
||||
<td>Cheap AG</td>
|
||||
<td><a th:href="@{/intern/suppliers/4884}" class="button smaller">Details</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>5012</td>
|
||||
<td>Not Cheap GmbH & Co. KG</td>
|
||||
<td><a th:href="@{/intern/suppliers/4884}" class="button smaller">Details</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>7400</td>
|
||||
<td>Hans MÜller GmbH</td>
|
||||
<td><a th:href="@{/intern/suppliers/4884}" class="button smaller">Details</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
<footer th:replace="fragments/footer :: footer"></footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.75, user-scalable=no">
|
||||
<title>Lieferanten</title>
|
||||
<script th:src="@{/js/filterTable.js}"></script>
|
||||
<link rel="stylesheet" th:href="@{/css/ecom.css}"/>
|
||||
</head>
|
||||
<body>
|
||||
<nav th:replace="fragments/header :: header">Header</nav>
|
||||
<div class="sidebar-layout content-width">
|
||||
<nav></nav>
|
||||
<div>
|
||||
<h1>Lieferanten</h1>
|
||||
<script th:src="@{/js/back.js}"></script>
|
||||
<div class="back" data-group="intern" data-name="Zurück zur Übersicht der Lieferanten."
|
||||
data-insert="false"></div>
|
||||
</div>
|
||||
</div>
|
||||
<main class="sidebar-layout content-width">
|
||||
<nav th:replace="fragments/intern :: sidebar"></nav>
|
||||
<div class="content-width">
|
||||
<p>
|
||||
<table id="main-table">
|
||||
<tr>
|
||||
<th colspan="7">
|
||||
<input type="text" placeholder="Filtern" class="smaller jsFilterTable full-width"
|
||||
data-target-id="main-table"></input>
|
||||
</th>
|
||||
</tr>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nr</th>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="supplier : ${suppliers}">
|
||||
<td><span th:text="${supplier.id}"></span></td>
|
||||
<td><span th:text="${supplier.name}"></span></td>
|
||||
<td><a th:href="@{/intern/suppliers/{id}(id = ${supplier.id})}" class="button smaller">Details</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
<footer th:replace="fragments/footer :: footer"></footer>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue