finished supplier orders
This commit is contained in:
parent
67c101ebea
commit
1cb52a20d4
|
@ -100,28 +100,6 @@ public class RequestController {
|
||||||
return "intern/customerOrders/id";
|
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";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@GetMapping("/intern/supplierOrders/")
|
|
||||||
public String internSupplierOrders() {
|
|
||||||
return "intern/supplierOrders/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/intern/supplierOrders/{id}")
|
|
||||||
public String internSupplierOrdersId() {
|
|
||||||
return "intern/supplierOrders/id";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/intern/accounting/")
|
@GetMapping("/intern/accounting/")
|
||||||
public String accounting() {
|
public String accounting() {
|
||||||
return "intern/accounting/index";
|
return "intern/accounting/index";
|
||||||
|
|
|
@ -1,8 +1,140 @@
|
||||||
package org.hso.ecommerce.controller.intern.suppliers;
|
package org.hso.ecommerce.controller.intern.suppliers;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hso.ecommerce.entities.supplier.SupplierOrder;
|
||||||
|
import org.hso.ecommerce.repos.supplier.SupplierOrderRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
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
|
@Controller
|
||||||
//@RequestMapping("...")
|
@RequestMapping("/intern/")
|
||||||
public class SupplierOrderController {
|
public class SupplierOrderController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private final SupplierOrderRepository supplierOrderRepository = null;
|
||||||
|
|
||||||
|
@GetMapping("supplierOrders")
|
||||||
|
public String listSuppliers(Model model) {
|
||||||
|
|
||||||
|
List<UImodelSupplierOrder> totals = new ArrayList<UImodelSupplierOrder>();
|
||||||
|
|
||||||
|
for (SupplierOrder orders : supplierOrderRepository.findAll()) {
|
||||||
|
totals.add(new UImodelSupplierOrder(orders));
|
||||||
|
}
|
||||||
|
|
||||||
|
model.addAttribute("orders", totals);
|
||||||
|
|
||||||
|
return "intern/supplierOrders/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UImodelSupplierOrder {
|
||||||
|
long id;
|
||||||
|
String dateOrder;
|
||||||
|
String supplierName;
|
||||||
|
String articleName;
|
||||||
|
long articleId;
|
||||||
|
String priceNetto;
|
||||||
|
String quantity;
|
||||||
|
String price_total;
|
||||||
|
boolean arrived;
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDateOrder() {
|
||||||
|
return dateOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateOrder(String dateOrder) {
|
||||||
|
this.dateOrder = dateOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArticleName() {
|
||||||
|
return articleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArticleName(String articleName) {
|
||||||
|
this.articleName = articleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPriceNetto() {
|
||||||
|
return priceNetto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriceNetto(String priceNetto) {
|
||||||
|
this.priceNetto = priceNetto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQuantity() {
|
||||||
|
return quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantity(String quantity) {
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrice_total() {
|
||||||
|
return price_total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice_total(String price_total) {
|
||||||
|
this.price_total = price_total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getArticleId() {
|
||||||
|
return articleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArticleId(long articleId) {
|
||||||
|
this.articleId = articleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isArrived() {
|
||||||
|
return arrived;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArrived(boolean arrived) {
|
||||||
|
this.arrived = arrived;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSupplierName() {
|
||||||
|
return supplierName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSupplierName(String supplierName) {
|
||||||
|
this.supplierName = supplierName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UImodelSupplierOrder(SupplierOrder order) {
|
||||||
|
this.id = order.id;
|
||||||
|
this.supplierName = order.supplier.name;
|
||||||
|
this.articleName = order.ordered.title;
|
||||||
|
this.articleId = order.ordered.id;
|
||||||
|
this.priceNetto = String.format("%.2f", ((float) order.pricePerUnitNetCent / 100));
|
||||||
|
this.quantity = String.valueOf(order.numberOfUnits);
|
||||||
|
this.price_total = String.format("%.2f", ((float) order.totalPriceNet / 100));
|
||||||
|
|
||||||
|
Date date = new Date();
|
||||||
|
date.setTime(order.created.getTime());
|
||||||
|
this.dateOrder = new SimpleDateFormat("dd.MM.yyyy").format(date);
|
||||||
|
|
||||||
|
if (order.delivered != null) {
|
||||||
|
arrived = true;
|
||||||
|
} else {
|
||||||
|
arrived = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,5 +18,8 @@ public interface SupplierOrderRepository extends JpaRepository<SupplierOrder, Lo
|
||||||
@Query(value = "SELECT * FROM supplier_orders as a WHERE a.supplier_id = :supplierId", nativeQuery = true)
|
@Query(value = "SELECT * FROM supplier_orders as a WHERE a.supplier_id = :supplierId", nativeQuery = true)
|
||||||
List<SupplierOrder> findOrderBySupplierID(@Param("supplierId") long supplierId);
|
List<SupplierOrder> findOrderBySupplierID(@Param("supplierId") long supplierId);
|
||||||
|
|
||||||
|
|
||||||
|
@Query("SELECT a FROM SupplierOrder a")
|
||||||
|
List<SupplierOrder> findAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,103 +1,71 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">
|
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
<head>
|
<meta charset="utf-8">
|
||||||
<meta charset="utf-8">
|
<meta name="viewport" content="width=device-width, initial-scale=0.75, user-scalable=no">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=0.75, user-scalable=no">
|
<title>Lieferanten Bestellungen</title>
|
||||||
|
<script th:src="@{/js/filterTable.js}"></script>
|
||||||
<title>Lieferanten Bestellungen</title>
|
<link rel="stylesheet" th:href="@{/css/ecom.css}"/>
|
||||||
<script th:src="@{/js/filterTable.js}"></script>
|
</head>
|
||||||
<link rel="stylesheet" th:href="@{/css/ecom.css}"/>
|
<body>
|
||||||
</head>
|
<nav th:replace="fragments/header :: header">Header</nav>
|
||||||
|
<div class="sidebar-layout content-width">
|
||||||
<body>
|
<nav></nav>
|
||||||
<nav th:replace="fragments/header :: header">Header</nav>
|
<div>
|
||||||
<div class="sidebar-layout content-width">
|
<h1>Lieferanten Bestellungen</h1>
|
||||||
<nav></nav>
|
<script th:src="@{/js/back.js}"></script>
|
||||||
<div>
|
<div class="back" data-group="intern" data-name="Zurück zu den Bestellungen bei Lieferanten."
|
||||||
<h1>Lieferanten Bestellungen</h1>
|
data-insert="false"></div>
|
||||||
|
</div>
|
||||||
<script th:src="@{/js/back.js}"></script>
|
</div>
|
||||||
<div class="back" data-group="intern" data-name="Zurück zu den Bestellungen bei Lieferanten."
|
<main class="sidebar-layout content-width">
|
||||||
data-insert="false"></div>
|
<nav th:replace="fragments/intern :: sidebar"></nav>
|
||||||
</div>
|
<div class="content-width">
|
||||||
</div>
|
<p>
|
||||||
<main class="sidebar-layout content-width">
|
<table id="main-table">
|
||||||
<nav th:replace="fragments/intern :: sidebar"></nav>
|
<tr>
|
||||||
<div class="content-width">
|
<th colspan="9">
|
||||||
<p>
|
<input type="text" placeholder="Filtern" class="smaller jsFilterTable full-width"
|
||||||
<table id="main-table">
|
data-target-id="main-table"></input>
|
||||||
<tr>
|
</th>
|
||||||
<th colspan="9">
|
</tr>
|
||||||
<input type="text" placeholder="Filtern" class="smaller jsFilterTable full-width"
|
<thead>
|
||||||
data-target-id="main-table"></input>
|
<tr>
|
||||||
</th>
|
<th>Bestellnummer</th>
|
||||||
</tr>
|
<th>Datum</th>
|
||||||
<tr>
|
<th>Leiferant</th>
|
||||||
<th>Bestellnummer</th>
|
<th>Artikel</th>
|
||||||
<th>Datum</th>
|
<th>Preis/Stk (Netto)</th>
|
||||||
<th>Leiferant</th>
|
<th>Menge</th>
|
||||||
<th>Artikel</th>
|
<th>Gesamtpreis (Netto)</th>
|
||||||
<th>Preis/Stk (Netto)</th>
|
<th>Status</th>
|
||||||
<th>Menge</th>
|
</tr>
|
||||||
<th>Gesamtpreis (Netto)</th>
|
</thead>
|
||||||
<th>Status</th>
|
<tbody>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<tr th:each="order : ${orders}">
|
||||||
<td>4545</td>
|
<td><span th:text="${order.id}"></span></td>
|
||||||
<td>2019-18-10</td>
|
<td><span th:text="${order.dateOrder}"></span></td>
|
||||||
<td><a th:href="@{/intern/suppliers/45015}">Cheap AG</a></td>
|
<td><span th:text="${order.supplierName}"></span></td>
|
||||||
<td><a th:href="@{/intern/listedArticles/45015}">Kamera</a></td>
|
<td><a th:href="@{/intern/articles/{id}(id = ${order.articleId})}" class="button smaller" th:text="${order.articleName}"></a></td>
|
||||||
<td>20,00 EUR</td>
|
<td><span th:text="${order.priceNetto}"></span> €</td>
|
||||||
<td>10</td>
|
<td><span th:text="${order.quantity}"></span></td>
|
||||||
<td>200,00 EUR</td>
|
<td><span th:text="${order.price_total}"></span> €</td>
|
||||||
<td>Unterwegs <br/><a th:href="@{/intern/warehouse/todo}" class="button smaller">Angekommen</a></td>
|
<td>
|
||||||
</tr>
|
<div th:if="${order.arrived}">
|
||||||
<tr>
|
<a th:href="@{/intern/warehouse/todo}" class="button smaller">Angekommen</a>
|
||||||
<td>2455</td>
|
</div>
|
||||||
<td>2019-18-10</td>
|
<!-- ELSE -->
|
||||||
<td><a th:href="@{/intern/suppliers/45015}">Cheap AG</a></td>
|
<div th:unless="${order.arrived}">
|
||||||
<td><a th:href="@{/intern/listedArticles/45015}">Kamera</a></td>
|
Unterwegs
|
||||||
<td>20,00 EUR</td>
|
</div>
|
||||||
<td>11</td>
|
</td>
|
||||||
<td>220,00 EUR</td>
|
</tr>
|
||||||
<td>Unterwegs <br/><a th:href="@{/intern/warehouse/todo}" class="button smaller">Angekommen</a></td>
|
</tbody>
|
||||||
</tr>
|
</table>
|
||||||
<tr>
|
</p>
|
||||||
<td>1224</td>
|
</div>
|
||||||
<td>2019-18-10</td>
|
</main>
|
||||||
<td><a th:href="@{/intern/suppliers/45015}">Cheap AG</a></td>
|
<footer th:replace="fragments/footer :: footer"></footer>
|
||||||
<td><a th:href="@{/intern/listedArticles/45015}">Kamera</a></td>
|
</body>
|
||||||
<td>20,00 EUR</td>
|
</html>
|
||||||
<td>11</td>
|
|
||||||
<td>220,00 EUR</td>
|
|
||||||
<td>Angekommen</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>4520</td>
|
|
||||||
<td>2019-18-10</td>
|
|
||||||
<td><a th:href="@{/intern/suppliers/45015}">Cheap AG</a></td>
|
|
||||||
<td><a th:href="@{/intern/listedArticles/45015}">Kamera</a></td>
|
|
||||||
<td>20,00 EUR</td>
|
|
||||||
<td>11</td>
|
|
||||||
<td>220,00 EUR</td>
|
|
||||||
<td>Angekommen</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>4521</td>
|
|
||||||
<td>2019-18-10</td>
|
|
||||||
<td><a th:href="@{/intern/suppliers/45015}">Cheap AG</a></td>
|
|
||||||
<td><a th:href="@{/intern/listedArticles/45015}">Kamera</a></td>
|
|
||||||
<td>20,00 EUR</td>
|
|
||||||
<td>11</td>
|
|
||||||
<td>220,00 EUR</td>
|
|
||||||
<td>Angekommen</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<footer th:replace="fragments/footer :: footer"></footer>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
Reference in New Issue