finished supplier orders
This commit is contained in:
parent
67c101ebea
commit
1cb52a20d4
|
@ -100,28 +100,6 @@ 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";
|
||||
}
|
||||
*/
|
||||
|
||||
@GetMapping("/intern/supplierOrders/")
|
||||
public String internSupplierOrders() {
|
||||
return "intern/supplierOrders/index";
|
||||
}
|
||||
|
||||
@GetMapping("/intern/supplierOrders/{id}")
|
||||
public String internSupplierOrdersId() {
|
||||
return "intern/supplierOrders/id";
|
||||
}
|
||||
|
||||
@GetMapping("/intern/accounting/")
|
||||
public String accounting() {
|
||||
return "intern/accounting/index";
|
||||
|
|
|
@ -1,8 +1,140 @@
|
|||
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.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
//@RequestMapping("...")
|
||||
@RequestMapping("/intern/")
|
||||
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)
|
||||
List<SupplierOrder> findOrderBySupplierID(@Param("supplierId") long supplierId);
|
||||
|
||||
|
||||
@Query("SELECT a FROM SupplierOrder a")
|
||||
List<SupplierOrder> findAll();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,103 +1,71 @@
|
|||
<!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 Bestellungen</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 Bestellungen</h1>
|
||||
|
||||
<script th:src="@{/js/back.js}"></script>
|
||||
<div class="back" data-group="intern" data-name="Zurück zu den Bestellungen bei 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="9">
|
||||
<input type="text" placeholder="Filtern" class="smaller jsFilterTable full-width"
|
||||
data-target-id="main-table"></input>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Bestellnummer</th>
|
||||
<th>Datum</th>
|
||||
<th>Leiferant</th>
|
||||
<th>Artikel</th>
|
||||
<th>Preis/Stk (Netto)</th>
|
||||
<th>Menge</th>
|
||||
<th>Gesamtpreis (Netto)</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>4545</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>10</td>
|
||||
<td>200,00 EUR</td>
|
||||
<td>Unterwegs <br/><a th:href="@{/intern/warehouse/todo}" class="button smaller">Angekommen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2455</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>Unterwegs <br/><a th:href="@{/intern/warehouse/todo}" class="button smaller">Angekommen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1224</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>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>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<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>
|
||||
<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 Bestellungen</h1>
|
||||
<script th:src="@{/js/back.js}"></script>
|
||||
<div class="back" data-group="intern" data-name="Zurück zu den Bestellungen bei 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="9">
|
||||
<input type="text" placeholder="Filtern" class="smaller jsFilterTable full-width"
|
||||
data-target-id="main-table"></input>
|
||||
</th>
|
||||
</tr>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bestellnummer</th>
|
||||
<th>Datum</th>
|
||||
<th>Leiferant</th>
|
||||
<th>Artikel</th>
|
||||
<th>Preis/Stk (Netto)</th>
|
||||
<th>Menge</th>
|
||||
<th>Gesamtpreis (Netto)</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<tr th:each="order : ${orders}">
|
||||
<td><span th:text="${order.id}"></span></td>
|
||||
<td><span th:text="${order.dateOrder}"></span></td>
|
||||
<td><span th:text="${order.supplierName}"></span></td>
|
||||
<td><a th:href="@{/intern/articles/{id}(id = ${order.articleId})}" class="button smaller" th:text="${order.articleName}"></a></td>
|
||||
<td><span th:text="${order.priceNetto}"></span> €</td>
|
||||
<td><span th:text="${order.quantity}"></span></td>
|
||||
<td><span th:text="${order.price_total}"></span> €</td>
|
||||
<td>
|
||||
<div th:if="${order.arrived}">
|
||||
<a th:href="@{/intern/warehouse/todo}" class="button smaller">Angekommen</a>
|
||||
</div>
|
||||
<!-- ELSE -->
|
||||
<div th:unless="${order.arrived}">
|
||||
Unterwegs
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
<footer th:replace="fragments/footer :: footer"></footer>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue