diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/SupplierIndexController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/SupplierIndexController.java index 5a6720e..b6d25eb 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/SupplierIndexController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/SupplierIndexController.java @@ -1,12 +1,10 @@ package org.hso.ecommerce.controller.intern.suppliers; -import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; -import org.hso.ecommerce.entities.supplier.ArticleOffer; import org.hso.ecommerce.entities.supplier.Supplier; import org.hso.ecommerce.entities.supplier.SupplierOrder; import org.hso.ecommerce.repos.supplier.SupplierOrderRepository; @@ -44,19 +42,17 @@ public class SupplierIndexController { @GetMapping("/suppliers/{id}") public String supplierDetail(Model model, @PathVariable String id) { - + int supplierId = Integer.parseInt(id); List orders = new ArrayList(); - + for (SupplierOrder supplierOrder : supplierOrderRepository.findOrderBySupplierID(supplierId)) { orders.add(new UImodelSupplierDetailOrders(supplierOrder)); } - UImodelSupplierDetail total = new UImodelSupplierDetail( - supplierRepository.findSupplierById(supplierId).name, - "42€", - orders); + UImodelSupplierDetail total = new UImodelSupplierDetail(supplierRepository.findSupplierById(supplierId).name, + "42€", orders); model.addAttribute("SupplierDetail", total); @@ -136,7 +132,7 @@ public class SupplierIndexController { String priceNetto; String quantity; String price_total; - String dateArrival; + boolean arrived; public long getId() { return id; @@ -186,14 +182,6 @@ public class SupplierIndexController { this.price_total = price_total; } - public String getDateArrival() { - return dateArrival; - } - - public void setDateArrival(String dateArrival) { - this.dateArrival = dateArrival; - } - public long getArticleId() { return articleId; } @@ -202,23 +190,31 @@ public class SupplierIndexController { this.articleId = articleId; } - public UImodelSupplierDetailOrders(SupplierOrder order) - { - + public boolean isArrived() { + return arrived; + } + + public void setArrived(boolean arrived) { + this.arrived = arrived; + } + + public UImodelSupplierDetailOrders(SupplierOrder order) { this.id = order.id; 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); - date.setTime(order.delivered.getTime()); - this.dateArrival = new SimpleDateFormat("dd.MM.yyyy").format(date); + + if (order.delivered != null) { + arrived = true; + } else { + arrived = false; + } } - } - } diff --git a/prototype/src/main/resources/templates/intern/suppliers/id.html b/prototype/src/main/resources/templates/intern/suppliers/id.html index b32be5d..6799b3b 100644 --- a/prototype/src/main/resources/templates/intern/suppliers/id.html +++ b/prototype/src/main/resources/templates/intern/suppliers/id.html @@ -49,8 +49,15 @@ € - - + +
+ Angekommen +
+ +
+ Unterwegs +
+